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