A PowerShell Game you can Compete with People Online – Feature Update to PSWordle
Table of Contents
Usually, when I update items such as modules, functions, and other projects, I don’t make a new post but rather adjust the original post. But, in this case there are so many changes and new features, I felt that I had too. I will still be updating the original post so if anyone stumbles upon it they won’t be given old information. A HUGE Thank You to Lee Holmes whose PowerShell code of the Wordle logic was so good, I ended up re-writing about 90% of this module!
What is the Game?
The game is a clone of Wordle which I came across reading a New York Times article and based off my Twitter feed, is quite a popular game. The game itself is pretty simple, you have 6 attempts to guess the word. Letters that turn gray are not letters found in the word at all, yellow letters are letters that are found in the word but you have placed it in the incorrect spot, and green letters are letters that are in the word, and you have placed it in the correct spot. There is a new wordle every day.
How Can I Play with PowerShell?
Install It
The PowerShell Module is named PSWordle and is available in the PowerShell Gallery. By launching an administrative PowerShell console and running Install-Module -Name PSWordle you can quickly and easily install it on your machine.
You can also view all of the source code on GitHub. Feel free to Fork it and contribute to the project!
Regular Mode
Regular mode is the same as the online version. It will get a random 5-character word and you have 6 tries to guess the word. After each guess the letters of your guess will change color. Unlike Wordle, PSWordle allows you to play as many times as you’d like.
Gray – Not in the word
Yellow – In the word, but in the wrong spot
Green – In the word, in the correct spot
To create start a new game run, New-PSWordleGame
Hard Mode
In hard mode, letters that are yellow or green must be in the next guess. Green letters must remain in the correct spots, while yellow letters are free to move around until they are in the correct position.
To create start a new game with hardcode run, New-PSWordleGame -HardMode
Playing a game in Hard Mode will earn you no more points than in regular mode when you compete online.
Compete Online
When you compete online, you earn points based on how well you guess the Wordle word. When the game finishes by either you not guessing the word in 6 attempts, or you successfully guess the word, it will gather your score and submit it to the online leaderboard where you can compete against other PSWordle users all over the world. When you create a new game to compete online, if you have not previously set a username you will be prompted to create one.
Caution: If you are unable to guess the Wordle word in 6 attempts, you will lose 1 point!
The points system is as follows:
If you Guess the Word on the _ Attempt | Points |
1st | 10 |
2nd | 8 |
3rd | 6 |
4th | 4 |
5th | 2 |
6th | 1 |
To create start a new game with hardcode run, New-PSWordleGame -CompeteOnline
View the Leaderboard
You can view the leaderboard at any time by running Get-PSWordleLeaderboard
Other Features
Dictionary Checking
v0.0.1 of PSWordle allowed you to guess any 5 characters, it didn’t need to be an actual word. Now each attempt is quickly checked against a list of 13,112 5-character words. If you attempt to guess a word that is not in the dictionary it will warn you and let you guess again, it will not count towards your 6 guess limit.
Use Emoji Responses
To add a layer of complexity, you can include the -UseEmojiResponses switch parameter and instead of changing the letters, it will display the corresponding emoji.
Try it out by running New-PSWordleGame -UseEmojiResponses
Sharing End Result
Similarly to the Wordle online game, when you complete a game it will display the emoji responses in a grid so you can share how you did.
Update Handling
It’s always nice to play the latest of any game so you can experience new features and bug fixes. On launch, the module will check its version and verify it’s the latest. If it’s not it will display a message regarding the update.
Don’t care to update? No problem! Use the -IgnoreUpdates switch parameter and it won’t check or display an update message to you.
Word List
The Wordle word list has grown substantially since the earlier versions. Currently the word list is made up of 12,972 words! The word list is the same list Wordle online is using.
My name is Bradley Wyatt; I am a 5x Microsoft Most Valuable Professional (MVP) in Microsoft Azure and Microsoft 365. I have given talks at many different conferences, user groups, and companies throughout the United States, ranging from PowerShell to DevOps Security best practices, and I am the 2022 North American Outstanding Contribution to the Microsoft Community winner.