com.brettonw.game.Player Maven / Gradle / Ivy
The newest version!
package com.brettonw.game;
public class Player {
// player 0 is reserved for empty...
public static final int EMPTY = 0;
public static final int X = 1;
public static final int O = 2;
private static final int MASK = X | O;
private static final char[] display = { '-', 'X', 'O' };
public static int next (int currentPlayer) {
return currentPlayer ^ MASK;
}
public static char display (int player) {
return display[player];
}
}