如何修复错误 "Bad Operand Types for Binary Operator '>=' first type: int[] second type int"

How to fix the error "Bad Operand Types for Binary Operator '>=' first type: int[] second type int"

**错误与此行有关:**

if ((board[r + vertical[movenumber]]) <= 8 && board[r + vertical[movenumber]] >= 1)

**整个方法(如果需要):**

public void tour()
{

    int starter = 1;

    int start1 = (int)(Math.random() * 8 - 1) + 1;
    int start2 = (int)(Math.random() * 8 - 1) + 1;

    board[start1][start2] = starter;

    int r = start1;
    int c = start2;

    for (int count = 0; count < board[row].length; count++)
    {

        numb[count] = count;

    }

    for (int runs = 2; runs <= 64; runs++)
    {

        int movenumber = (int)(Math.random() * 8 - 1) + 1;

        if ((board[r + vertical[movenumber]]) <= 8 && board[r + vertical[movenumber]] >= 1)
        {

            if (board[r + vertical[movenumber]][c + horizontal[movenumber]] == 0)
            {

                board[r + vertical[movenumber]][c + horizontal[movenumber]] = runs;

                // System.out.println(r + "," + c);

                r = r + vertical[movenumber];
                c = c + horizontal[movenumber];

            }

        }

    }

}

错误非常具体 - 您正在尝试将数组与 int 进行比较。 board[r + vertical[movenumber]] 表达式是一个数组(或 int[],特别是),因为您的板是 int[][]。要使其成为 int,您需要添加第二个索引,就像您在以下行中所做的那样:board[r + vertical[movenumber]][c + horizontal[movenumber]].

快速浏览一下代码,我认为它应该是 r + vertical[movenumber] <= 8