hilyete
Active Member
- Joined
- Aug 19, 2009
- Messages
- 293
My project has a "Checkerboard" with 8 columns x 8 Rows. Each "square" is numbered (1 to 64). I need to be able to determine how many diagonal spaces there are going up to the left from any space chosen on the board. So, for example, if square 30 is chosen, there would be 3 squares diagonally left: 21, 12, 3. Obviously there is a pattern of -9 from one to the next. But is there a formula that would calculate the number of diagonal spaces, staying inside the board? If I chose 64, there would be 7 spaces, but if I chose 26, there would be only 1. I can see there are patterns to this, but can't come up with a formula to do it. Can anyone help me out?