getAll start

This commit is contained in:
Aubin DORIVAL
2025-03-31 08:46:04 +02:00
parent b32e9146b7
commit b81ff254ba
2 changed files with 22 additions and 6 deletions

View File

@@ -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 "";
}
}

View File

@@ -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 this.state.toString();
return "BUG";
}
}
}