Hello fellow coders,
I am currently taking a C++ class and have a final project due very soon. We are recreating the game Othello/Reversi using the console.
So far I haven't run into really any problems and it hasn't been too bad. I have almost all of it complete except for checking the diagonals for valid pieces to flip/capture.
I have it down to check rows and columns (North, South, East, West) perfectly, but I just can't seem to figure out how to get the diagonals to work. I tried using two for-loops (one nested) to check up one "square" and right one square for example to the North East. However, it checks one square to the north and then all of the squares to the east/right before going one more to the north again. (Since the east for-loop is nested it executes completely)
So basically, I need a little guidance on what to do to check diagonals. Pseudocode is perfectly fine with me as long as I understand what you're saying. :P
I have an 8x8 board that is stored in the array board[row][col].
Anyone have any ideas?
Thanks!