5 kyu
A Brave New Wordle
209 of 336photo-pizza-importance
Description:
Wordle is a game where users try to guess a hidden 5 letter word. Feedback is given for each guess, in the form of colored tiles, indicating when letters match or occupy the correct position.
see: https://www.nytimes.com/games/wordle/index.html
The Brief
Make a function that takes in a 5 letter guess and, comparing to a known solution, returns clues for the user to solve the wordle puzzle.
Requirements
- The function takes in two strings of 5 letters each, a guess and a solution.
- The function returns a string of 5 letters.
- The returned string is composed of letters each corresponding to a letter of the guess: 'b' (black) when the letter is not present in the answer; 'y' (yellow) when the letter is present but in a different location; and 'g' (green) when the letter is present and in the right location.
Duplicates
- A letter appearing in the correct place is always green, including if it appears elsewhere in the word.
- A letter can only be green or yellow as many times as it appears in the correct answer. Extra occurences of that letter are marked as 'b'. Below are some examples, see example tests for more:
- letters are evaluated left to right.
Guess: xxxxx
Answer: yxxxx
Expected Output: bgggg
Explanation: extra letters marked as 'b'
guess: xxxxz
answer:aaaax
expected output: ybbbb
first x marked as 'y', and each one as 'b' after
Algorithms
Strings
Puzzles
Similar Kata:
Stats:
Created | Feb 7, 2022 |
Published | Feb 8, 2022 |
Warriors Trained | 740 |
Total Skips | 20 |
Total Code Submissions | 2071 |
Total Times Completed | 336 |
JavaScript Completions | 209 |
Python Completions | 138 |
Total Stars | 32 |
% of votes with a positive feedback rating | 92% of 72 |
Total "Very Satisfied" Votes | 62 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 15 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |