5 kyu

A Brave New Wordle

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

Stats:

CreatedFeb 7, 2022
PublishedFeb 8, 2022
Warriors Trained740
Total Skips20
Total Code Submissions2071
Total Times Completed336
JavaScript Completions209
Python Completions138
Total Stars32
% of votes with a positive feedback rating92% of 72
Total "Very Satisfied" Votes62
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes2
Total Rank Assessments15
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • photo-pizza-importance Avatar
  • mdandre Avatar
  • JohanWiltink Avatar
  • ThomasCampbell1988 Avatar
Ad