AI improvements
This commit is contained in:
parent
33c16320a9
commit
bee8baec1d
|
@ -33,7 +33,6 @@ public class MalteAI implements Player{
|
||||||
}
|
}
|
||||||
Set<Integer> winningOptions = getRowCompletionOptions(options, board, id);
|
Set<Integer> winningOptions = getRowCompletionOptions(options, board, id);
|
||||||
for (Integer i: winningOptions) {
|
for (Integer i: winningOptions) {
|
||||||
System.out.println("WINNING");
|
|
||||||
return i.intValue();
|
return i.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,12 +40,10 @@ public class MalteAI implements Player{
|
||||||
for (Integer i: preventionsOptions) {
|
for (Integer i: preventionsOptions) {
|
||||||
int[][] fakeBoard = makeMove(copyBoard(board), i, id);
|
int[][] fakeBoard = makeMove(copyBoard(board), i, id);
|
||||||
if (getRowCompletionOptions(options, fakeBoard, enemyID).size() == 0) {
|
if (getRowCompletionOptions(options, fakeBoard, enemyID).size() == 0) {
|
||||||
System.out.println("PREVENTING");
|
|
||||||
return i.intValue();
|
return i.intValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("RANDOM");
|
|
||||||
return takeRandom(options).intValue();
|
return takeRandom(options).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,9 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import game.Game;
|
import game.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Connect Four Pattern.
|
||||||
|
*/
|
||||||
public class Pattern {
|
public class Pattern {
|
||||||
|
|
||||||
private Set<Item> parts;
|
private Set<Item> parts;
|
||||||
|
|
Loading…
Reference in a new issue