get la somme des gomoku cell aligned
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GomokuBoard {
|
||||
|
||||
public class GomokuBoard{
|
||||
/** The firstcell in the board, at the top left of the board. */
|
||||
private GomokuCell firstCell;
|
||||
/** The width of the GomokuBoard.*/
|
||||
@@ -72,6 +75,24 @@ public class GomokuBoard {
|
||||
return output;
|
||||
|
||||
}
|
||||
//-------------------Methods-------------------------
|
||||
/**
|
||||
* This method return a Map of number aligned cells.
|
||||
* @param cell A cell.
|
||||
* @return Map of number aligned cells.
|
||||
*/
|
||||
public Map<Cardinal, Integer> countAlignedCells(GomokuCell cell){
|
||||
|
||||
Map<Cardinal, Integer> map = new HashMap<>();
|
||||
Map<Cardinal, Integer> mapColor = cell.getSameColorNeighbour();
|
||||
|
||||
map.put(Cardinal.N, mapColor.get(Cardinal.N)+mapColor.get(Cardinal.S)+1);
|
||||
map.put(Cardinal.W,mapColor.get(Cardinal.W)+mapColor.get(Cardinal.E)+1);
|
||||
map.put(Cardinal.NW, mapColor.get(Cardinal.NW)+mapColor.get(Cardinal.SE)+1);
|
||||
map.put(Cardinal.SW, mapColor.get(Cardinal.SW)+mapColor.get(Cardinal.NE)+1);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
//------------------Overides--------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user