Platforms / Python (pygame)
Make a Python game with AI
Describe a game and the agent writes it in Python with pygame, tests it without opening a window, and then runs it. A common first game, and a good way to learn from working code.
Free to try. macOS 12 or later. All downloads
A real example
This is a real session, not a mock-up: the request as it was typed, and what the agent did.
Make a pygame game: a snake game with a score and a game over screen
- Checked that Python and pygame were installed
- Wrote the game in one file
- Ran it in a hidden test mode: eating an apple added a point and a segment, hitting a wall ended the game and saved the best score, and starting again reset everything
- Saved a picture of the game over screen and looked at it
- Started the game in its own window
The first message took 43 seconds.
The result. A complete Snake: a checkered grid, apples, a score and best score, the snake speeding up as it grows, and a game over screen with a way to play again.
How it works with Python (pygame)
- The game is ordinary Python. Run it from Mirg or from a terminal.
- The agent can run a pygame game with no window at all and inspect it, which is how it tests the rules before you ever see it.
- The game then opens in its own window, which the agent can also look at and play once macOS allows it.
What you need
- Python, and the pygame package. Mirg installs pygame for you with one button.
Mirg lists what is installed and what is missing under "See what's installed" on its home screen. If you ask for a Python game without the tools for it, it tells you what to get and offers to build a web game instead.
Good to know
- If you are learning Python, ask the agent to explain any part of the code it wrote.
Questions
Do I need to install pygame myself?
No. If Python is on your Mac, Mirg can install pygame for you with one button.
Can I use this to learn Python?
Yes. The game is a normal Python file, and you can ask the agent to explain how any part of it works, or to change it.
Can the game be sent to friends?
It is a Python file, so anyone with Python and pygame can run it.