Wordle comparison: Difference between revisions

Content added Content deleted
(→‎{{header|Haskell}}: Updated output to include integer scores)
(→‎{{header|Python}}: Updated output to include raw integer scores)
Line 480: Line 480:
# amber :: Dict -> (Char, Int) -> (Dict, Int)
# amber :: Dict -> (Char, Int) -> (Dict, Int)
def amber(tally, cn):
def amber(tally, cn):
'''An adjusted tally of the counts of unmatched
'''An adjusted tally of the counts of unmatched
of remaining unmatched characters, tupled with
of remaining unmatched characters, tupled with
a 1 if the character was in the remaining tally
a 1 if the character was in the remaining tally
Line 500: Line 500:
'''Scores for a set of (Target, Guess) pairs.
'''Scores for a set of (Target, Guess) pairs.
'''
'''
print(' -> '.join(['Target', 'Guess', 'Score']))
print(' -> '.join(['Target', 'Guess', 'Scores']))
print()
print()
print(
print(
Line 528: Line 528:
scoreName = {2: 'green', 1: 'amber', 0: 'gray'}
scoreName = {2: 'green', 1: 'amber', 0: 'gray'}


return target + ': Expected 5 character target.' if (
if 5 != len(target):
5 != len(target)
return target + ': Expected 5 character target.'
) else guess + ': Expected 5 character guess.' if (
elif 5 != len(guess):
5 != len(guess)
return guess + ': Expected 5 character guess.'
) else ' -> '.join([
else:
target, guess,
scores = wordleScore(target, guess)
' '.join([
return ' -> '.join([
scoreName[n] for n in wordleScore(target, guess)
target, guess, repr(scores),
' '.join([
scoreName[n] for n in scores
])
])
])
])




Line 606: Line 608:
main()</lang>
main()</lang>
{{Out}}
{{Out}}
<pre>Target -> Guess -> Score
<pre>Target -> Guess -> Scores


ALLOW -> LOLLY -> amber amber green gray gray
ALLOW -> LOLLY -> [1, 1, 2, 0, 0] -> amber amber green gray gray
CHANT -> LATTE -> gray amber amber gray gray
CHANT -> LATTE -> [0, 1, 1, 0, 0] -> gray amber amber gray gray
ROBIN -> ALERT -> gray gray gray amber gray
ROBIN -> ALERT -> [0, 0, 0, 1, 0] -> gray gray gray amber gray
ROBIN -> SONIC -> gray green amber green gray
ROBIN -> SONIC -> [0, 2, 1, 2, 0] -> gray green amber green gray
ROBIN -> ROBIN -> green green green green green
ROBIN -> ROBIN -> [2, 2, 2, 2, 2] -> green green green green green
BULLY -> LOLLY -> gray gray green green green
BULLY -> LOLLY -> [0, 0, 2, 2, 2] -> gray gray green green green
ADAPT -> SÅLÅD -> gray gray gray gray amber
ADAPT -> SÅLÅD -> [0, 0, 0, 0, 1] -> gray gray gray gray amber
Ukraine: Expected 5 character target.
Ukraine: Expected 5 character target.
BBBBBAA: Expected 5 character guess.
BBBBBAA: Expected 5 character guess.