Skip to content

Instantly share code, notes, and snippets.

@Hydrotoast
Created December 9, 2012 07:34
Show Gist options
  • Save Hydrotoast/4243800 to your computer and use it in GitHub Desktop.
Save Hydrotoast/4243800 to your computer and use it in GitHub Desktop.
Anticipated Game Loop
CppCKPlayer player = new CppCKPlayer(dllNameStr, playerInt, BoardModel model);
while (!game.isEnd()) {
// Opponent makes a move
Cell cell;
cell.row = opponentMove.row;
cell.col = opponentMove.col;
Mark m = (opponentMove.mark == 'X') ? Mark.A : Mark.B;
player.updateBoard(cell, mark);
Cell c = player.getMove();
// Update game/model with c
}
player.dispose(); // IMPORTANT TO PREVENT MEMORY LEAKS!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment