[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

ChatGPTに究極のPythonカメレースを作ってもらった

こんにちは
歩くセキュリティホール
システムソリューション部のかわです。

6月ですね。祝日はいつできるんでしょうか。
雨が多くて頭がどうにかなりそうなので、ChatGPTさん(3.5)と遊んでみました(仕事はちゃんとしてます)。
今回は昔記事にもしたPythonのカメレースを、ChatGPTにもっと強くしてもらいました。タイトルの究極は言い過ぎかもしれない

動作環境と元のコード

- Windows11 Pro
- Python 3.11.1
- GPT-3.5

貼ると長くなるのでコードはこちらを参照

1回目

とりあえず、もっと楽しくしてくれと伝えました。

▼できあがったカメレース

え、、前と変わらんやん、、

気を取り直して2回目

たぶん伝え方が悪かったので、「ultra aggressive」を追加してみました

うんうん、めちゃくちゃノリノリなのでいけそうな気がします

▼完成

うーん、、
ちょっとアグレッシブにはなったけど、まだまだな気が

3回目

もうめんどくさいので「カオスにして」って頼んでみます

なんかめちゃくちゃ◯ィズニーランドの説明みたいになってきたので今回は期待できそうです

▼完成

お、ちょっと近づいてきた気がするぞ
これがChatGPTの考えるカオスなのか?

最後の挑戦

さらにカメを増やして爆発させてって頼んでみました

ここまで来るとChatGPTも一蓮托生ですね。
こっちの無茶振りにも乗ってくれるのでありがたいです。

▼完成したコード

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)

加えて、このカメの数は変えちゃってね!て書いてたので100匹にします

そして完成したのがこれ⇩

もはやレースではない
なんかもう、言葉では表せないやばい感じになったと思います。

可能性は無限大な気がしてきますね。
ではまた!

~完~

この記事がお役に立てば【 いいね 】のご協力をお願いいたします!
16
読み込み中...
16 票, 平均: 1.00 / 116
693
X facebook はてなブックマーク pocket
[2024.6.30 CentOS support ended] CentOS server migration solution

[2024.6.30 CentOS support ended] CentOS server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

The person who wrote this article

About the author

Kawa Ken


A curious Poke○n who belongs to the System Solution Department.