Remote comment: Game AI in python


Snake AI in Pygame, https://pythonspot.com/snake-ai-in-pygame/

The Game AI is hidden in the “def target()” function. In the AI literature the principle is called a static decision tree. The AI player perceives the environment “if self.x[0] > dx:” and executes an action in response: “self.moveLeft()”.

What was shown in the project is not an sophisticated AI player which is able to solve the game, but the game AI concept itself. First, the snake game was programmed in Python, and on top of the game, the AI player was realized in a subfunction. Who this AI subfunction has to be realized depends on the knowledge the programmer has. The described Behavior tree is the most simple form of implementing an AI. It doesn’t contains search algorithm nor gametree graphs but it is working on a simpler level in under 10 lines of code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.