Ejemplo n.º 1
0
 public void ShowTurn(Player[] players, string currentPlayerName, char[] cells)
 {
     Console.Clear();
     Console.WriteLine($"{players[0].Name}:{players[0].Token} and {players[1].Name}:{players[1].Token}\n");
     Console.WriteLine($"{currentPlayerName} chance\n");
     ShowBoard(cells);
 }
Ejemplo n.º 2
0
        public void Start()
        {
            m_CurrentPlayer = m_Players[0];

            while (true)
            {
                m_UI.ShowTurn(m_Players, m_CurrentPlayer.Name, m_Cells);

                if (!Turn())
                {
                    m_UI.ShowInvalidChoice();
                    continue;
                }

                if (PlayerWins(m_CurrentPlayer.Token))
                {
                    m_UI.ShowWin(m_CurrentPlayer.Name, m_Cells);
                    break;
                }

                if (IsDraw()) break;

                NextPlayer();
            }

            m_UI.ShowEnd();
        }
Ejemplo n.º 3
0
 public void ShowTurn(Player[] players, string currentPlayerName, char[] cells)
 {
 }
Ejemplo n.º 4
0
 public TicTacToeGame(IUserInterface ui, char[] cells, Player[] player)
 {
     m_UI = ui;
     m_Cells = cells;
     m_Players = player;
 }
Ejemplo n.º 5
0
 private void NextPlayer()
 {
     if (m_CurrentPlayer == m_Players[0]) m_CurrentPlayer = m_Players[1];
     else m_CurrentPlayer = m_Players[0];
 }