How ChatGPT helped me build my game
?? Wolfgang Radl
Changing the way our world builds software ◆ Solutions Consultant @ Pega
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.
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.
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:
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:
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!
But of course, I’m lazy – so I asked for an implementation of the checkWin function.
领英推荐
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:
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…
… 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.
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:
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.
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.
Driving modernization and transformation
1 年This is awesome. Thanks for sharing and adding to my list of things to try!
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!