Coding STEM

Word Connect Game

Recently, the game on New York Times has been getting a lot of attention and generating much excitement by the readers. While I don’t subscribe to the newspaper, my friends shared the game screens with me which prompted me to ponder if I could create my version of this in Python. So, after a few days of experimentation, I did.

Below is my first implementation. The goal is straightforward: You are given 16 words, randomly arranged in a 4×4 grid. Your objective is to select 4 words that are related (“connected”) in some way. In my version, they are related by a category. If you succeed in matching 4 words, you continue to pick the next 4 words that may be related to another category. And so on, until all 16 words are matched into 4 categories. You can afford up to 3 mistakes (4 tries). You can then play again by pressing New Game. There is no time-limit, and there’s no limit to how many times you can play (for free — see below).

My code design

Unlike the newspaper version however, mine is real-time, and infinitely scalable without manual developer intervention. I have designed it so all required data for the game are read in from a datasource (which can be easily extended by me, by adding more words and categories) and each word has information about the category it belongs to, color of the category, along with difficulty level (1: easiest to 4: hardest).

At each match (new game), 16 words are randomly chosen from the datasource. As matches are made, the word-buttons are disabled so you cannot mistakenly click them again during the match. When there are mistakes, you are given the feedback. Each category has its unique color so make it visually easy to relate.

Each match loads 16 words from a datasource of 500+ words (easily extensibly with infinite number of words if I wish) along with their respective categories. It’s guaranteed to never load the same category more than once in a match.

Playing the game

You can play the game in an emulated environment online right from this page (thanks to but the experience is not optimal as running on your own computer as a stand-alone application like I do. I will consider releasing a stand-alone, downloadable version in the future…maybe. But for now, you are free to familiarize yourself with this fun game! It’s great for nudging your noggin, or use as a learning tool (I’ve designed it in a way such that the content can be changed to anything we want without having to touch the underlying code). I hope you enjoy it!

Click Run button to start the game. Press Stop icon or Quit button in the game UI to end the game.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top