Esempio n. 1
0
        public void LotRowSuccess()
        {
            var maxLineLength = 10;
            var randomData    = new RandomData();

            var rowsCount = 1000000;
            var mcss      = new MovesConfigs();

            parser.Source = new string[rowsCount];
            for (int i = 0; i < rowsCount; i++)
            {
                var mcs = new MovesConfig();
                mcs.AddRange(randomData.GetMoves(maxLineLength));
                mcss.Add(mcs);

                var msSource = string.Join(" ", mcs);
                parser.Source[i] = msSource;
            }

            var mc = parser.ParseConfig();

            Assert.IsTrue(mc.Count == rowsCount);

            for (int i = 0; i < rowsCount; i++)
            {
                for (int j = 0; j < mc[i].Count; j++)
                {
                    Assert.AreEqual(mc[i][j], mcss[i][j]);
                }
            }
        }
        private MovesConfig ParseMovesLine(string line)
        {
            var values = line.Split(' ');

            var mc = new MovesConfig();

            for (int i = 0; i < values.Length; i++)
            {
                var m = ParserHelper.TryParseMove(values[i]);
                mc.Add(m);
            }
            return(mc);
        }
Esempio n. 3
0
        public void Initialize(TableConfig tableConfig, MovesConfig movesConfig, int?id = null)
        {
            if (id.HasValue)
            {
                ID = id.Value;
            }

            StateConfiguration = new StateConfiguration();

            StateConfiguration.ActualMove  = 0;
            StateConfiguration.Moves       = movesConfig.ToArray();
            StateConfiguration.TableConfig = tableConfig;
            StateConfiguration.Position    = tableConfig.StartPosition;

            StateConfiguration.Validate();

            TurtleState = StateHelper.GetState(StateConfiguration.Position, StateConfiguration.TableConfig.Mines, StateConfiguration.TableConfig.Exit);

            _logger.BusinessSuccess(BL.EVENT_PLAYINIT_ID, BL.EVENT_PLAYINIT_NAME, new { Id = ID });
        }