Ejemplo n.º 1
0
        public void GameRef_GameOverEvent(MazeGameFinalOutcome final)
        {
            System.Diagnostics.Debug.WriteLine($"Randomness left: {rlmNet.RandomnessCurrentValue}");

            //End AI Training Cycle
            rlmNet.SessionEnd(final.FinalScore);
        }
Ejemplo n.º 2
0
        private void GameLoop()
        {
            int i = 0;
            //Cycle
            MazeCycleOutcome LastOutcome = new MazeCycleOutcome();

            while (LastOutcome.GameOver == false)
            {
                if (CancelGame)
                {
                    return;
                }

                Int16 dir = -1;
                if (DirectionsStack.TryDequeue(out dir))
                {
                    //incriment the count
                    i++;
                    //Run the maze cycle
                    LastOutcome = CycleMaze(dir);

                    //GameCycledEvent
                    if (GameCycleEvent != null)
                    {
                        GameCycleEvent(LastOutcome, traveler);
                    }

                    //Check for Game Over
                    if (LastOutcome.GameOver)
                    {
                        //Build Final Game
                        MazeGameFinalOutcome FinalOutcome = new MazeGameFinalOutcome();
                        FinalOutcome.CycleCount = i;
                        FinalOutcome.FinalScore = CalculateFinalScore(i);

                        //Event
                        if (GameOverEvent != null)
                        {
                            GameOverEvent(FinalOutcome);
                        }
                    }
                }
                else
                {
                    System.Threading.Thread.Sleep(10);
                }
            }
        }