Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By doWhile

Thread: [Help]

  1. #1
    jtmnf is offline Member
    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    Default [Help]

    I need help... I'm doing Bejeweled in JAVA, but I need help to overpass a problem...

    When I start the board for the first time, I cannot have 3 or more pieces of the same color, but my function "verifica_inicio" it's not doing the work that it should have :S

    Can anyone help me?

    pos_x/pos_y is the position in the matrix
    fig_aleat is the random piece that is randomized at the moment

    Java Code:
    	  public int verifica_inicio(int fig_aleat,int pos_x,int pos_y){
              if(pos_x<2 && pos_y<2){
                      return 1;
              }
             
              if(pos_x<2){
                      if((fig_aleat!=matriz[pos_x][pos_y-1] || fig_aleat!=matriz[pos_x][pos_y-2])){
                              return 1;
                      }
              }
             
              if (pos_y<2){
                      if(fig_aleat!=matriz[pos_x-1][pos_y] || fig_aleat!=matriz[pos_x-2][pos_y]){
                              return 1;
                      }
              }
             
              if(fig_aleat!=matriz[pos_x-1][pos_y] || fig_aleat!=matriz[pos_x-2][pos_y]){
                  if((fig_aleat!=matriz[pos_x][pos_y-1] || fig_aleat!=matriz[pos_x][pos_y-2])){
                          return 1;
                  }
              }
              
              return 0;
      }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default Re: [Help]

    Please read faq's on how to ask better questions. For one, please do not cross-post your questions to other sites without notifying us that you've done so, unless you don't respect our desire not to waste our free time. Next, please go to advanced editing to change the heading of your question to one that summarizes your problem. "Help" tells us nothing about what problem you're having. Next tell the details of your problem. Assume that we can't read minds and that we don't know what your code should be doing or how specifically it's misbehaving.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: [Help]

    Moved from the Entertainment section. Nothing entertaining about it.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •