Beispiel #1
0
        private void ShowPlay(FitnessCalculatorRecording recorder)
        {
            List <FitnessRoundInfo> fitnessRoundInfoList = recorder.FitnessRoundInfoList;

            int  score   = recorder.InitialFitnessRoundInfo.Score;
            bool isAlive = recorder.InitialFitnessRoundInfo.IsAlive;

            UpdateCurrentGridInitial(recorder.InitialFitnessRoundInfo.ChangedFields);

            SnakeGameGUI snakeGameGUI = new SnakeGameGUI(snakeSettings, currentGrid, score, isAlive);

            // START GUI
            snakeGameGUI.OpenGameWindow();

            // Loop throug frames.
            for (int i = 0; i < fitnessRoundInfoList.Count; i++)
            {
                UpdateCurrentGrid(fitnessRoundInfoList[i].ChangedFields);
                snakeGameGUI.UpdateView(currentGrid, fitnessRoundInfoList[i].Score, fitnessRoundInfoList[i].IsAlive, fitnessRoundInfoList[i].SnakeHeadPoint);
                Thread.Sleep(speedMS);
            }
        }
Beispiel #2
0
        private void ShowPlay(PlaytestRecording recording, int speedMS)
        {
            List <PlaytestRoundInfo> fitnessRoundInfoList = recording.PlaytestRoundInfoList;


            int  score   = recording.InitialPlaytestRoundInfo.Score;
            bool isAlive = recording.InitialPlaytestRoundInfo.IsAlive;

            UpdateCurrentGridInitial(recording.InitialPlaytestRoundInfo.ChangedFields);

            SnakeGameGUI snakeGameGUI = new SnakeGameGUI(snakeSettings, currentGrid, score, isAlive);
            int          snakeSpeedMS = speedMS;

            // START GUI
            snakeGameGUI.OpenGameWindow();

            // Loop throug frames.
            for (int i = 0; i < fitnessRoundInfoList.Count && snakeGameGUI.WindowRunning; i++)
            {
                UpdateCurrentGrid(fitnessRoundInfoList[i].ChangedFields);
                snakeGameGUI.UpdateView(currentGrid, fitnessRoundInfoList[i].Score, fitnessRoundInfoList[i].IsAlive, fitnessRoundInfoList[i].SnakeHeadPoint);
                Thread.Sleep(snakeSpeedMS);
            }
        }