-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (43 loc) · 1.07 KB
/
main.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
from word import *
from os import system
def remove_dupes(list) -> list:
ret = []
for i in range(len(list) - 1, -1, -1):
temp = list[i]
list[i] = None
if temp not in list:
ret.append(temp)
return ret
def extract(guess) -> list:
greens = []
yellows = []
reds = []
colors = input('Colors: ').lower()
for i in range(len(colors)):
match colors[i]:
case 'g':
greens.append([guess[i], i])
case 'y':
yellows.append([guess[i], i])
case 'r':
reds.append([guess[i], i])
return [greens, yellows, reds]
greens = []
yellows = []
reds = []
guess = input('Guess: ')
colors = extract(guess)
while True:
system('clear')
if colors[0]:
greens+=colors[0]
greens = remove_dupes(greens)
if colors[1]:
yellows+=colors[1]
yellows = remove_dupes(yellows)
if colors[2]:
reds+=colors[2]
reds = remove_dupes(reds)
word = get_words(greens, yellows, reds)
input(word)
colors = extract(word)