Jump to content

  • Log In with Google      Sign In   
  • Create Account

Putting pieces inside a board


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
22 replies to this topic

#21 concepts   Members   -  Reputation: 122

Like
0Likes
Like

Posted 19 February 2013 - 02:05 PM

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


Edited by concepts, 19 February 2013 - 02:06 PM.


Sponsor:

#22 concepts   Members   -  Reputation: 122

Like
0Likes
Like

Posted 19 February 2013 - 07:33 PM



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...

#23 concepts   Members   -  Reputation: 122

Like
0Likes
Like

Posted 19 February 2013 - 08:01 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS