|
Post by Almightynam on Feb 25, 2006 19:03:50 GMT -5
I'm getting desparate... I need to make a checkers game, and i'm trying to program jumps for the computer. the code itself isn't wrong, but the loops don't trigger for some reason, and i can't figure out why. I'm basically asking everyone I know on the internet for help, just in case anyone knows java.
here's the code: while (done == false) { for (int i=5;i>=0;i--) { for(int j=7;j<=0;j--) { if (square[j].getColor() == "black" && done == false) { if (j<=5 && square[i+1][j+1].getColor() == "red" && square[i+2][j+2].getColor() == " " && !done) { square[j].moveFrom(); square[j].setColor(" "); square[i+2][j+2].moveTo("black"); square[i+2][j+2].setColor("black"); square[i+1][j+1].moveFrom(); square[i+1][j+1].setColor(" "); countred--; done = true; }
if(j>=2 && square[i+1][j-1].getColor() == "red" && square[i+2][j-2].getColor() == " " && !done) { square[j].moveFrom(); square[j].setColor(" "); square[i+2][j-2].moveTo("black"); square[i+2][j-2].setColor("black"); square[i+1][j-1].moveFrom(); square[i+1][j-1].setColor(" "); countred--; done = true;
} } } }
You need to know double dimentioned arrays and conditionals to make sense out of this, but if ANYONE can figure why the loops aren't triggering please tell me.
|
|
|
Post by Almightynam on Feb 25, 2006 20:28:56 GMT -5
MY CODE WORKS!!! I ACCIDENTALLY HIT LESS THAN SIGN INSTEAD OF THE GREATER THAN SIGN!! I'M SO HAPPY!!!
|
|
|
Post by Gen Gravy on Feb 25, 2006 20:29:38 GMT -5
.... w00t?
|
|
|
Post by Almightynam on Feb 25, 2006 20:37:39 GMT -5
yes a w00t is in order.
|
|
|
Post by Gen Gravy on Feb 25, 2006 20:45:08 GMT -5
Ah, what the hell? Why not make it two w00ts?
|
|
|
Post by Kyle20 on Feb 25, 2006 21:12:58 GMT -5
I thought two w00ts were two too many! What is this?!
And Nam, mistakes won't get you everywhere.
(Ninjas aren't the only ones who proofread.)
|
|
|
Post by Almightynam on Feb 25, 2006 21:16:20 GMT -5
Kyle, you just butchered the english language with your third sentence. "Wont get your everywhere" come on, I expect that from Tim or Silos, but not you. Get your head in the game
|
|
|
Post by Gen Gravy on Feb 25, 2006 21:19:02 GMT -5
Don't blame him, he hasn't even hit puberty yet. At least... I don't think 6th graders are supposed to...
|
|
|
Post by Kyle20 on Feb 25, 2006 21:34:19 GMT -5
-_-'
Nam: Since when did you become the proof-reading ninja again?
Gen: For the quick, brief FYI, I have hit puberty. It started awhile ago actually...I was the first 11 year (Well, I was 10 or 9 back then) old on my block to hit it....Let's skip the topic
|
|
|
Post by Gen Gravy on Feb 25, 2006 21:36:10 GMT -5
Kyle, I really, really didn't need to know that. The only thing more awkward than that, was when I had a discussion with Silos about his problems staring at inappropriate places.
|
|
|
Post by Kyle20 on Feb 25, 2006 21:37:44 GMT -5
I had a bad feeling about even bringing up the w00t thing. It never gets me anywhere....
I thought nothing about Silos phased you.
|
|
|
Post by silos on Feb 25, 2006 21:42:45 GMT -5
Kyle: I was the one who proofread it.
Gen: Rehab good?
|
|
|
Post by Kyle20 on Feb 25, 2006 21:44:15 GMT -5
I see...wasn't expecting that. Wait, I thought you were the NOOB Wrangler. Are you titling yourself higher than me?
|
|
|
Post by silos on Feb 25, 2006 21:45:02 GMT -5
I just hate bad grammar.
|
|
|
Post by Almightynam on Feb 25, 2006 21:46:17 GMT -5
OMG!!! My job has been usurped... BY A PIRATE!!
|
|