Skip to content

Instantly share code, notes, and snippets.

@jakobkogler
Created December 22, 2014 14:32
Show Gist options
  • Save jakobkogler/0baf842da6f1a28b517f to your computer and use it in GitHub Desktop.
Save jakobkogler/0baf842da6f1a28b517f to your computer and use it in GitHub Desktop.
move_count_555
global count
count = 0
def f(depth, depth_left, axis_of_last_move, last_slice, slice1, slice2, slice3, slice4):
if depth_left == 0:
global count
count+=1
else:
for axis in range(3):
if axis == axis_of_last_move:
r = range(last_slice + 1, 5)
else:
r = range(5)
for slice in r:
for num in range(3):
if axis != axis_of_last_move:
f(depth, depth_left-1, axis, slice, num, -1, -1, -1)
else:
if slice4 >= 0:
continue
if slice3 >= 0:
if slice1==slice2==slice3 or slice1==slice2==num or slice1==slice3==num or slice2==slice3==num:
continue
if slice2 >= 0:
if slice1==slice2==num:
continue
f(depth, depth_left-1, axis, slice, num, slice1, slice2, slice3)
for d in range(6):
count = 0
f(d, d, -1, -1, -1, -1, -1, -1)
print(d, count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment