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

com.fathzer.games.Status Maven / Gradle / Ivy

The newest version!
package com.fathzer.games;

/** The status of a game (playing, draw, white or black won).
 */
public enum Status {
	/** The game is still playing */
	PLAYING, 
	/** The game ends with a draw */
	DRAW, 
	/** The white player has won */
	WHITE_WON, 
	/** The black player has won */
	BLACK_WON;
	
	/** Gets the winner's color.
	 * @return A color or null if there's no winner
	 */
	public Color winner() {
		if (WHITE_WON==this) {
			return Color.WHITE;
		} else if (BLACK_WON==this) {
			return Color.BLACK;
		} else {
			return null;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy