I’m in the software business by trade, so it should come as no surprise that my work environment has been using AI as soon as it was available. First endeavors were testing the security and guardrail components, model differences, and integration patterns such as retrieval-augmented generation and now model context protocol. This has led to some solid business outcomes, including faster time-to-resolution for customer tickets through issue summary generation and identified resolution actions.
It wasn’t until the last few months though that I noticed developers integrating AI into their IDE to help with end-to-end coding. That has been insanely powerful, and a bit unnerving. Traditional coding is being replaced with prompt engineering, lowering the bar of access to compute. Innovation in so many domains is about to get so much faster. So, it is in this frame that I bring my AI learnings back home to play.
In one of my old drafts from 2016, I was playing around with Google Go and implemented a 2048 emulator as a side project to understand that language. If you aren’t familiar with 2048, it’s a fun game that progressively gets harder as you try to combine 2s and 4s together on a 4×4 grid to make a 2048 tile. You know, I suck at explaining these things – if you don’t know what 2048 is, watch this youtube. I came back and forth to making this emulator over the course of many nights (remember, I’m a Dad first). This was all hand-coding. Yes granted, with a new language, but still. It was arduous.
So now here I am on a random Saturday with 3 hours to kill. What a difference 9 years make. I updated VSCode to enable Github Copilot, picked good-old reliable python, and starting prompting the AI to build me an emulator:
i'd like to create a 2048 game emulator. This should be played via command line. This game should have a 4 x 4 square, where upon start a "2" appears randomly in one cell. The player decides to push the numbers right, left, up, or down - which moves the numbers all the way to those directions. Should a 2 find another 2, then it combines and 4 is created. The 2s that went into it disappear. If a 4 meets a 4, an 8 is created and the 4s that went into it disappear. Same for 8s, 16s, 32s, 64s, etc. The goal of the game is to get a cell to 2048.
It took that and started configuring my environment, and spat out:
Created game_2048.py
- Run the game by executing game_2048.py
- Use the following keys to play:
W: move tiles upA: move tiles leftS: move tiles downD: move tiles rightQ: quit the game
The game features:
- A 4×4 grid where tiles can be moved in four directions
- Random placement of new ‘2’ tiles after each valid move
- Merging of equal tiles when they collide
- Score tracking
- Win detection when 2048 is reached
- Game over detection when no more moves are possible
The board is displayed with a simple ASCII interface where:
- Empty cells are shown as ‘.’
- Numbers are centered in their cells
- The current score is displayed at the top
- The board is framed with borders for better visibility
Would you like me to run the game so you can try it out?
Rock and Roll. It got it wrong. Just a couple tests and I found left and up weren’t working right. They weren’t pushing all tiles to the left or right.
Prompt –> Fix
Then I found down was broken.
Prompt –> Fix
Then I found that ‘4’ wasn’t being generated. My fault, initial prompt error.
Prompt –> Fix
Boom. I had a working emulator. Sweet, fast, and brainless. I’m back where I was in 2016 — but it only too me about an hour.
And I’m not done. My new project off this is to find the right sequence to play to get as close to 2048 as possible. Stay tuned as I have AI develop ML.