Moving diagonally (Chess) logic

Started by
0 comments, last by Tom Sloper 11 years, 9 months ago
Hey everyone, I'm writing a simple chess clone and I'm not sure how to implement the diagonal moving. I already made the Pawn, Knight, and Rook, but I'm having trouble on figuring out the diagonal moving through a 2d array. Anyone have an algorithm or guide on implementing diagonal moves? Thanks! (I'm working on the Bishop now)


EDIT: A shower later and I just realized the same way I did the attacking for the Pawn is how I would do the diagonals for the Bishops. Sometimes typing the question out and a nice shower helps get the brain working haha! Thanks anyway!
Advertisement
I agree. Showers are excellent thinking stimulators.

-- Tom Sloper -- sloperama.com

This topic is closed to new replies.

Advertisement