예제 #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
파일: Game.cs 프로젝트: lukegeor/netwalk
 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;
 }