Compute set of fields that can be attacked by \a xy
| 72 | } |
| 73 | /// Compute set of fields that can be attacked by \a xy |
| 74 | IntSet attacked(int xy) { |
| 75 | IntArgs a; |
| 76 | for (int i=0; i<n; i++) |
| 77 | for (int j=0; j<n; j++) |
| 78 | if ((i == x(xy)) || // Same row |
| 79 | (j == y(xy)) || // Same column |
| 80 | (abs(i-x(xy)) == abs(j-y(xy)))) // Same diagonal |
| 81 | a << DominatingQueens::xy(i,j); |
| 82 | return IntSet(a); |
| 83 | } |
| 84 | public: |
| 85 | /// The actual problem |
| 86 | DominatingQueens(const SizeOptions& opt) |