All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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];
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy