Using ChatGPT to code a browser based trivia game

David Such
8 min readJun 6

ChatGPT is surprisingly good at coding simple websites. We had been reading about people generating browser based games using ChatGPT and decided to see if we could come up with the next Wordle.

Figure 1. ChatGPT pumping out the JavaScript

Our previous review of ChatGPT’s programming expertise was a bit of a mixed bag. Our conclusion was that ChatGPT was useful for code snippets, commenting, suggesting approaches, error message diagnosis and providing examples of common code with well documented solutions. It is not so good at generating code for large, complex, or niche applications.

Simple browser based games appear to be right in its wheelhouse. In our earlier article we used languages that we were familiar with (Python and C++). We have no experience with web development (JavaScript, HTML and CSS), so this time ChatGPT needed to do all the heavy lifting. And it did! All the code it produced (Figure 1), worked first time. The only area we have a small quibble with is that it didn’t always warn you if changes to the JavaScript also required changes to the HTML and/or CSS files.

Playing the Game

We wanted to create an “original” game that provided you with up to five clues or facts about popular programming languages. Based on these clues, you had to guess which programming language was being described. Perhaps not the next Wordle, but it should demonstrate ChatGPT’s capabilities.

You can play the game (Figure 2) at either or

Figure 2. CodeName — The new game from Reefwing Software (Final Iteration)

The Process

The approach that we will use is called prompt chaining. This is described in depth in our original Large Language Model (LLM) article about Prompt Engineering. Basically the idea is to break the task down into digestible chunks and iterate on the code until we get the result that we are…

David Such

Reefwing Software · Embedded Systems Engineer · iOS & Android Development · Robotics · Drones · Arduino · Raspberry Pi · Flight Control