private Tuple<Integer, Integer> traceDirection(Set<Tuple<Integer, Integer>> set,
                                                       int board[][], int player,
                                                       int startX, int startY, int dx, int dy) {
            Tuple<Integer, Integer> res = new Tuple<>(0, 0);
            // Return if we are outside the board
            if ((startX >= x || startX < 0) || (startY >= y || startY < 0)) return res;
            int value = board[startX][startY];

            // Add the coordinate
            if (value == player) {
                set.add(new Tuple<>(startX, startY));
                res._1++;
            } else if (value == 0) {
                res._2++;
            }

            // Traverse recursively if the other player is not in the way
            if (value == 0 || value == player) {
                Tuple<Integer, Integer> newRes =
                        traceDirection(set, board, player, startX + dx, startY + dy, dx, dy);
                res._1 += newRes._1;
                res._2 += newRes._2;
            }

            return res;
        }