|
|
@@ -75,7 +75,8 @@ class Board { |
|
|
|
// Clone arrays |
|
|
|
this.tiles = b.tiles.clone(); |
|
|
|
this.supplies = b.supplies.clone(); |
|
|
|
this.walls = b.walls; |
|
|
|
for (Edge it: b.walls) |
|
|
|
this.walls.add(new Edge(it)); |
|
|
|
} |
|
|
|
/** @} */ |
|
|
|
|
|
|
@@ -458,15 +459,15 @@ class Board { |
|
|
|
*/ |
|
|
|
private int createInnerWalls () { |
|
|
|
ShuffledRange randTiles = new ShuffledRange(0, N*N); |
|
|
|
for (int tileId, i =0, walls =0, shuffleMark =0 ; true ; ) { |
|
|
|
for (int tileId, walls =0, shuffleMark =0 ; true ; ) { |
|
|
|
// randomly pick a wallable tile. |
|
|
|
do { |
|
|
|
if ((tileId = randTiles.get())== Const.EOR) { |
|
|
|
if (i == shuffleMark) // Wallable tiles exhausted. |
|
|
|
if (walls == shuffleMark) // Wallable tiles exhausted. |
|
|
|
return walls; |
|
|
|
else { // Re-shuffle and continue. |
|
|
|
randTiles = new ShuffledRange(0, N*N); |
|
|
|
shuffleMark =i; |
|
|
|
shuffleMark =walls; |
|
|
|
} |
|
|
|
} |
|
|
|
} while (!isWallable(tileId)); |
|
|
|