MCPcopy Create free account
hub / github.com/Gecode/gecode / attacked

Method attacked

examples/dominating-queens.cpp:74–83  ·  view source on GitHub ↗

Compute set of fields that can be attacked by \a xy

Source from the content-addressed store, hash-verified

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 }
84public:
85 /// The actual problem
86 DominatingQueens(const SizeOptions& opt)

Callers

nothing calls this directly

Calls 3

IntSetClass · 0.85
xFunction · 0.50
absFunction · 0.50

Tested by

no test coverage detected