コード例 #1
0
        public void Setup()
        {
            _console   = new ConsoleMock();
            _gameProps = new GameProps {
                Width = 15, Height = 15, MyId = 0
            };

            _console.Record(".............xx");
            _console.Record(".............xx");
            _console.Record("......xx.......");
            _console.Record("......xx.......");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");
            _console.Record("...............");

            _mapScanner = new MapScanner(_gameProps, _console);
            _sut        = new HeadPositionReducer(_gameProps, _mapScanner);
        }
コード例 #2
0
            public void Setup()
            {
                _console   = new ConsoleMock();
                _gameProps = new GameProps {
                    Width = 15, Height = 4, MyId = 0
                };

                _console.Record(".............xx");
                _console.Record(".............xx");
                _console.Record("......xx.......");
                _console.Record("......xx.......");
                var mapScanner = new MapScanner(_gameProps, _console);

                _headPositionReducer = new HeadPositionReducer(_gameProps, mapScanner);
                _sut = new EnemyTracker(_gameProps, mapScanner.GetMapOrScan(), _console, _headPositionReducer);
                _defaultEnemyLife = 6;
            }
コード例 #3
0
ファイル: GameAnalysis.cs プロジェクト: payman81/OceanOfCode
        public void Setup()
        {
            _console   = new ConsoleMock();
            _gameProps = new GameProps {
                Width = 15, Height = 15, MyId = 0
            };

            var mapData = new short[]
            { 0, 3867, 3867, 7680, 7168, 7168, 30720, 30720, 28672, 25008, 25008, 1, 1, 24576, 24576, };
            BinaryTrack binaryMap = BinaryTrack.FromDebug(_gameProps, mapData, null);

            var         currentData  = new short[] { 16384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
            BinaryTrack currentTrack = BinaryTrack.FromDebug(_gameProps, currentData, (0, 0));

            var filterData = new short[]
            { 32767, 32767, 32767, 32767, 32767, 31775, 31775, 31775, 31775, 32191, 32767, 32767, 32767, 32767, 32767, };
            BinaryTrack filterTrack         = BinaryTrack.FromDebug(_gameProps, filterData, null);
            var         headPositionReducer = new HeadPositionReducer(_gameProps, binaryMap.ToCartesian(), filterTrack);

            _sut = EnemyTracker.FromDebug(_gameProps, binaryMap, currentTrack, null, _console, headPositionReducer, Direction.South);

            var moveProps = new MoveProps {
                OpponentOrders = "SILENCE|SURFACE 5", OpponentLife = 5, MyPosition = (2, 11), TorpedoCooldown = 0, MineCooldown = 3, SilenceCooldown = 5
            };

            _sut.Next(moveProps);



            var nextMoveProps = new MoveProps {
                OpponentOrders = "MOVE S", OpponentLife = 5, MyPosition = (2, 11), TorpedoCooldown = 0, SilenceCooldown = 2, MineCooldown = 1
            };

            _sut.Next(nextMoveProps);
        }
    }
}
コード例 #4
0
        public GameController(IConsole console)
        {
            _console = console;
            string[] inputs;
            inputs     = _console.ReadLine().Split(' ');
            _gameProps = new GameProps
            {
                Width  = int.Parse(inputs[0]),
                Height = int.Parse(inputs[1]),
                MyId   = int.Parse(inputs[2])
            };
            _console.Debug(_gameProps);
            _mapScanner = new MapScanner(_gameProps, _console);
            _navigator  = new PreComputedSpiralNavigator(_mapScanner, _console, reversedModeOn: true, _gameProps);
            var headPositionReducer = new HeadPositionReducer(_gameProps, _mapScanner);

            _enemyTracker = new EnemyTracker(_gameProps, _mapScanner.GetMapOrScan(), console, headPositionReducer);
            var torpedoController = new AttackController(_gameProps, _enemyTracker, _mapScanner, _console, headPositionReducer, _navigator);

            var chargeController = new ChargeController(_enemyTracker);

            _submarine = new Submarine(_navigator, _enemyTracker, _console, torpedoController, chargeController);
            _submarine.Start();
        }