Level Up Your Wordle Game With Deepgram ASR.
Tags: hackwithdg, deepgram, python, programming
Published: 2022-04-10 17:40:17



---
cover_image: https://drive.google.com/uc?export=view&id=1dQ3pVwx4SJHSTTcF86e11vBIb_wQoR3e
---

Well, Hello there. This is my first blog post and hackathon here. The following sections will give you an overview of a project I have been working on recently to participate in this event.

### 👉 Table Of Content (TOC). <a name="TOC"></a>

* [Overview](#Overview)
  * [What is Wordle?](#WhatWordle)
  * [Wordle Rules](#WordleRules)
  * [Why Wordle?](#WhyWordle) 
* [Submission Category](#Submission)
* [Link to Code on GitHub](#GitHub)
* [Additional Resources/Info](#Info)

### Overview <a name="Overview"></a>

In the past couple of weeks, I have been developing a TUI-based clone of the world-famous word game: [wordle](https://www.nytimes.com/games/wordle/index.html). 

#### What is Wordle? <a name="WhatWordle"></a>

![What is Wordle](https://www.letseatcake.com/wp-content/uploads/2022/01/Wordle-Memes-7.jpg)

If you haven't heard of Wordle, either you live under a rock or don't care about the news. Either way, I'll get you covered. So, Wordle is a [web-based] (https://www.nytimes.com/games/wordle/index.html) word game that has exploded in popularity since the first quarter of 2022. It has millions of active and growing users and was recently acquired by the [New York Times](https://www.msn.com/en-us/news/us/the-new-york-times-buys-wordle-the-ultra-popular-online-word-game/ar-AATl2xi) for a seven-figure sum. What's impressive about this game is that it was developed by only [one person](https://en.wikipedia.org/wiki/Josh_Wardle), the same guy who created [`r/place`](https://www.reddit.com/r/place/), which would make it a great candidate for a hands-on Python project.

#### Wordle Rules <a name="WordleRules"></a>

#### 🔝 [Go To TOC](#TOC). 

The rules of the game are pretty straightforward:

* There is a secret five-letter word that you need to guess.
* You have only six attempts to guess the word.
* The word must be a valid English word.
* If you guess the correct word, you win the game; 
* As you submit your guess, letters will be highlighted:
  * Yellow if they exist in the secret word but the wrong position.
  * Green if they're in the correct position.
  * Black/Grey if the word doesn't contain any of the submitted letters. 

![guesses](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xg5dk1sp5e7a6w15402g.png) 

The game's simplicity is one of the key factors that made it so popular among us because it is effortless for an average human being to get their head around it. If you're a teacher, it can lead students into reading and spelling. It's easy to use, and it has the potential to make word games more fun for users. The concept of wordle is to make word games more interactive, which can lead to higher engagement rates among users and increased learning.

You may be wondering, Should I recreate such a game for this hackathon? And this is what we are going to find out in the next section.

#### Why wordle? <a name="WhyWordle"></a>

#### 🔝 [Go To TOC](#TOC). 

![searching](https://memegenerator.net/img/instances/81348223/searching-online.jpg)

At first, I spent a couple of days looking for a game idea for this hackathon. I was casually surfing the internet looking for ideas here and there, and I came across the popular wordle game. Then I decided to create a wordle clone because of its core features: simplicity, popularity, and engagement. 

Then I thought: "well! How about playing wordle with spelling the word instead of typing it!
Well, maybe we can also add the ability to share the result of each game played on Twitter, like most people are currently doing, from your terminal with a press of a button. How cool is that!"

![aha moment](https://media.makeameme.org/created/when-your-aha.jpg)

Then I had that moment: "This is it. This is my purpose. This is why I need to participate in this event."
And [**deepwordle**](https://github.com/Harmouch101/deepwordle) was born: A [TUI](https://en.wikipedia.org/wiki/Text-based_user_interface) based wordle clone powered by [Python](https://github.com/python/cpython), [Deepgram](https://github.com/deepgram/python-sdk), [Textual](https://github.com/Textualize/textual), [Tweepy](https://github.com/tweepy/tweepy), and [friends](https://github.com/Harmouch101/deepwordle/blob/4314b3a5cc0e293ef76574a1032a62f94459e3cb/pyproject.toml#L30-L38) :-).


### Submission Category  <a name="Submission"></a>

Gram Gamers.

### Link to Code on GitHub <a name="GitHub"></a>

#### 🔝 [Go To TOC](#TOC). 

At any time, feel free to check out my project on Github. Contributions are welcome.

{% github https://github.com/Harmouch101/deepwordle %}

### Additional Resources / Info <a name="Info"></a>

![exciting times](https://memegenerator.net/img/instances/67115783/brace-yourselves-exciting-times-are-coming.jpg)

Working on this project was exciting because it is based on a relatively new TUI framework: [Textual](https://github.com/Textualize/textual). That on its own would make the coding part more fun and challenging at the same time because I need to learn something new instead of utilizing my skills in other frameworks such as pygame and Tkinter.

Personally, I don't have a so-called 'favourite' framework/language, probably because of my 'result-driven' attitude, which allows me to always focus on achieving the end result regardless of the tools that have been used to achieve that end goal.

![python](https://memegenerator.net/img/instances/80810594/i-know-python.jpg)

On the other hand, I used Python because it has been my go-to language ever since I graduated from college, as you may know if you have been following along the way. Moreover, I don't bother myself spending a lot of time trying to memorize the language syntax and such.

Aside from that, another question would come to the mindset of experts "why in the world would you recreate an already existing tool/game?" It is just a programming practice; I just wanted to see what Python is capable of. I'd also encourage all of you to take a bit more charitable mindset by sharing the information among us regardless of its motivation.

Anywho, back to our project, the following image illustrates the major components of our game.

![deepwordle](https://camo.githubusercontent.com/77d0b70f2711c57d2177573a9544fcffdc513e0a78b50dae0cdd2dbb6094b03a/68747470733a2f2f64726976652e676f6f676c652e636f6d2f75633f6578706f72743d766965772669643d312d58617a3153726c4d42305a4b76563865456a643032784c624c6c792d6b6670)

On the left side, a panel is supposed to display statistics about your guesses(e.g. guess distribution, current streak, etc.). However, since I recently discovered this hackathon, I haven't implemented it yet, but it is being tracked in [this issue](https://github.com/Harmouch101/deepwordle/issues/2); for future work!

In the centre of the screen, the grid displays the letters of the word being submitted. Each letter is basically a Textual Button that has the [following properties](https://github.com/Harmouch101/deepwordle/blob/4314b3a5cc0e293ef76574a1032a62f94459e3cb/deepwordle/components/letter.py#L64-L75):

* `character`: the text is rendered on the button.
* `state`: the state of the letter(e.g. in word, in position, etc.).
* `color`: character's style, defined using the 'foreground on background' notation. for example: color = "white on dark_blue"
* `font_name`: a string that can be set to "mini", or "small", or "standard", or "big".

![rich_text](https://camo.githubusercontent.com/7600bce19b615620cc8712fd2caddfe6ad5caa511740ed7fd90f7a70292058b1/68747470733a2f2f64726976652e676f6f676c652e636f6d2f75633f6578706f72743d766965772669643d31416a57393163775835716c6c793365725357515a5a53754a5378324652335175)

There is the message panel on the right-hand side, which helps you follow along with the game.

For more information about this game and how to install it, please refer to the [README file](https://github.com/Harmouch101/deepwordle).

Subsequent articles are going to be published to explain every step taken towards building this project from the bottom up.

That's pretty much it for today's blog. Happy Coding!

![coding](https://media.makeameme.org/created/coding-so-many.jpg)