Connect 4 Win Checks!

So a Connect 4 board is 6 rows and 7 columns, I want horizontal, vertical, and diagonal win condition checks. So far I have horizontal wins checker.

bool hwin(){
for(int r=0; r<6; r++){
for (int c=0; c<7;c++){
if ((board [r][c] == 'X'||board [r][c] == 'O')&&
board[r][c] == board[r+1][c]&&
board[r][c+1] == board[r+2][c]&&
board[r][c+2] == board[r+3][c]&&
board[r][c+3] == board[r+4][c]&&
board[r][c+4] == board[r+5][c]&&
board[r][c+5] == board[r+6][c]&&
board[r][c+6] == board[r+7][c]&&
)
return true;
}

}
return false;
}

How do I get diagonal and vertical using this format?
Sorry I can't fix the tabs on this website.
Last edited on
Topic archived. No new replies allowed.