Advertisement
vasil_k_k

Pawn Wars croped edition

Oct 3rd, 2023 (edited)
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. g = {k: (8 - r, c // 2 + 1) for r in range(8) for c, k in enumerate(input()) if k in 'bw'}
  2. p, i = ("White", "b") if (g['b'][0] - g['w'][0]) % 2 == 1 else ("Black", "w")
  3. if abs(g['b'][1] - g['w'][1]) == 1 and g['b'][0] > g['w'][0]:
  4.     quit(print(f"Game over! {p} win, capture on {chr(96 + g[i][1])}{g['b'][0] - (g['b'][0] - g['w'][0]) // 2}."))
  5. p, i, n = ("White", "w", 8) if g['b'][0] > 8 - g['w'][0]  else ("Black", "b", 1)
  6. print(f"Game over! {p} pawn is promoted to a queen at {chr(96 + g[i][1])}{n}.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement