Im working on a NxN tic tac toe game and making recursive function to check the position.
The recursive function uVertical is working correctly, however, the count++ on dVertical check is not being increment (it the same method as uVertical but it going in the opposite direction).
Please help im totally lost.
//check Up Vertical public static int uVeritcal(int row, int col, int count) { if(row == 0) return count; else if(board[row-1][col].equals("X") && count < 4) { count++; return uVeritcal(--row, col, count); } else return count; } //check down Veritcal This function check the board to see if there 4 X located below the initial location. public static int dVeritcal(int row, int col, int count) { //SOP always return 0 here. if(row == boardSize - 1) { return count; } else if(board[row+1][col].equals("X") && count < 4) { count++; //SOP return 1 return rHorizantal(++row, col, count); } else { return count; } } public static void winner(int move) //move is the location of the board { int row = move / boardSize; int col = move % boardSize; if(uVeritcal(row, col, 0) + dVeritcal(row, col, 0) >= 4) gameOver = true; }