Strip output, fixing all AI problemes
This commit is contained in:
parent
318792c9b0
commit
b0ed66a786
|
@ -89,7 +89,6 @@ public class Game {
|
||||||
for (int i = 0; i < runs; i++) {
|
for (int i = 0; i < runs; i++) {
|
||||||
int result = new Game(p1, p2).start(false, true);
|
int result = new Game(p1, p2).start(false, true);
|
||||||
// TODO: Improve IDs
|
// TODO: Improve IDs
|
||||||
System.out.println(result);
|
|
||||||
statistic[result]++;
|
statistic[result]++;
|
||||||
}
|
}
|
||||||
double[] percents = new double[3];
|
double[] percents = new double[3];
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class MalteAI implements Player{
|
||||||
}
|
}
|
||||||
Set<Integer> winningOptions = getWinningOptions(options, board);
|
Set<Integer> winningOptions = getWinningOptions(options, board);
|
||||||
for (Integer i: winningOptions) {
|
for (Integer i: winningOptions) {
|
||||||
System.out.println(i);
|
|
||||||
return i.intValue();
|
return i.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,14 +62,14 @@ public class MalteAI implements Player{
|
||||||
new Item(0, 1, id),
|
new Item(0, 1, id),
|
||||||
new Item(0, 2, id),
|
new Item(0, 2, id),
|
||||||
new Item(0, 3, id)));
|
new Item(0, 3, id)));
|
||||||
// for (Pattern p: patterns) {
|
|
||||||
// System.out.println(p);
|
|
||||||
// }
|
|
||||||
Set<Pattern> matches = Pattern.matchingPatterns(patterns, board);
|
Set<Pattern> matches = Pattern.matchingPatterns(patterns, board);
|
||||||
Set<Integer> ret = new HashSet<>();
|
Set<Integer> ret = new HashSet<>();
|
||||||
for (Pattern p: matches) {
|
for (Pattern p: matches) {
|
||||||
|
Set<Position> positions = p.matches(board);
|
||||||
for (Item i: p.getZeros()) {
|
for (Item i: p.getZeros()) {
|
||||||
ret.add(new Integer(i.getPosX()));
|
for(Position pos: positions) {
|
||||||
|
ret.add(new Integer(i.getPosX() + pos.getPosX()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue