top of page

Posts

I Asked ChatGPT to Make an Epic Python Turtle Race



I decided to play around with ChatGPT. So, I asked ChatGPT to make the Python turtle race I made last time more exciting.


The environment and code

- Windows11 Pro

- Python 3.11.1

- GPT-3.5


Please refer to the code here.



The First Try


At any rate, I told ChatGPT to make it more exciting.



▼The result


What… It looks the same as before…


The Second Try


Maybe the way I asked wasn’t the best, so I asked “ultra-aggressive”.

Their answer seems to be it’s going to work.


▼The result


Okay….

I became a little aggressive, but this is not what I expected.


Third try

I simply asked to make it “chaos”.


It kinda looks like a description of Di*ney Land.


▼The result



It’s getting close I guess.

Is this what ChatGPT thinks how ”Chaos” looks like?


Last try

I asked to add more turtles and explode them.


I appreciate the fact that ChatGPT is willing to take my crazy ideas on board.



The finished code.



from turtle import *
from random import randint, choice
import time
 
# Prepare for an explosive extravaganza!
bgcolor('black')
colors = ['red', 'blue', 'orange', 'green', 'purple', 'yellow', 'white']
shapes = ['turtle', 'classic', 'arrow', 'circle', 'square', 'triangle', 'turtle']
 
# Create a legion of turtles
turtles = []
num_turtles = 100  # Increase or decrease this value for more or fewer turtles
for _ in range(num_turtles):
    turtle = Turtle()
    turtle.color(choice(colors))
    turtle.shape(choice(shapes))
    turtle.penup()
    turtle.goto(randint(-300, 300), randint(-300, 300))
    turtle.speed(randint(5, 15))
    turtles.append(turtle)
 
# Ignite the explosion!
time.sleep(2)
 
def explode(turtle):
    turtle.shapesize(3)
    turtle.color('red')
    turtle.speed(10)
    for _ in range(36):
        turtle.right(10)
        turtle.stamp()
 
# Let the explosion begin!
for race in range(100):
    for turtle in turtles:
        turtle.forward(randint(5, 20))
        if turtle.distance(0, 0) < 100:
            explode(turtle)

Plus, ChatGPT told me to change the number of turtles, so I made it 100.



The result is this ↓


This isn’t a race anymore.

But I think the possibility of ChatGPT is endless.


Thank you!




This blog post is translated from a blog post written by Kawa Ken on our Japanese website Beyond Co..


Comments


bottom of page