# Here we find all noncontradictory alliances for game http://www.kongregate.com/games/FibreTigre/you-are-the-us-secretary-of-state
#The input section (We change things in this section to calculate something new)
#Expressions are takes from file MiddleEastAlliancesTextFile.py
#Possible prefer alliances with maximum number of allies?
d={
0:["Support Russia",False],
1:["Support Assad",False],
2:["Suppor syrian rebels",False],
3:["Support Iran",False],
4:["Support Muslim Brotherhood",False],
5:["Support Hamas",False],
6:["Support Turkey",False]}
expression="(d[2][1]!=d[1][1]) and IF(d[0][1],d[1][1] and d[3][1])and IF(d[1][1],d[3][1] and not(d[4][1]))and IF(d[2][1],d[4][1] and not(d[1][1]))and IF(d[3][1],not(d[2][1]) and d[1][1])and IF(d[4][1],d[5][1])and IF(d[5][1],d[4][1] and d[3][1])and IF(d[6][1],d[4][1] and not(d[1][1]))"
# The end of the Input section
def IF(a,c):
return (not(a) or c)
def booleanBruteforce(currentPosition=0):
for currentBoolean in (False,True):
d[currentPosition][1]=currentBoolean
if currentPosition==len(d)-1:
if eval(expression):
print("---------------------------------")
allies=0
for currentKey in d:
if d[currentKey][1]==True:
allies+=1
print("Allies:",allies)
for currentKey in d:
print(d[currentKey][0]+":"+str(d[currentKey][1]))
else:
booleanBruteforce(currentPosition+1)
booleanBruteforce()