Пример #1
0
 public void Setup()
 {
     _shipFactory    = new ShipFactory();
     _board          = new Board(10, 10);
     _game           = new Game(_board);
     _boardGenerator = new RandomBoardGenerator(_board);
 }
Пример #2
0
        public static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            var consoleManager = new ConsoleManager();

            var fontStyle = "MS Gothic";

            consoleManager.SetFont(fontStyle);

            if (!Validator.IsArgumentsValid(args))
            {
                throw new FormatException("Arguments must be in format <widthBoard> <heightBoard");
            }

            var parser = new BoardParser();
            var board  = parser.Parse(args);

            var boardGenerators = new IBoardGenerator[]
            {
                new ChessBoardGenerator(),
                new EmptyBoardGenerator()
            };

            var boardGenerator = boardGenerators
                                 .FirstOrDefault(b => b.CanGenerate(board.Width, board.Height));

            var drawableBoard = boardGenerator.Generate(board.Width, board.Height);

            var chessBoard = new ConsoleBoard(consoleManager);

            chessBoard.Draw(drawableBoard);
        }
Пример #3
0
 public SimulatorDouble(
     IStateFactory stateFactory, IEvaluator evaluator, IBoardGenerator generator)
 {
     this.stateFactory = stateFactory;
     this.evaluator    = evaluator;
     this.generator    = generator;
 }
Пример #4
0
 public Game(
     IBoardGenerator boardGenerator,
     IFleetCommander fleetCommander,
     ICommentator commentator)
 {
     _boardGenerator = boardGenerator;
     _fleetCommander = fleetCommander;
     _commentator    = commentator;
 }
Пример #5
0
 public BattleshipController(
     IBoardGenerator boardGenerator,
     IShipsGenerator shipsGenerator,
     IBoardCache boardCache,
     IFieldToPointConverter fieldToPointConverter)
 {
     this.boardGenerator        = boardGenerator;
     this.shipsGenerator        = shipsGenerator;
     this.boardCache            = boardCache;
     this.fieldToPointConverter = fieldToPointConverter;
 }
Пример #6
0
        public GameManager(
            IBoardPrinter boardPrinter,
            IBoardManager boardManager,
            IBoardGenerator boardGenerator,
            IActionParser actionParser,
            IScoreManager scoreManager,
            User.User user)
        {
            _boardPrinter   = boardPrinter;
            _boardManager   = boardManager;
            _boardGenerator = boardGenerator;
            _actionParser   = actionParser;
            _scoreManager   = scoreManager;
            _user           = user;

            _menuOptions = new StringBuilder()
                           .AppendLine("--------------------------")
                           .AppendLine("SELECT AN OPTION:")
                           .AppendLine("S X Y - Select a cell in the x,y position")
                           .AppendLine("F X Y - Flag a cell in the x,y position")
                           .AppendLine("E - Exit the game")
                           .AppendLine()
                           .ToString();
        }
Пример #7
0
 public GameEngine(int size, IBoardGenerator boardGenerator)
 {
     this.size = size;
     generator = boardGenerator;
     gameState = new ICell[2][, ];
 }
 public BoardController(BoardSingletonRepo boardRepository, IBoardUpdater boardUpdater, IBoardGenerator boardGenerator)
 {
     _boardRepository = boardRepository;
     _boardUpdater    = boardUpdater;
     _boardGenerator  = boardGenerator;
 }
Пример #9
0
 public void SetUp()
 {
     boardGenerator = new RandomBoardGenerator();
 }
Пример #10
0
 public Game(IBoardGenerator boardGenerator, GameConfig gameConfig)
 {
     _boardGenerator = boardGenerator;
     _gameConfig     = gameConfig;
     _won            = false;
 }
Пример #11
0
 public GameProcessor(IBoardGenerator boardGenerator, IUserInterface userInterface, GameState gameState)
 {
     GameState      = gameState;
     BoardGenerator = boardGenerator;
     UserInterface  = userInterface;
 }