public override int GetHashCode() { unchecked { var hashCode = UnderlyingBoard.GetHashCode(); hashCode = (hashCode * 397) ^ NumMovesLeft; hashCode = (hashCode * 397) ^ CurrentPlayer.GetHashCode(); return(hashCode); } }
/// <summary> /// Moves a piece from src to dst. Returns the updated state. /// </summary> /// <param name="src">Original position</param> /// <param name="dst">New position</param> /// <returns>The updated state</returns> public GameState MovePiece(Position2D src, Position2D dst) { return(GetNextStateWithBoard(UnderlyingBoard.MovePiece(src, dst))); }
private bool Equals(GameState other) { return(UnderlyingBoard.Equals(other.UnderlyingBoard) && NumMovesLeft == other.NumMovesLeft && CurrentPlayer.Equals(other.CurrentPlayer)); }
public string FullDescription() { return($"{this} {{\n{UnderlyingBoard.ToString().PadLeft(4)}\n}}"); }