Пример #1
0
        public static void StartGame()
        {
            var player = SqlController.GetPlayer();
            var board  = new Board(player.Result);

            board.CreateBoard();
            SqlController.BoardUpdate(board).Wait();
            SqlController.NextTurn(board).Wait();
            while (true)
            {
                if (Conditions.GameEnd(board))
                {
                    return;
                }
                var currentPlayer = SqlController.GetPlayer();
                if (currentPlayer.Result == board.CurrentPlayer)
                {
                    break;
                }
                BoardView.WaitForNewPlayer(board);
            }
            Console.Clear();
            SqlController.BoardUpdate(board).Wait();
            if (!Conditions.GameEnd(board))
            {
                PlayerTurn(board);
            }
        }
Пример #2
0
 private static void OpponentTurn(Board board)
 {
     while (true)
     {
         if (Conditions.GameEnd(board))
         {
             return;
         }
         var currentPlayer = SqlController.GetPlayer();
         if (currentPlayer.Result == board.CurrentPlayer)
         {
             break;
         }
         BoardView.WaitingForMove(board);
     }
     if (!Conditions.GameEnd(board))
     {
         PlayerTurn(board);
     }
 }