Ejemplo n.º 1
0
    public InputState Clone()
    {
        InputState rtn = new InputState();

        rtn.FaderValue = FaderValue;
        rtn.FaderState = FaderState;
        rtn.CutinState = CutinState;
        rtn.Left       = Left.Clone();
        rtn.Right      = Right.Clone();
        return(rtn);
    }
 /// <summary>
 /// Plays a single turn on the given board
 /// </summary>
 /// <remarks>
 /// Does not change the given board.
 /// </remarks>
 /// <param name="board">The game board</param>
 /// <param name="newDisc">The point to place the new disc</param>
 /// <param name="currentPlayer">The color of the disc to place</param>
 /// <returns>A new board, with the given move played</returns>
 public static Disc[,] PlayTurn(Disc[,] board, Point newDisc, Disc currentPlayer)
 {
     if (!IsValidMove(board, newDisc, currentPlayer))
         throw new Exception("Invalid move");
     Disc[,] newBoard = (Disc[,])board.Clone();
     newBoard.SetAt(newDisc, currentPlayer);
     foreach (Point p in PointsToReverse(board, newDisc, currentPlayer))
         newBoard.ReverseAt(p);
     return newBoard;
 }