package cs3500.connectn.model; /** * A player in the game, White or Red. Player objects are used both to * represent the players themselves, as in reporting the winner, and to * represent the players' tokens in the game grid. */ public enum Player { White('W') { @Override public Player other() { return Red; } }, Red('R') { @Override public Player other() { return White; } }; /** * Returns a single-character representation of this player suitable for * printing. * * @return {@code 'R'} or {@code 'W'} */ public char asChar() { return asChar; } private final char asChar; /** * Returns the other player. * * @return the other player */ public abstract Player other(); Player(char c) { asChar = c; } }