Putting pieces inside a board

Started by
21 comments, last by concepts 11 years, 1 month ago

the problem has to do with the rotate method that doesn't update the shape...

do you know how i can fix this, because I don't know which method I have to change.

freezes.jpg

Advertisement



ok so the problem is in this:

public static boolean legalDown(int currentX, int currentY, int[][] board, int[][] shape)
    {
       int x = currentY+1;
       int y = currentX;




       //printArray(board);





       if (x > 28)
       {


           return legalDownSpec(currentX, currentY, board, shape);



       }

       for (int row = 0; row < 4; row++)
       {
           for(int col = 0; col < 4; col++)
           {


               if (shape[row][col] == 1 && board[x+row][y+col] == 0)
               {


               }
               else
               {
                   if (shape[row][col] == 0 && board[x+row][y+col] == 1)
                   {

                   }
                   else
                   {

                       if (shape[row][col] ==0 && board[x+row][y+row] == 0)
                       {

                       }

                       else
                       {
                       System.out.println("NOT spec");

                       return false;
                       }
                   }
               }
           }
       }




        return true;
    }


I get: notspec like 6 times when it should have been only 1; furthermore, it stops a block before it should... What is the problem? I need an expert here...

Can someone tell me how I can do this:

a = getContents();
b = board.getContents();

Inside of:

    public static boolean legalDown(int currentX, int currentY, int[][] board, int[][] shape)
    {
       int x = currentY+1;
       int y = currentX;




       printArray(board);





       if (x > 28)
       {


           return legalDownSpec(currentX, currentY, board, shape);



       }

       for (int row = 0; row < 4; row++)
       {
           for(int col = 0; col < 4; col++)
           {


               if (shape[row][col] == 1 && board[x+row][y+col] == 0)
               {


               }
               else
               {
                   if (shape[row][col] == 0 && board[x+row][y+col] == 1)
                   {

                   }
                   else
                   {

                       if (shape[row][col] ==0 && board[x+row][y+row] == 0)
                       {

                       }

                       else
                       {
                       System.out.println("NOT spec");

                       return false;
                       }
                   }
               }
           }
       }




        return true;
    }


I need to update the variables..., but I can't since the method is static, but doing so would fix the problem.

This topic is closed to new replies.

Advertisement