Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Battleships!");
            Console.WriteLine("=======================");
            Console.WriteLine();
            Console.WriteLine("Press any key to get started...");
            Console.ReadKey();

            var battleshipGame = new StandardBattleshipGameBuilder()
                                 .WithShip(ShipType.Battleship)
                                 .WithShip(ShipType.Destroyer)
                                 .WithShip(ShipType.Destroyer)
                                 .Build();

            var consoleWrapper            = new ConsoleWrapper();
            var gameDrawer                = new GameDrawer(consoleWrapper);
            var arrowInputPositionReader  = new ArrowInputPositionReader(gameDrawer, battleshipGame, consoleWrapper);
            var manualInputPositionReader = new ManualInputPositionReader(consoleWrapper);
            var consolePlayer             = new ConsolePlayer(consoleWrapper, gameDrawer, arrowInputPositionReader);

            consolePlayer.Play(battleshipGame);


            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
 public ConsolePlayer(IConsole console, GameDrawer gameDrawer, IPositionReader positionReader)
 {
     _console        = console;
     _gameDrawer     = gameDrawer;
     _positionReader = positionReader;
 }