How ChatGPT helped me build my game
Color Guessing Game by me(?)

How ChatGPT helped me build my game

A few years back, the Exploratorium had a simple game that captivated my daughter's attention for hours. She had to match the color of one elephant to the other on the screen.

The exhibit has been around for a while now. When I came home that day, I was determined to build my own version of the game. I played around with some HTML and JavaScript but eventually abandoned the project after I encountered a few issues.

No alt text provided for this image
Mix and Match at the Exploratorium, 1995

Fast forward two years, I decided to revisit it last weekend. I finally completed my project. And to my amazement, it only took me 30 minutes to get it running. But there's a catch. I'm not sure if I can take credit for this achievement.

No alt text provided for this image
Not the exact same shade of purple

Just like so many of you, I was excited to try out ChatGPT last week. I believe it has the potential to revolutionize the way we build software. I now have a working game. But I have some questions: is this still considered Low-Code? Will it eventually replace developers and me? I don't have all the answers, but I can share my experience as someone who wrote code for a living and give you a glimpse into my journey with an AI co-pilot.

I started with a simple prompt:

No alt text provided for this image
Some builderplate HTML - we're off to a great start!

At this point, I had a working HTML page with three sliders. Nothing special – they didn’t do anything yet. The game wasn’t there. So, I asked my co-pilot to create it:

No alt text provided for this image
The game controller is ready!

What impressed me was that ChatGPT still wanted me to do get my hands dirty. I told me how checking the win condition would work – including the margin I asked for – but it wasn’t willing to do my homework – yet. I can respect this!

No alt text provided for this image
The obligatory snarky remark, "this is no place for homework assignment"

But of course, I’m lazy – so I asked for an implementation of the checkWin function.

No alt text provided for this image
sudo make me a sandwich always works

I got what I asked for. But it didn’t stop there. My co-pilot also made me aware that we currently would not check for a win, and without being asked explicitly, showed my what I had to change:

No alt text provided for this image
I no longer have to think for myself!

Naturally, at this point I wasn’t willing to write a single line of CSS. I was curious how ChatGPT would handle my request regarding the white borders…

No alt text provided for this image
Stealing somebody else's homework

… but of course, I should not have doubted our new robot overlords. It remembered how we rendered our two circles, and as there was no way to style them using CSS, it gave me an updated version of our game.js file.

No alt text provided for this image
Aware of context - that's impressive.

Now – my game didn’t work right out of the gate. There were a few issues I had to correct myself. For example, a link to my game.js file wasn’t included – which is fair, because I asked it to create the HTML first. Curious how ChatGPT would react to the error message, I decided to do this:

No alt text provided for this image
Could have gone better.

This was not helpful. While the response is technically correct, I made a mistake that’s as old as JavaScript and HTML itself – including the link at the bottom of the file without checking whether my pages was done loading.

Of course, my new friend knew how to solve this. I still decided to simply move the link to the very bottom of my HTML file for simplicity’s sake. And again, if I didn’t know how to do that, my bot would have had me covered.

No alt text provided for this image
In case you forgot. I usually do.

In the end, it took me just 30 minutes to complete my game, including committing my files to GitHub and pushing the app into production. You can play it here: https://theorycrafter.org/color-game. What does this mean for Low-Code and rapid prototyping in general? It's hard to say for sure. This was a simple app, and without the help of StackOverflow and human-generated training material on the internet, ChatGPT wouldn't be nearly as smart. But one thing is certain: I am truly impressed.

And just in case you were wondering, I also had help writing most of the paragraphs in this article. I have a new friend. But I’m not sure if I trust them yet.

No alt text provided for this image
Apparently I hired a coder and copywriter.
Travis F.

Driving modernization and transformation

1 年

This is awesome. Thanks for sharing and adding to my list of things to try!

Jesse Wells

Razor-Sharp Business Systems Analyst ? | Expert in explaining complex subjects, written communication | UiPath RPA Analyst (Associate Certified) | I help CoEs achieve quick ROI

1 年

This grabbed my attention. Now I am going to have to see what kind of games I can make!

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了