Exemplo n.º 1
0
 public Game(Board board, ComputerLogic computerLogic, WinConditions winConditions, UI ui)
 {
     this.board         = board;
     this.computerLogic = computerLogic;
     this.winConditions = winConditions;
     this.ui            = ui;
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Board         board         = new Board();
            WinConditions winConditions = new WinConditions();
            ComputerLogic computerLogic = new ComputerLogic(winConditions);
            BoardBuilder  boardBuilder  = new BoardBuilder();
            IO            io            = new IO();
            ValidateInput validateInput = new ValidateInput();
            UI            ui            = new UI(boardBuilder, io, validateInput);
            Game          game          = new Game(board, computerLogic, winConditions, ui);

            game.StartGame();
        }
        public bool DidPlayerWin(string playerPiece)
        {
            bool didTheyWin = false;

            WinConditions.ForEach(setOfWinConditions =>
            {
                if (Board.BoardPieces[setOfWinConditions[0]] == playerPiece &&
                    Board.BoardPieces[setOfWinConditions[1]] == playerPiece &&
                    Board.BoardPieces[setOfWinConditions[2]] == playerPiece)
                {
                    didTheyWin = true;
                }
            });

            return(didTheyWin);
        }
Exemplo n.º 4
0
 public ComputerLogic(WinConditions winConditions)
 {
     this.winConditions = winConditions;
 }
Exemplo n.º 5
0
 public Board(int numberOfColumns, int numberOfRows)
 {
     ValidateParameters(numberOfColumns, numberOfRows);
     _cells         = new string[numberOfRows, numberOfColumns];
     _winConditions = new WinConditions();
 }