bool lame = false;
bool initial = false;
int distance = 0;
+ int fExtension = 0;
+ int fsExtension = 0;
std::vector<std::string> prelimDirections = {};
for (std::string::size_type i = 0; i < betza.size(); i++)
{
// Check for rider
if (riderAtoms.find(c) != riderAtoms.end())
rider = true;
- if (i + 1 < betza.size() && (isdigit(betza[i+1]) || betza[i+1] == c))
- {
- rider = true;
- // limited distance riders
- if (isdigit(betza[i+1]))
- distance = betza[i+1] - '0';
- i++;
- }
+ if (i + 1 < betza.size()) {
+ if (betza[++i] == 'X')
+ fExtension++;
+ else if (betza[i] == 'Y')
+ fsExtension++;
+ else if (isdigit(betza[i]) || betza[i] == c)
+ {
+ rider = true;
+ // limited distance riders
+ if (isdigit(betza[i])) {
+ int range = betza[i] - '0';
+ if(range)
+ distance = range;
+ }
+ } else i--;
+ }
if (!rider && lame)
distance = -1;
// No modality qualifier means m+c
// Define moves
for (const auto& atom : atoms)
{
+ int y = atom.first + 3*fExtension + 2*fsExtension;
+ int x = atom.second + 2*fsExtension;
std::vector<std::string> directions = {};
// Split directions for orthogonal pieces
// This is required e.g. to correctly interpret fsW for soldiers
auto has_dir = [&](std::string s) {
return std::find(directions.begin(), directions.end(), s) != directions.end();
};
- if (directions.size() == 0 || has_dir("ff") || has_dir("vv") || has_dir("rf") || has_dir("rv") || has_dir("fh") || has_dir("rh") || has_dir("hr"))
+ if (directions.size() == 0 || has_dir("ff") || has_dir("vv") || has_dir("rf") || has_dir("rv") || has_dir("fh") || has_dir("rh") || has_dir("hr"))
v[step(y, x)] = distance;
- if (directions.size() == 0 || has_dir("bb") || has_dir("vv") || has_dir("lb") || has_dir("lv") || has_dir("bh") || has_dir("lh") || has_dir("hr"))
+ if (directions.size() == 0 || has_dir("bb") || has_dir("vv") || has_dir("lb") || has_dir("lv") || has_dir("bh") || has_dir("lh") || has_dir("hr"))
v[step(-y, -x)] = distance;
- if (directions.size() == 0 || has_dir("rr") || has_dir("ss") || has_dir("br") || has_dir("bs") || has_dir("bh") || has_dir("rh") || has_dir("hr"))
+ if (directions.size() == 0 || has_dir("rr") || has_dir("ss") || has_dir("br") || has_dir("bs") || has_dir("bh") || has_dir("rh") || has_dir("hr"))
v[step(-x, y)] = distance;
- if (directions.size() == 0 || has_dir("ll") || has_dir("ss") || has_dir("fl") || has_dir("fs") || has_dir("fh") || has_dir("lh") || has_dir("hr"))
+ if (directions.size() == 0 || has_dir("ll") || has_dir("ss") || has_dir("fl") || has_dir("fs") || has_dir("fh") || has_dir("lh") || has_dir("hr"))
v[step(x, -y)] = distance;
- if (directions.size() == 0 || has_dir("rr") || has_dir("ss") || has_dir("fr") || has_dir("fs") || has_dir("fh") || has_dir("rh") || has_dir("hl"))
+ if (directions.size() == 0 || has_dir("rr") || has_dir("ss") || has_dir("fr") || has_dir("fs") || has_dir("fh") || has_dir("rh") || has_dir("hl"))
v[step(x, y)] = distance;
- if (directions.size() == 0 || has_dir("ll") || has_dir("ss") || has_dir("bl") || has_dir("bs") || has_dir("bh") || has_dir("lh") || has_dir("hl"))
+ if (directions.size() == 0 || has_dir("ll") || has_dir("ss") || has_dir("bl") || has_dir("bs") || has_dir("bh") || has_dir("lh") || has_dir("hl"))
v[step(-x, -y)] = distance;
- if (directions.size() == 0 || has_dir("bb") || has_dir("vv") || has_dir("rb") || has_dir("rv") || has_dir("bh") || has_dir("rh") || has_dir("hl"))
+ if (directions.size() == 0 || has_dir("bb") || has_dir("vv") || has_dir("rb") || has_dir("rv") || has_dir("bh") || has_dir("rh") || has_dir("hl"))
v[step(-y, x)] = distance;
- if (directions.size() == 0 || has_dir("ff") || has_dir("vv") || has_dir("lf") || has_dir("lv") || has_dir("fh") || has_dir("lh") || has_dir("hl"))
+ if (directions.size() == 0 || has_dir("ff") || has_dir("vv") || has_dir("lf") || has_dir("lv") || has_dir("fh") || has_dir("lh") || has_dir("hl"))
v[step(y, -x)] = distance;
}
}
lame = false;
initial = false;
distance = 0;
+ fExtension = 0;
+ fsExtension = 0;
}
}
return p;