Beispiel #1
0
        public void UseBinaryBrainToMove(List <Apple> apples, object locker)
        {
            List <bool> inputs = Sensors.FindBinaryAppleIn4Directions(apples, CurrentSnakeBlocks[0]);
            var         moves  = DecodeMove(Brain.DoNeuralStuff(inputs));

            MoveSnakeInDirection(moves);
        }
Beispiel #2
0
        private void ManualTimer_Tick(object sender, EventArgs e)
        {
            gameList[0].GetBestSnake().TurnSnake(Keyboard.IsKeyDown(Key.Left), Keyboard.IsKeyDown(Key.Right));

            var values = Sensors.FindAppleDirectionaly(gameList[0].Apples, gameList[0].GetBestSnake());

            Debug.WriteLine(values[0] + " " + values[1] + " " + values[2] + " " + values[3]);
            DrawGame(gameList[0]);
        }
Beispiel #3
0
        public void UseBrainToMove(List <Apple> apples, object locker)
        {
            List <double> inputs = Sensors.FindAppleIn4Directions(apples, CurrentSnakeBlocks[0]);

            inputs.AddRange(Sensors.FindWallIn4Directions(CurrentSnakeBlocks[0]));
            var moves = DecodeMove(Brain.DoNeuralStuff(inputs));

            MoveSnakeInDirection(moves);
        }
Beispiel #4
0
        public void UseBrainToTurn(List <Apple> apples, object locker)
        {
            List <double> inputs = Sensors.FindAppleDirectionaly(apples, this);

            inputs.AddRange(Sensors.FindSnakeOrientation(this));
            if (Settings.Default.Walls)
            {
                inputs.AddRange(Sensors.FindWallDirectionaly(this));
            }
            var moves = DecodeTurn(Brain.DoNeuralStuff(inputs));

            TurnSnake(moves[0], moves[1]);
        }