Skip to content

Instantly share code, notes, and snippets.

@litiblue
Created August 8, 2014 12:40
Show Gist options
  • Select an option

  • Save litiblue/03e635056c21fdd4a460 to your computer and use it in GitHub Desktop.

Select an option

Save litiblue/03e635056c21fdd4a460 to your computer and use it in GitHub Desktop.
BishopMove
class BishopMove(object):
def howManyMoves(self, r1, c1, r2, c2):
if (r1 + c1) % 2 != (r2 + c2) % 2:
res = -1
else:
res = 2
if r1 + c1 == r2 + c2:
res -= 1
if r1 - c1 == r2 - c2:
res -= 1
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment