getCell but no exeption

This commit is contained in:
Aubin DORIVAL
2025-03-24 11:02:16 +01:00
parent ee3ccb6201
commit e688bd2400

View File

@@ -3,4 +3,25 @@ public class GomokuBoard {
private GomokuCell firstCell; private GomokuCell firstCell;
private int boardWith; private int boardWith;
private int bordHeight; private int bordHeight;
public GomokuBoard(int width, int height){
this.firstCell = new GomokuCell(Color.NIL);
this.boardWith = width;
this.bordHeight = height;
}
public GomokuCell get(int x, int y){
int i = 0, j = 0;
GomokuCell act = this.firstCell;
while (i != x && j != y){
Cardinal c = Cardinal.SE;
if (i < x) i++;
else c = Cardinal.E;
if (j < y) j++;
else c = Cardinal.S;
act = act.getNeighbour(c);
}
return act;
}
} }