Пример #1
0
        private void NewGame(Int32 gamesize, Int32 gamespeed)
        {
            if (gamesize < 0) throw new Exception("Game size can not be negative number!");
            if (gamesize % 2 != 1) throw new Exception("Game size can not odd number!");

            _table = new RobotGameTable(gamesize);
            _direction = RandomDirection();
            _wallsCount = 0;
            _gameTime = 0;
            _robotStepEveryXSec = gamespeed;

            Debug.WriteLine("Game generated. Size: " + _gameSize);
            for (int i = 0; i < _table.Size; i++)
            {
                for (int j = 0; j < _table.Size; j++)
                {
                    switch (_table.GetValue(i, j))
                    {
                        case FieldType.Wall: Debug.Write("[X]" + " "); break;
                        case FieldType.DestroyedWall: Debug.Write("[x]" + " "); break;
                        case FieldType.Robot: Debug.Write("[R]" + " "); break;
                        case FieldType.RobotOnWall: Debug.Write("[r]" + " "); break;
                        case FieldType.Finish: Debug.Write("[O]" + " "); break;
                        case FieldType.Empty: Debug.Write("[ ]" + " "); break;
                    }

                }
                Debug.Write("\n");
            }
        }
 public RobotGameStepEventArgs(RobotGameTable currentTable)
 {
     _currentTable = currentTable;
 }