-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomputer_guess.py
More file actions
33 lines (26 loc) · 1013 Bytes
/
computer_guess.py
File metadata and controls
33 lines (26 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Pass in a guess
# TODO: Implement some Information Theory guessing based upon the workings of 3Blue1Brown.
secret_word = ''
def color_word(word_guessed):
"""
word_guessed : str - the guess to be colored.
The rules for coloring following the following rules:
1. If the letter is in the correct position, the letter gets
colored green.
2. If the letter is in the word but is somewhere else in the
word and has not been colored yellow or green already, then
we color it yellow.
3. Otherwise, the letter is colored black.
Useful examples:
Throughout, the secret word is assumed to be 'BROOM':
'ANKLE' would be colored 'BBBBB'
'BANDS' would be colored 'GBBBB'
'BABLE' would be colored 'GBBBB'
'RIGHT' would be colored 'YBBBB'
'MUMMY' would be colored 'YBBBB'
'OBOES' would be colored 'YYGBB'
Return :
colors : str - A sequence of colors, representing
the guess. e.g. 'BBYBG' = 'Black Black Yellow Black Green'
"""
return