-
Notifications
You must be signed in to change notification settings - Fork 0
/
tester.py
74 lines (63 loc) · 2.18 KB
/
tester.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
''' Test file for answer function '''
import pandas as pd
gs = [5,2]
gs = [[' ', ' '],[' ',' '],[' ',' '],[' ',' '],[' ',' ']]
def ansFn(guess, answer, anslist):
# build the first column in the 2d array with just the letter
# do the color after
pl =[True, True, True, True, True]
ym =[True, True, True, True, True]
for x in range(5):
anslist[x][0] = guess[x]
for x in range(5): #green loop
if guess[x] == answer[x]: #easy it is green
anslist[x][1] = 'green'
pl[x] = False
ym[x] = False
#print(pl)
#print(ym)
#print(" ")
for x in range(5): #gray loop
if pl[x]: # this position is not green
#print(guess[x])
m = False
for y in range(5):
if pl[y]:
#print(answer[y])
if guess[x] == answer[y]:
m = True # m starts false if it is never found it is gray
if ym[y]:
anslist[x][1] = 'yellow'
#print("found: yellow")
ym[y] = False
else:
anslist[x][1] = 'gray'
#print("not found inner: gray")
if not m:
anslist[x][1] = 'gray'
#print("not found catch all: gray")
'''
for y in range(5):
if ym[y]: #it was found somewhere it is yellow
if guess[x] == answer[y]:
anslist[x][1] = 'yellow'
ym[y] = False
#print("found: yellow")
else:
anslist[x][1] = 'gray'
#print("not found catch all: gray")
#else:
# anslist[x][1] = 'gray'
# #print("other: gray")
'''
#check if all positions are green, ie its solved
#print(ym)
#print(pl)
if not any(pl):
return True
else:
return False
if ansFn("nates", "nates", gs):
print("it returned true")
print("answer")
print(gs)