瀏覽代碼

Small code changes to match the current report state

tags/v1.0b1
父節點
當前提交
5d8d06c793
共有 3 個檔案被更改,包括 5 行新增3 行删除
  1. +3
    -2
      src/host/labyrinth/Board.java
  2. +1
    -0
      src/host/labyrinth/Common.java
  3. +1
    -1
      src/host/labyrinth/Game.java

+ 3
- 2
src/host/labyrinth/Board.java 查看文件

@@ -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.


+ 1
- 0
src/host/labyrinth/Common.java 查看文件

@@ -18,6 +18,7 @@ class Const {
static final int maxTileWalls = 2; /**< Number of maximum walls for each tile on the board */
static final int noSupply =-1; /**< Number to indicate the absent of supply */
static final int noTileId =-1; /**< Number to indicate wrong tileId */
static final int EOR =-1; /**< Number to indicate the End Of Range */
}
/**
* Application wide object to hold settings like values for the session.


+ 1
- 1
src/host/labyrinth/Game.java 查看文件

@@ -80,7 +80,7 @@ public class Game {
break;

case "-s":
case "--suplies":
case "--supplies":
if (i+1 < args.length)
Session.supplySize = Integer.parseInt(args[++i]);
break;


Loading…
取消
儲存