Example #1
0
 public void StartGame()
 {
     curPlayerIndex = 0;
     CurPlayer      = Players[curPlayerIndex];
     PieceController.UpdateMoves(CurPlayer);
     CurPlayer.TakeTurn();
 }
Example #2
0
        public void Update()
        {
            Move move = CurPlayer.GetMove(GetValidMoves());

            if (IsValidMove(move))
            {
                MakeMove(move);
                UpdateView();
                CurPlayer = NextPlayer();

                if (CheckWin())
                {
                    CurPlayer = NextPlayer();
                    MessageBox.Show("Player:" + CurPlayer.PiecesColor + " wins!");
                    ResetGame();
                }
                else
                {
                    PieceController.UpdateMoves(CurPlayer);
                    CurPlayer.TakeTurn();
                }
            }
            else
            {
                MessageBox.Show("Invalid move!");
                ViewController.ClearSquares();
            }
        }