version 1.4, 2008/04/28 20:22:53 |
version 1.5, 2012/02/29 23:39:53 |
Line 65 int ALGOR::find_closure(size_t& y, size_ |
|
Line 65 int ALGOR::find_closure(size_t& y, size_ |
|
for (dir = BOX::first; dir < BOX::last; dir++) |
for (dir = BOX::first; dir < BOX::last; dir++) |
if (!box.isset(dir)) |
if (!box.isset(dir)) |
return 1; |
return 1; |
b.abort("find_closure: 3 sided box[%d,%d] has no free sides", |
b.abort("find_closure: 3 sided box[%zu,%zu] has no free sides", |
y, x); |
y, x); |
} |
} |
} |
} |
Line 112 size_t ALGOR::count_closure(size_t& y, s |
|
Line 112 size_t ALGOR::count_closure(size_t& y, s |
|
dir = tdir; |
dir = tdir; |
} |
} |
if ((mv = b.domove(ty, tx, tdir, getWho())) == -1) |
if ((mv = b.domove(ty, tx, tdir, getWho())) == -1) |
b.abort("count_closure: Invalid move (%d, %d, %d)", y, x, dir); |
b.abort("count_closure: Invalid move (%zu, %zu, %d)", y, x, dir); |
else |
else |
i += mv; |
i += mv; |
} |
} |
Line 157 int ALGOR::try_good_turn(BOX& box, size_ |
|
Line 157 int ALGOR::try_good_turn(BOX& box, size_ |
|
{ |
{ |
// Sanity check; we must have a good box |
// Sanity check; we must have a good box |
if (box.count() >= 2) |
if (box.count() >= 2) |
b.abort("try_good_turn: box[%d,%d] has more than 2 sides occupied", |
b.abort("try_good_turn: box[%zu,%zu] has more than 2 sides occupied", |
y, x); |
y, x); |
|
|
// Make sure we don't make a closure in an adjacent box. |
// Make sure we don't make a closure in an adjacent box. |
Line 203 int ALGOR::try_bad_turn(BOX& box, size_t |
|
Line 203 int ALGOR::try_bad_turn(BOX& box, size_t |
|
int last) |
int last) |
{ |
{ |
if (4 - box.count() <= last) |
if (4 - box.count() <= last) |
b.abort("try_bad_turn: Called at [%d,%d] for %d with %d", |
b.abort("try_bad_turn: Called at [%zu,%zu] for %d with %d", |
y, x, last, box.count()); |
y, x, last, box.count()); |
for (dir = BOX::first; dir < BOX::last; dir++) |
for (dir = BOX::first; dir < BOX::last; dir++) |
if (!box.isset(dir)) { |
if (!box.isset(dir)) { |
Line 246 size_t ALGOR::find_min_closure1(size_t& |
|
Line 246 size_t ALGOR::find_min_closure1(size_t& |
|
|
|
// Play a bad move that would cause the opponent's closure |
// Play a bad move that would cause the opponent's closure |
if ((mv = nb.domove(ty, tx, tdir, getWho())) != 0) |
if ((mv = nb.domove(ty, tx, tdir, getWho())) != 0) |
b.abort("find_min_closure1: Invalid move %d (%d, %d, %d)", mv, |
b.abort("find_min_closure1: Invalid move %d (%zu, %zu, %d)", mv, |
ty, tx, tdir); |
ty, tx, tdir); |
|
|
// Count the opponent's closure |
// Count the opponent's closure |