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