-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsasta_ai.py
More file actions
32 lines (28 loc) · 1.01 KB
/
sasta_ai.py
File metadata and controls
32 lines (28 loc) · 1.01 KB
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
#algorithm responsible for interpreting the hints
def sasta_ai(data:dict):
c=[]
for index,j in data.items():
val=j[1]
if j[0]=="slate":
test=False
for k in data.values():
if k[1]==val and k[0]!="slate":
test=True
break
if test==False:
c.append(f"x.count('{val}')==0")
if j[0]=="slate":
c.append(f"x[{index}]!='{val}'")
elif j[0]=="yellow":
c.append(f"x[{index}]!='{val}'")
count=0
for k in data.values():
if j[1]==k[1] and k[0]!="slate":
count+=1
c.append(f"x.count('{val}')=={count}")
elif j[0]=="green":
c.append(f"x[{index}]=='{val}'")
return ' and '+' and '.join(c)
if __name__=="__main__":
#test
print(sasta_ai({0:["yellow","1"],1:["slate","2"],2:["slate","+"],3:["slate","4"],4:["green","3"],5:["green","2"]}))