Tetris clone built with Streamlit

Hey all!

I’ve been experimenting with Streamlit + Claude these days and wanted to see how difficult it would be to create a Tetris clone. It turns out it’s not that difficult!

Here’s the app: Streamlit App Generator | tetris-clone-85c8

2024-11-13 1.59.47 p.m.

If you’re curious, this is the timeline:

  • Claude 3.5 Sonnet could not generate a complete working game with a single prompt. Sometimes, it generated a working game board (blocks moving slowly to the bottom), but the controls didn’t work. Other times, the code was plain broken.
  • Instead, I went step by step and asked the model first to create the logic that moves the blocks and added more specific details. I was able to get a moving game board on the first attempt
  • Then, I asked to add other types of blocks (it initially dropped a 1x1 block)
  • Finally, I added the controls and tweaked some UI parts (like changing the color once the blocks are at the bottom) - this was all done with AI
  • At this point, I had a “working game,” and it took me like 5 minutes to reach this stage
  • However, I discovered a bug that caused the logic that cleared the lines. I prompted Claude 3 times, but it could not fix the error. I manually debugged the app until I found which function had the issue (at that time, I was pretty unfamiliar with the code, so it took me about 30 minutes to find the problem. Once I spotted the error, I described in a lot more detail what the issue was, and Claude was able to fix it!