Small code changes to match the current report state
This commit is contained in:
@@ -42,6 +42,7 @@ class Board {
|
||||
*/
|
||||
Board(int N, int S) {
|
||||
assert (N%2 != 0) : "Board's size has to be an odd number.";
|
||||
assert (S <= (N*N-2)) : "At least 2 tiles has to be without supplies.";
|
||||
this.N = Session.boardSize = N;
|
||||
this.S = S;
|
||||
this.W = 0;
|
||||
@@ -394,7 +395,7 @@ class Board {
|
||||
if (tiles[tileId].hasWalls() >= Const.maxTileWalls)
|
||||
return false;
|
||||
Range dirs = new Range(DirRange.Begin, DirRange.End, DirRange.Step);
|
||||
for (int dir ; (dir = dirs.get()) != Const.noTileId ; )
|
||||
for (int dir = dirs.get() ; dir != Const.EOR ; dir = dirs.get())
|
||||
if (isWallableDir(tileId, dir))
|
||||
return true;
|
||||
return false;
|
||||
@@ -457,7 +458,7 @@ class Board {
|
||||
for (int tileId, i =0, walls =0, shuffleMark =0 ; true ; ) {
|
||||
// randomly pick a wallable tile.
|
||||
do {
|
||||
if ((tileId = randTiles.get())== Const.noTileId) {
|
||||
if ((tileId = randTiles.get())== Const.EOR) {
|
||||
if (i == shuffleMark) // Wallable tiles exhausted.
|
||||
return walls;
|
||||
else { // Re-shuffle and continue.
|
||||
|
||||
Reference in New Issue
Block a user