A demo of using GPT-4/ChatGPT as a game engine for running Flappy Bird. It encodes the state of the game using '0' for empty spaces, '|' for pipes and '>' for the bird.
- Install required libraries:
pip install -r requirements.txt
- Make a
.env
file with the below format and use your own OpenAI API KEY:OPENAI_API_KEY=[YOUR-OWN-KEY]
- Run the
main.py
file.
The games doesn't really work, at least in a logical manner. Here are some possible improvements:
- Prompt Engineering: GPT has a hard time generating states of the game that are presistant with the previous state and also follow the rules of the game.
- Screen for Dead: If the bird dies, the program exists with an error. Proper error handling along with a good screen visualization is needed.