Sacred Potato Productions |
spp > blog > chatgpt_presents_mr._dont!
Published Wednesday, October 10, 2024 at 7:17pm
It's hard to say how I feel about AI at any given moment. On one hand, it's amazing that I can type a sentence into a text box on a website which will turn it moments later into a slick, three-minute pop song. On the other hand, it's hard to get excited about that when authors of best-selling e-books freely admit that they haven't actually read a single word of their most popular novel. Still, it's fun to play with AI which seems to get more capable every time I turn around. I did my first experiments with generative AI a couple of years ago, and the results were, if not impressive, then at least interesting (at left: "Sammy Davis Jr. not particularly thrilled to be afloat on an ocean of lard" from late December 2022). My feelings about using AI for creative work are very conflicted and it's hard not to be pessimistic about the future of working artists. We read exponentially more news than we used to, but the value of traditional journalism has never been lower, and I think the arts are headed in the same direction. AI's proponents like to point out that technology has always had detractors, but the difference in effort and talent between a good visual artist and somebody who's good at generating AI prompts is an insurmountable gulf compared to the difference in effort and talent between a good painter and a good digital artist. As I said, though, I do enjoy playing idly with AI. I've been seeing people talk about using ChatGPT to cover up their inexperience with new programming languages, and I started wondering if I could make it write a program in an old, unpopular language, like, say, a machine-specific dialect of BASIC like the one on which I cut my first programming teeth. Mr. Do! was a popular video game in the early '80s, and I've seen it referenced for years but am slightly too young to have ever actually seen it. I ran across the name Mr. Do! again a couple of weeks ago. decided to look it up, and discovered that there's an Android version. I downloaded it and was quickly reminded that no matter how much fun it might have been on original hardware, it's really hard to play old games on a touchscreen rather than with physical buttons. Thinking about this, I asked ChatGPT to write me a Mr. Do! clone in GW-BASIC, which was bundled with the earliest versions of MS-DOS. A lot of programmers will roll their eyes and tell you that you can't do something as complex as Mr. Do! in BASIC, and that might have been true in the early '80s on an 8-bit machine, but modern computers are literally thousands of times faster; a game that was unplayably slow on an 8088 needs to be throttled on a modern machine to keep it from running too fast. This is what ChatGPT came up with: Creating a full clone of a game like Mr. Do in GW BASIC is quite complex, given the limitations of the language and the need for detailed graphics and gameplay mechanics. However, I can help you get started with a basic framework for a simple game. Here's a very basic example to get you started:
This is amazing, but it's also underwhelming. On one hand, I would not have thought until recently that it would be possible to make such a request in plain English and get anything even vaguely resembling a functional program. On the other hand, this is not Mr. Do!, and I have a lot of problems with the way it's written. I understand the choices, but they're bad ones. First of all, this is much simpler than Mr. Do!, a game in which you must fend off monsters with a superball while you harvest cherries. It's basically Dig Dug with just enough added complexity to have prevented it from being a classic on the same level as Dig Dug. It's hard to classify this program as a game. You're presented with a rectangular playing field represented by a grid of periods. Dotted randomly across the playing field are ten cherries represented by the letter C, and you move yourself (the letter P) around the grid to collect the cherries. Once all ten cherries are collected, you receive a message of congratulation and the game abruptly ends. There are no enemies. That's not to say that it isn't challenging, though, by virtue of a handful of really bad programming choices. You move around the grid using the W, A, S, and D keys which are standard in modern games where your left hand moves you and your right hand stays on the mouse, but the arrow keys would have been more appropriate back when people were still using GW-Basic. Much worse, the screen is constantly being redrawn. The main loop of the program clears the screen, displays the playing field, checks to see if you've pressed a key and responds appropriately if you have, and then repeats the process until you either win or quit. The playing field is drawn one character at a time, left to right, top to bottom, which means that the elements in the upper left are on screen the longest, and the screen is cleared immediately after drawing the character in the lower right. So, the upper left blinks quickly, and the lower right flickers so fast that you can barely see it, or tell when you've moved to that part of the playing field. Programming is a very forgiving process, in that there are lots of ways to approach a problem, and most of them are acceptable. Crappier programmers might pause the program to wait for a keypress and then redraw the whole screen (slightly better than a quick check and an immediate redraw), but I think most of us would draw the whole playing field once, wait for the user to press a key, and then update only the parts that have changed. Adding moving enemies to this game wouldn't be difficult, but it still has a long way to go before most people would call it fun. Okay, so, Mr. Do! was a bust. I wondered how ChatGPT would fare at writing an adventure game and asked it to write me one in BASIC for the TI-99/4A, which was the very first computer I owned:
I feel like most non-programmers could get a pretty good idea of how this program works by studying the code, and it helps that this is a terrible example of an adventure game. Most of what we think of as "text adventures" accept simple sentences from the player and respond accordingly. The programming for that sort of thing isn't exactly fancy, but it would probably be impenetrable if you're not famliar with code. The example above doesn't give the player any flexibility; instead of accepting sentences it accepts only single words, and it tells you which words it can take any any given time. This isn't an adventure game; it's barely even Choose Your Own Adventure. I wrote my first games in 4th grade, and they were like this but more complex. I always wrote a lot more text, had more branching paths, ASCII art, and preferred to give numbered choices rather than asking the user to enter a word ALL IN CAPS. They weren't very good but they were much better than this. After reading through this listing, I asked ChatGPT to convert it to a Bash script. Bash is a command line interface for Unix-like operating systems, and it has an extremely powerful scripting language. ChatGPT obliged with a somewhat less user-friendly version of the program above. It's perfectly feasible to exactly replicate the functionality of this program in Bash, but ChatGPT decided to paint in very broad strokes. As written in BASIC, the game tells you if you've mistyped one of your choices and lets you correct it. The Bash script does not afford you such luxury; every choice is binary, and you either make exactly the right choice, or you've made the other one. If, given the choices of CLIMB and BACK, you type "climb" in lowercase or type "CLUNV" because your right hand is on the wrong keys, it responds as if you've entered "BACK." Anyway, ChatGPT's inability to tackle these tasks appropriately has me feeling a little better about the state of things, but that won't last long. In 2019, you could recognize AI photos because the ears and the eyeglasses were all messed up. A couple of years later the ears and eyeglasses were fine but the hands had too many fingers. These days the hands look okay, and Mr. Do!: The Text Adventure is probably just around the corner.
| ||||||||
This page available under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Some rights reserved, .