Lines Matching defs:box
41 #include "box.h"
56 // Find the first closure, i.e. a box that has 3 edges
64 BOX box(y, x, b);
65 if (box.count() == 3) {
67 if (!box.isset(dir))
69 b.abort("find_closure: 3 sided box[%zu,%zu] has no free sides",
127 * and the first box of the maximum closure in (x, y, dir)
155 // Find if a turn does not result in a capture on the given box
157 int ALGOR::try_good_turn(BOX& box, size_t y, size_t x, int& dir, BOARD& b)
159 // Sanity check; we must have a good box
160 if (box.count() >= 2)
161 b.abort("try_good_turn: box[%zu,%zu] has more than 2 sides occupied",
164 // Make sure we don't make a closure in an adjacent box.
168 if (!box.isset(dir)) {
193 BOX box(y, x, nb);
194 if (box.count() < 2 && try_good_turn(box, y, x, dir, nb))
201 // On a box with 2 edges, return the first or the last free edge, depending
203 int ALGOR::try_bad_turn(BOX& box, size_t& y, size_t& x, int& dir, BOARD& b,
206 if (4 - box.count() <= last)
208 y, x, last, box.count());
210 if (!box.isset(dir)) {
219 // Find a box that has 2 edges and return the first free edge of that
220 // box or the last free edge of that box
227 BOX box(y, x, b);
228 if ((4 - box.count()) > last &&
229 try_bad_turn(box, y, x, dir, b, last))
304 // See if we can play an edge without giving the opponent a box