- public int difficulty=1; // 1=Hard ... N=Easy
- public boolean gravity=true;
- public int [] boardSize;
- public char[][] board;
- public LinkedList<Move> history;
-
- // ----------------------
- // Public methods
- // ----------------------
-
- public Board() {
- }
-
- // The board always has a 1-square width free rectangle that has
- // to be taken into account when specifying the size
- public void initialize(int sizeI, int sizeJ) {
- boardSize = new int[2];
- boardSize[0]=sizeI;
- boardSize[1]=sizeJ;
- board = new char[boardSize[0]][boardSize[1]];
- for (int i=0;i<boardSize[0];i++)
- for (int j=0;j<boardSize[1];j++)
- board[i][j]=0;
- history=new LinkedList<Move>();
- }
-
- public static String pieceToString(char piece) {
- return charpieces.substring(piece,1);
- }
-
- public static char StringToPiece(String piece) {
- char upiece;
- long charpiecesLen=charpieces.length();
- for(upiece=0;(upiece<charpiecesLen && charpieces.substring(upiece,1)!=piece);upiece++);
- if (upiece<charpiecesLen) return upiece;
- else return 0;
- }
-
- public String toString() {
- String result=" ";
- for (int j=0;j<boardSize[1];j++) {
- if (j>0) result+=" ";
- result+=""+(j%10);
- }
- result+="\n "+StringRepeat("--",boardSize[1]);
- for (int i=0;i<boardSize[0];i++) {
- result+="\n"+(i%10)+"|";
- for (int j=0;j<boardSize[1];j++) {
- if (j>0) result+=" ";
+ public int difficulty=1; // 1=Hard ... N=Easy
+ public boolean gravity=true;
+ public int [] boardSize;
+ public char[][] board;
+ public LinkedList<Move> history;
+
+ // ----------------------
+ // Public methods
+ // ----------------------
+
+ public Board() {
+ }
+
+ // The board always has a 1-square width free rectangle that has
+ // to be taken into account when specifying the size
+ public void initialize(int sizeI, int sizeJ) {
+ boardSize = new int[2];
+ boardSize[0]=sizeI;
+ boardSize[1]=sizeJ;
+ board = new char[boardSize[0]][boardSize[1]];
+ for (int i=0;i<boardSize[0];i++)
+ for (int j=0;j<boardSize[1];j++)
+ board[i][j]=0;
+ history=new LinkedList<Move>();
+ }
+
+ public static String pieceToString(char piece) {
+ return charpieces.substring(piece,1);
+ }
+
+ public static char StringToPiece(String piece) {
+ char upiece;
+ long charpiecesLen=charpieces.length();
+ for(upiece=0;(upiece<charpiecesLen && charpieces.substring(upiece,1)!=piece);upiece++);
+ if (upiece<charpiecesLen) return upiece;
+ else return 0;
+ }
+
+ public String toString() {
+ String result=" ";
+ for (int j=0;j<boardSize[1];j++) {
+ if (j>0) result+=" ";
+ result+=""+(j%10);
+ }
+ result+="\n "+StringRepeat("--",boardSize[1]);
+ for (int i=0;i<boardSize[0];i++) {
+ result+="\n"+(i%10)+"|";
+ for (int j=0;j<boardSize[1];j++) {
+ if (j>0) result+=" ";