Exemplo n.º 1
0
        public void Run()
        {
            var game = GameBuilder
                       .Initialize(_startingPlayerMapper, _players, _boardService)
                       .WithBoardSize(3)
                       .FirstPlayerSet(PlayerType.As().Human("Player", "X"))
                       .SecondPlayerSet(PlayerType.As().Computer("Computer", "O"))
                       .Set(StartingPlayer.As().FirstPlayer())
                       .Build();

            do
            {
                game.Accept(new DisplayBoardVisitor());
                game.Start();
                game.Play();
                game.CheckForWin();
                game.SwitchPlayer();
                game.Over();
                game.PlayAgain();
                game.End();
            } while (game.StillGoing);
        }
 private static PlayerType BuildPlayerTypeAsComputer(string name = null, string symbol = null)
 {
     name   = name ?? "Computer Name";
     symbol = symbol ?? "Computer Symbol";
     return(PlayerType.As().Computer(name, symbol));
 }
 private static PlayerType BuildPlayerTypeAsHuman(string name = null, string symbol = null)
 {
     name   = name ?? "Human Name";
     symbol = symbol ?? "Human Symbol";
     return(PlayerType.As().Human(name, symbol));
 }