getAll start
This commit is contained in:
@@ -7,7 +7,7 @@ public class GomokuBoard {
|
|||||||
/** The width of the GomokuBoard.*/
|
/** The width of the GomokuBoard.*/
|
||||||
private int boardWith;
|
private int boardWith;
|
||||||
/** The height of the GomokuBoard.*/
|
/** The height of the GomokuBoard.*/
|
||||||
private int bordHeight;
|
private int boardHeight;
|
||||||
|
|
||||||
//------------------Constructors--------------------------
|
//------------------Constructors--------------------------
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ public class GomokuBoard {
|
|||||||
public GomokuBoard(int width, int height){
|
public GomokuBoard(int width, int height){
|
||||||
this.firstCell = new GomokuCell(Color.NIL);
|
this.firstCell = new GomokuCell(Color.NIL);
|
||||||
this.boardWith = width;
|
this.boardWith = width;
|
||||||
this.bordHeight = height;
|
this.boardHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------Gets--------------------------
|
//------------------Gets--------------------------
|
||||||
@@ -45,6 +45,13 @@ public class GomokuBoard {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GomokuCell[][] getAllsCells(){
|
||||||
|
GomokuCell[][] cells = new GomokuCell[this.boardWith][this.boardHeight];
|
||||||
|
int i = 0, j = 0;
|
||||||
|
GomokuCell nextLine = this.firstCell.getNeighbour(Cardinal.S);
|
||||||
|
return cells;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method return a list of playable cell.
|
* This method return a list of playable cell.
|
||||||
* @return List of GomokuCell wich all is playable.
|
* @return List of GomokuCell wich all is playable.
|
||||||
@@ -54,7 +61,7 @@ public class GomokuBoard {
|
|||||||
List<GomokuCell> output = new ArrayList<>();
|
List<GomokuCell> output = new ArrayList<>();
|
||||||
GomokuCell act = null;
|
GomokuCell act = null;
|
||||||
for (int i = 0; i < this.boardWith; i++) {
|
for (int i = 0; i < this.boardWith; i++) {
|
||||||
for (int j = 0; j < this.bordHeight; j++) {
|
for (int j = 0; j < this.boardHeight; j++) {
|
||||||
act = this.get(i,j);
|
act = this.get(i,j);
|
||||||
if (act.isPlayable()){
|
if (act.isPlayable()){
|
||||||
output.add(act);
|
output.add(act);
|
||||||
@@ -65,4 +72,11 @@ public class GomokuBoard {
|
|||||||
return output;
|
return output;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------Overides--------------------------
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,10 +110,12 @@ public class GomokuCell{
|
|||||||
switch (this.getSate()) {
|
switch (this.getSate()) {
|
||||||
case Color.NIL:
|
case Color.NIL:
|
||||||
return " ";
|
return " ";
|
||||||
|
case Color.BLACK:
|
||||||
|
return "X";
|
||||||
|
case Color.WHITE:
|
||||||
|
return "0";
|
||||||
default:
|
default:
|
||||||
break;
|
return "BUG";
|
||||||
}
|
}
|
||||||
return this.state.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user