SHARE
TWEET

Untitled

a guest May 25th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. G, J = [[1 if j < 2 else 0 for i in range(4)] for j in range(4)], 1
  2. def disp(g): print(" | ".join(map(lambda x: str(x), g)))
  3. def tour(J, G):
  4.   list(map(disp, G))
  5.   print('Tour de J ', J)
  6.   a, b, c, d = tuple(map(lambda x: int(x), input('> ').split(' ')))
  7.   dx, dy, sd = abs(a-c), abs(b-d), abs(a-c)+abs(b-d)
  8.   if 0<=a<4 and 0<=b<4 and 0<=c<4 and 0<=d<4 and (((dx==0 and dy==2) or (dx==2 and dy==0)) \
  9.     and G[(b+d)//2][(a+c)//2]==J and G[d][c]==int(not J)) or (sd==1 and G[b][a]==J and G[d][c]==' '):
  10.     G[b][a], G[d][c] = ' ', J
  11.   else: tour(J, G)
  12. while sum(map(sum,[list(map(lambda x:0 if type(x)==str else x,G[i])) for i in range(4)]))>=2 and \
  13.   sum(map(sum, [list(map(lambda x:0 if type(x)==str else not x,G[i])) for i in range(4)]))>=2:
  14.   u, J = tour(J, G), int(not J)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top