Depending on your existing experience with Unison, you can pick and choose how much direction and information you need about each of the following components. In broad strokes, this is how we suggest tackling the problem. We've provided some stub signatures and each section contains a link to a more detailed page. At the end we've listed some options for extending the project that we won't dive into here.
Install and set up the UCM
- You should have a codebase created, the
base
namespace downloaded, and your authorship and license set up before starting.
Core logic and data modeling
- Implement Wordleβs core comparison logic: given a 5 letter target word and a 5 letter user guess, return the guess with each character annotated with one of the three Wordle result options
stubs.Guess.score : stubs.Guess -> stubs.Target -> [stubs.Result]
Rendering a guess to the console
- Colorize console feedback withStew's ansi libraryfrom Unison Share
- Print out a rendered result to the console with IO
stubs.renderRow : [stubs.Result] -> Textstubs.renderGuesses : [[stubs.Result]] -> Text
Input validation and error handling
- Validate length of guesses
- Rerunning console interactions
stubs.getUserInput : '{IO, Exception, Ask (Set Text)} stubs.Guess
Game loop state and dictionary
- Querya provided file of 5 letter wordsfor more validation options
- Write the loop which captures the user's guesses using IO and other abilities
- Run wordle, package it for sharing
stubs.gameLoop : Nat
-> stubs.Target
-> [[stubs.Result]]
->{IO, Exception, Ask (Set Text)} ()stubs.main : '{IO, Exception} ()
Wordle solver challenge task
- Write a wordlesolver:see if it can outcompete your human friends
Additional challenges
That's it!
π₯Give it a whirl! π