rust beats java lol

This commit is contained in:
nora 2023-01-15 15:39:21 +01:00
parent c235e4ec65
commit 9c749f1ae9
2 changed files with 3 additions and 2 deletions

View file

@ -17,7 +17,7 @@ public class Connect4ArenaMain {
static final int NOMOVE = -1; static final int NOMOVE = -1;
public static void main(String[] args) { public static void main(String[] args) {
new Connect4ArenaMain().play(new HumanPlayer(), new PerfectPlayer()); new Connect4ArenaMain().play(new RustPlayer(), new PerfectPlayer());
} }
static String toDebugString(Stone[] board) { static String toDebugString(Stone[] board) {

View file

@ -70,7 +70,8 @@ public class PerfectPlayer extends Connect4ArenaMain.DefaultPlayer {
@Override @Override
protected int play() { protected int play() {
bestMove = -1; bestMove = -1;
minmax(myColor, LOST, WON, 0); // LOST -1 so that at least one move is better and gets selected even when everything is lost
minmax(myColor, LOST - 1, WON, 0);
return this.bestMove; return this.bestMove;
} }
} }