getCell but no exeption
This commit is contained in:
@@ -3,4 +3,25 @@ public class GomokuBoard {
|
||||
private GomokuCell firstCell;
|
||||
private int boardWith;
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user