Worlde is a New York Times mobile web-app and game that grew in popularity in 2022. The goal of the game was to guess a 5-letter word in a given amount of attempts. Each guess must be a real word, and following each input feedback is given on whether the inputted letters are present in the word, and whether they are in the right location.
Wordle is a game that can only be played once a day, as a new word is only generated once a day. To practise one’s skills, I made an app that used a dictionary of 5 letter words, and chose one of the options at random and presented it to the user to guess.
Currently, the project is a terminal app that uses Python, though a version using Electron is currently being made.
https://github.com/varunan-vara/FakeWordle
from rich.console import Console
from rich.table import Table
from wordle import wordlerepo, game # This is a library that is custom made for the game
console = Console()
wordlelist = wordlerepo()
def main() :
# The simple stuff
correctword = wordlelist.randword()
listy = wordlelist.returnlist()
session = game(correctword, listy)
console.print("[bold red]Fake[/bold red] [u]Wordle[/u]")
console.print("By Varunan Varathan")
table = Table(title="Wordle Responses: ")
table.add_column("#", style="bold cyan", justify="right")
table.add_column("Guesses")
i = 0
while i < 5:
def getguess ():
console.print("[bold green]Enter Guess Here[/bold green]")
global response
response = input()
global result
result = session.play(response)
try:
getguess()
except:
console.print("[bold red]Word not found in list[/bold red]")
continue
wonbool = sum(result) == 10
outputstring = ""
for j in range(len(response)):
match result[j]:
case 0:
format = "white"
case 1:
format = "bold yellow"
case 2:
format = "bold green"
outputstring += "[{}]{}[/{}]".format(format, response[j], format)
if wonbool:
table.add_row(str(j + 1), "[bold green]{} ---- CONGRATS!![/bold green]".format(response))
console.print(table)
break
else:
table.add_row(str(i + 1), outputstring)
console.print(table)
if i == 4:
table.add_row("Correct", "[bold red]{}[/bold red]".format(correctword))
console.print(table)
break
i += 1
main()