Example #1
0
 /// <summary>
 /// Synchronizes the Moves and MoveStack lists if the specified move
 /// is not already in both lists.
 /// </summary>
 /// <param name="move">The move to check.</param>
 private void SyncMoveStack(ISpace move)
 {
     // If the move diverges from the move stack, synchronize
     // the Moves and MoveStack lists.
     if (Moves.Count > MoveStack.Count)
     {
         // The move goes beyond the MoveStack, so add
         // the move to the MoveStack.
         MoveStack.Add(move);
     }
     else
     {
         var stackMove = MoveStack[Moves.Count - 1];
         if ((stackMove == null && stackMove != move) ||
             (stackMove != null && !stackMove.Equals(move)))
         {
             // The move is different from same position in
             // the MoveStack, so reset the MoveStack to match
             // the Moves list.
             MoveStack = new List <ISpace>(Moves);
         }
     }
 }