Beispiel #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = UnderlyingBoard.GetHashCode();
         hashCode = (hashCode * 397) ^ NumMovesLeft;
         hashCode = (hashCode * 397) ^ CurrentPlayer.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #2
0
 /// <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)));
 }
Beispiel #3
0
 private bool Equals(GameState other)
 {
     return(UnderlyingBoard.Equals(other.UnderlyingBoard) &&
            NumMovesLeft == other.NumMovesLeft &&
            CurrentPlayer.Equals(other.CurrentPlayer));
 }
Beispiel #4
0
 public string FullDescription()
 {
     return($"{this} {{\n{UnderlyingBoard.ToString().PadLeft(4)}\n}}");
 }