private void GameRef_GameStartEvent(Traveler traveler, int currentIteration = 1)
        {
            // inputs
            double[] inputs = new[]
            {
                Convert.ToDouble(traveler.location.X),
                Convert.ToDouble(traveler.location.Y),
                Convert.ToDouble(false)
            };

            Int16 direction = this.Traveler.Play(inputs);

            gameRef.DirectionsStack.Enqueue(direction);
        }
Example #2
0
        private double ScoreAI(MazeCycleOutcome mazeCycle, Traveler traveler)
        {
            double retVal = WRONG_SCORE;

            if (mazeCycle.GameOver)
            {
                retVal = CORRECT_SCORE * 2;
            }
            else if (!mazeCycle.BumpedIntoWall)
            {
                retVal = CORRECT_SCORE;
            }

            return(retVal);
        }
        private void GameRef_GameCycleEvent(MazeCycleOutcome cycle, Traveler traveler)
        {
            // inputs
            double[] inputs = new[]
            {
                Convert.ToDouble(traveler.location.X),
                Convert.ToDouble(traveler.location.Y),
                Convert.ToDouble(cycle.BumpedIntoWall)
            };

            Int16 direction = this.Traveler.Play(inputs);

            //tmp delay since encog going too fast
            System.Threading.Thread.Sleep(10);

            gameRef.DirectionsStack.Enqueue(direction);
        }
Example #4
0
        public void StartGame(EncogMaze encogMaze)
        {
            // set traveler
            traveler = encogMaze.Traveler;

            // Initial Location
            traveler.location.X = OldLocation.X;
            traveler.location.Y = OldLocation.Y;

            // Fire GameStart Event
            if (GameStartEvent != null)
            {
                GameStartEvent(traveler);
            }

            Thread GameLoopThread = new Thread(() => { this.GameLoop(); });

            GameLoopThread.Start();
        }
Example #5
0
 public MazeGame()
 {
     traveler = new Traveler();
 }