Пример #1
0
 public static void CleanScoreCard(Maze _maze)
 {
     string _input;
     if (PillCountToScore(_maze) == Properties.Settings.Default._MazeTotalPillCount - 1)
         _input = "0,1,0";
     else
         _input = "0,0,0";
     using (var file = new System.IO.StreamWriter(_pathToScoreCard, false))
     {
         file.Write(_input);
         file.Close();
     }
     _maze.WriteMaze(_pathToGameState);
 }
Пример #2
0
        static void Main(string[] args)
        {
            var maze = new Maze(args[0]);

            if (IsTheGameStart(maze))
            {
                PoisonBucket.FillUpPoisonBucket();
                ScoreKeeper.CleanScoreCard(maze);
            }

            Bot _Bot = new Bot { _maze = maze };

            maze = _Bot.MakeMove();

            maze.WriteMaze(Properties.Settings.Default._OUTPUT_FILE_NAME);
        }
Пример #3
0
        public static void UpdateScore(Maze _maze, bool PlayerA)
        {
            var _previousMaze = new Maze(_pathToGameState);
            var _previousPillCountToScore = PillCountToScore(_previousMaze);

            var _currentMaze = new Maze(_maze);
            var _currentPillCountToScore = PillCountToScore(_currentMaze);

            var _playerAScore = GetPlayerAScore();
            var _playerBScore = GetPlayerBScore();
            var _TurnsWithNoPointScored = GetTurnsWithNoPointScored();

            if (_currentPillCountToScore == _previousPillCountToScore)
            {
                if (_currentPillCountToScore != Properties.Settings.Default._MazeTotalPillCount
                && _currentPillCountToScore != Properties.Settings.Default._MazeTotalPillCount - 1)
                {
                    _TurnsWithNoPointScored++;
                    string _input = _playerAScore.ToString() + "," + _playerBScore.ToString() + "," + _TurnsWithNoPointScored.ToString();
                    using (var file = new System.IO.StreamWriter(_pathToScoreCard, false))
                    {
                        file.Write(_input);
                        file.Close();
                    }
                }
            }
            else
            {
                _TurnsWithNoPointScored = 0;
                if (PlayerA)
                {
                    _playerAScore = (_currentPillCountToScore == _previousPillCountToScore - 1) ? _playerAScore += 1 : _playerAScore += 10;
                }
                else
                {
                    _playerBScore = (_currentPillCountToScore == _previousPillCountToScore - 1) ? _playerBScore += 1 : _playerBScore += 10;
                }

                string _input = _playerAScore.ToString() + "," + _playerBScore.ToString() + "," + _TurnsWithNoPointScored.ToString();
                using (var file = new System.IO.StreamWriter(_pathToScoreCard, false))
                {
                    file.Write(_input);
                    file.Close();
                }
                _currentMaze.WriteMaze(_pathToGameState);
            }
        }