debut d'une ia par point

This commit is contained in:
Cyprien111
2025-03-31 11:01:12 +02:00
parent 4d1481d634
commit 12d4b2014a
4 changed files with 76 additions and 13 deletions

View File

@@ -75,12 +75,12 @@ 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.
*/
/**
* 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<>();
@@ -94,6 +94,23 @@ public class GomokuBoard{
return map;
}
/**
* This method return the number max of the aligned Cells.
* @param mapColor A map of number aligned cells.
* @return int, the number max of the aligned Cells.
*/
public int countMax(Map<Cardinal, Integer> mapColor){
Map<Cardinal, Integer> map = new HashMap<>();
int max = 0;
for (Map.Entry<Cardinal, Integer> entry : map.entrySet()) {
if(entry.getValue() > max){
max = entry.getValue();
}
}
return max;
}
//------------------Overides--------------------------
@Override