frankb
YaBB Newbies
Offline
Posts: 44
Re: if statement
Reply #2 - Jul 2nd , 2006, 5:21pm
oops... thanks a bunch. I'm having a new problem that some one might be able to help with i'm sure it's realy simple and i'm new to processing so I havn't figured out all it's littel habbits yet. I want the denominator in the fraction that is deriving my numeric sequence to be changing value based on a function. Every thing was working fine before I added this capability. I have included both the working and not working code in this post any help would be awsome. just so you know it's suposed to draw a box depending on if the sequence shows a zero or a one. NOT WORKING CODE size(500, 2000);//setup int start = 1;//number to start loop on //primary loop for (int counta=start; counta<200; counta=counta+1){ //formula to derive numeric sequence int denominator = counta+5; int intcount = counta/denominator; println(denominator); //create a string of binary value String test = binary(intcount); float dec = counta%denominator; // Seperate the decimal int dec2 = int(dec); //convert to dec String decbin = binary(dec2); //place dec in string println(decbin); //varable to controle number of sub loops int limit = test.length(); //whole number draw for (int count=start; count<limit; count=count+1){ char test1 = test.charAt(count);//count through string print("test1:"); print(test1); println(" "); int limit2 = decbin.length();//dec loop amount //dec draw for (int count2=start;count2<limit2; count2=count2+1){ char testdec = decbin.charAt(count2);//count through string print("testdec:"); print(testdec); println(" "); int movea = count2*10; int movedown = movea; int moveb = counta*10; int moveright = moveb; println(moveright); println(movedown); if(testdec == '1'){ //where i am having a problem. fill(204,102,0); rect(movedown,moveright,10,10); println("square is drawn"); } if(testdec == '0'){ fill(153); rect(movedown,moveright,10,10); println("square is drawn"); } } } } WORKING CODE but no function for denominator size(500, 2000);//setup int start = 0;//number to start loop on //primary loop for (int counta=start; counta<200; counta=counta+1){ //formula to derive numeric sequence int intcount = counta/13; //create a string of binary value String test = binary(intcount); float dec = counta%13; // Seperate the decimal int dec2 = int(dec); //convert to dec String decbin = binary(dec2); //place dec in string println(decbin); //varable to controle number of sub loops int limit = test.length(); //whole number draw for (int count=start; count<limit; count=count+1){ char test1 = test.charAt(count);//count through string print("test1:"); print(test1); println(" "); int limit2 = decbin.length();//dec loop amount //dec draw for (int count2=start;count2<limit2; count2=count2+1){ char testdec = decbin.charAt(count2);//count through string print("testdec:"); print(testdec); println(" "); int movea = count2*10; int movedown = movea; int moveb = counta*10; int moveright = moveb; println(moveright); println(movedown); if(testdec == '1'){ //where i am having a problem. fill(204,102,0); rect(movedown,moveright,10,10); println("square is drawn"); } if(testdec == '0'){ fill(153); rect(movedown,moveright,10,10); println("square is drawn"); } } } }