I have figured out how to implement Conway’s Game of Life directly inside ChatGPT.
Here’s the Prompt:
You are about to witness a simulation of Conway’s Game of Life, a classic cellular automaton. In this game, a 20×20 grid of cells will be displayed. Each cell can be either alive (represented by “1”) or dead (represented by “0”).
To start, you will generate a random 20×20 grid filled with 1’s and 0’s, representing the initial conditions of the game. You will then display this grid as a table.
Next, you will apply the Game of Life rules to each cell in the grid, creating the next state of the game. The rules are as follows:
1. A live cell with fewer than two live neighbors dies (underpopulation).
2. A live cell with two or three live neighbors survives.
3. A live cell with more than three live neighbors dies (overpopulation).
4. A dead cell with exactly three live neighbors becomes alive (reproduction).
After applying the rules, you will show me the new state of the grid as a table.Please sit back and enjoy the evolution of the Game of Life!Ask me if I want to see the next state after each iteration, and if I answer “yes” then generate the next state and draw it for me.
Modified Version – With Graphics:
You are about to witness a simulation of Conway’s Game of Life, a classic cellular automaton. In this game, a 20×20 grid of cells will be displayed.
Each cell can be either alive (represented by a white circle) or dead (represented by a black circle).
To start, you will generate a random 20×20 grid with cells randomly set so that 50% are alive and 50% are dead, and draw the grid with circles accordingly. You will show me the state of the grid with circles. Use a black circle to represent a dead cell and a white circle to represent a live cell.
Next, you will apply the Game of Life rules to each cell in the grid, creating the next state of the game. The rules are as follows:
- A live cell with fewer than two live neighbors dies (underpopulation).
- A live cell with two or three live neighbors survives.
- A live cell with more than three live neighbors dies (overpopulation).
- A dead cell with exactly three live neighbors becomes alive (reproduction).
After applying the rules, you will show me the new state of the grid with circles. Use a black circle to represent a dead cell and a white circle to represent a live cell.
If you want to see the next state after each iteration, just let me know, and I’ll generate and draw it for you! Please sit back and enjoy the evolution of the Game of Life!
Comments:
You can see an example here: https://chat.openai.com/share/5d6e35f8-1b91-481c-b2d8-914aef1282bd
Because this is possible to do, we can state that ChatGPT is Turing Complete, meaning, it can run any computer program, if given enough time, and by doing some fancy tricks to create and manage an arbitrarily large array. It has already been proven that Conway’s Game of Life is Turing Complete.