IA niveau 3

This commit is contained in:
Cyprien111
2025-05-08 17:28:37 +02:00
parent ef7787fe7c
commit 6996b6548d
2 changed files with 5 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.HashMap;
public class GomokuAI extends Player {
@@ -56,6 +56,7 @@ public class GomokuAI extends Player {
}
}
break;
case 2:
Map<GomokuCell, Integer> map2 = GetCellPoint(board, this.color);
Color other = null;
@@ -76,9 +77,10 @@ public class GomokuAI extends Player {
}
for (Map.Entry<GomokuCell, Integer> entry : map3.entrySet()) {
if (entry.getValue() > max3) {
if (entry.getValue() > max3 && max2 < entry.getValue()) {
max3 = entry.getValue();
playCell = entry.getKey();
System.out.println("ia a fait un coup pour elle");
}
}
@@ -99,7 +101,7 @@ public class GomokuAI extends Player {
* @return the Map of all Cell playable, and their point.
*/
public Map<GomokuCell, Integer> GetCellPoint(GomokuBoard board, Color color) {
// Prout
List<GomokuCell> playableCell = board.getPlayableCells();
Map<GomokuCell, Integer> map = new HashMap<>();

View File

@@ -5,7 +5,6 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Random;
import java.util.Random;
public class GomokuGame {