← Return to game
Log in with itch.io to leave a comment.
#Here's my code to calculate all must-win or must-lose
#forms in 3d.
set_lose={(0,0,0)}
set_win={(0,1,0),(1,0,0),(0,0,1)}
limit=5
def add_win(i,j,k):
set_win.add((i,j,k))
set_win.add((i,k,j))
set_win.add((k,i,j))
set_win.add((k,j,i))
set_win.add((j,i,k))
set_win.add((j,k,i))
def have_common(a,b):
if a[0]==b[0]:
if a[1]==b[1]:
for i in range(max(a[2],b[2])+1,limit+1):
add_win(a[0],a[1],i)
elif a[2]==b[2]:
for i in range(max(a[1],b[1])+1,limit+1):
add_win(a[0],i,a[2])
else:
if (a[1]>b[1]) and (a[2]<b[2]):
add_win(a[0],a[1],b[2])
if(a[1]<b[1]) and (a[2]>b[2]):
add_win(a[0],b[1],a[2])
elif a[1]==b[1]:
if a[2]==b[2]:
for i in range(max(a[0],b[0])+1,limit+1):
add_win(i,a[1],a[2])
if(a[0]>b[0]) and (a[2]<b[2]):
if(a[0]<b[0]) and(a[2]>b[2]):
add_win(b[0],a[1],a[2])
if(a[0]>b[0]) and (a[1]<b[1]):
if(a[0]<b[0]) and (a[1]>b[1]):
def xinzeng(dot):
for i in set_lose:
have_common(i,dot)
for i in range(0,limit+1):
for j in range(0,limit+1):
for k in range(0,limit+1):
dot=(i,j,k)
if (dot not in set_win)and(dot not in set_lose):
# print(i,j,k)
xinzeng(dot)
set_lose.add(dot)
print(len(set_lose))
print(i)
← Return to game
Comments
Log in with itch.io to leave a comment.
#Here's my code to calculate all must-win or must-lose
#forms in 3d.
set_lose={(0,0,0)}
set_win={(0,1,0),(1,0,0),(0,0,1)}
limit=5
def add_win(i,j,k):
set_win.add((i,j,k))
set_win.add((i,k,j))
set_win.add((k,i,j))
set_win.add((k,j,i))
set_win.add((j,i,k))
set_win.add((j,k,i))
def have_common(a,b):
if a[0]==b[0]:
if a[1]==b[1]:
for i in range(max(a[2],b[2])+1,limit+1):
add_win(a[0],a[1],i)
elif a[2]==b[2]:
for i in range(max(a[1],b[1])+1,limit+1):
add_win(a[0],i,a[2])
else:
if (a[1]>b[1]) and (a[2]<b[2]):
add_win(a[0],a[1],b[2])
if(a[1]<b[1]) and (a[2]>b[2]):
add_win(a[0],b[1],a[2])
elif a[1]==b[1]:
if a[2]==b[2]:
for i in range(max(a[0],b[0])+1,limit+1):
add_win(i,a[1],a[2])
else:
if(a[0]>b[0]) and (a[2]<b[2]):
add_win(a[0],a[1],b[2])
if(a[0]<b[0]) and(a[2]>b[2]):
add_win(b[0],a[1],a[2])
elif a[2]==b[2]:
if(a[0]>b[0]) and (a[1]<b[1]):
add_win(a[0],b[1],a[2])
if(a[0]<b[0]) and (a[1]>b[1]):
add_win(b[0],a[1],a[2])
def xinzeng(dot):
for i in set_lose:
have_common(i,dot)
for i in range(0,limit+1):
for j in range(0,limit+1):
for k in range(0,limit+1):
dot=(i,j,k)
if (dot not in set_win)and(dot not in set_lose):
# print(i,j,k)
xinzeng(dot)
set_lose.add(dot)
print(len(set_lose))
for i in set_lose:
print(i)