Page 1 of 1

Java help!? sorry :P

Posted: Tue Aug 16, 2011 9:41 am
by Rebornxeno
Hello everyone! I have a problem and I'm not quite sure why it's a problem. Here is the code that is giving me a problem

Code: Select all

	private void analyzeImage(BufferedImage i){
		for (int y = 0; y == rect.height; y++){
			for (int x = 0; x == rect.width; x++){
				robot.getPixelColor(x, y);
			}
		}
	}
For some reason, nothing runs inside for(blah){}
No errors, no nothing. rect.height and rect.width are not 0. Maybe I'm a bit too stoned to see whats wrong but this is driving me insane!! Could somebody please help me?
Nothing is happening for me inside the for loops :(

Re: Java help!? sorry :P

Posted: Tue Aug 16, 2011 9:48 am
by Falco Girgis
It's because y == rect.height and x == rect.width are never true.

It should be for(int y = 0; y < rect.height; y++) and for(int x = 0; x < rect.width; x++);

The loop executes WHILE the middle term is true, not UNTIL the middle term is true.

And I've only met one person ever who can write good code while high on that hippie ass shit. If you want to be decadent and productive simultaneously, pop adderall or do lines of coke, because weed just makes you dumb. ;)

Re: Java help!? sorry :P

Posted: Tue Aug 16, 2011 9:51 am
by Rebornxeno
I lol'd just then. Thank you *embarassed*