Wow tried putting this program in the HP Guide: - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Wow tried putting this program in the HP Guide: (/thread-12989.html) Wow tried putting this program in the HP Guide: - tom234 - 05-19-2019 01:51 PM Program Listing local x1:=160, x2:=299, x3:=21 local y1:=0, y2:=240, y3:=240 local xn:=160, yn:=0; local a, b, color; EXPORT Sierpinski() BEGIN RECT(); FOR a FROM 1 TO 10000 STEP 1 DO b:=RANDINT(2)+1; CASE IF b=1 THEN xn:=(xn+x1)/2; yn:=(yn+y1)/2;END; IF b=2 THEN xn:=(xn+x2)/2; yn:=(yn+y2)/2;END; IF b=3 THEN xn:=(xn+x3)/2; yn:=(yn+y3)/2;END; END; color:=RGB(255-a/40,0,a/40); PIXON_P(IP(xn),IP(yn),color); END; WAIT; END; ///// Well, it didn't work couldn't get by line 2 with an error code? RE: Wow tried putting this program in the HP Guide: - Wes Loewer - 05-19-2019 02:21 PM Line 2 is missing semicolons before the LOCAL keywords; Code: `local x1:=160, x2:=299, x3:=21; local y1:=0, y2:=240, y3:=240; local xn:=160, yn:=0;` or more aesthetically pleasing Code: ```local x1:=160, x2:=299, x3:=21; local y1:=0, y2:=240, y3:=240; local xn:=160, yn:=0;``` Or just put all 8 variables in one LOCAL declaration. Code: `local x1:=160, x2:=299, x3:=21, y1:=0, y2:=240, y3:=240, xn:=160, yn:=0;` Eight is the max though. If you have more than eight, you have to split them into separate LOCAL statements. I couldn't find this program in the User Guide. What page is it on? RE: Wow tried putting this program in the HP Guide: - DrD - 05-19-2019 02:42 PM Code: ``` local x1:=160, x2:=299, x3:=21; local y1:=0, y2:=240, y3:=240; local xn:=160, yn:=0; local a, b, color; EXPORT Sierpinski() BEGIN   RECT();   FOR a FROM 1 TO 10000 STEP 1 DO     b:=RANDINT(2)+1;    CASE      IF b=1 THEN xn:=(xn+x1)/2; yn:=(yn+y1)/2;END;      IF b=2 THEN xn:=(xn+x2)/2; yn:=(yn+y2)/2;END;      IF b=3 THEN xn:=(xn+x3)/2; yn:=(yn+y3)/2;END;    END;     color:=RGB(255-a/40,0,a/40);    PIXON_P(IP(xn),IP(yn),color);   END;   WAIT; END;``` RE: Wow tried putting this program in the HP Guide: - DrD - 05-19-2019 02:57 PM How about 10 of them? Code: ``` local x1:=160, x2:=299, x3:=21; local y1:=0, y2:=240, y3:=240; local xn:=160, yn:=0; local a, b, color; EXPORT Sierpinski() BEGIN   RECT();   FOR N FROM 1 TO 10 DO     FOR a FROM 1 TO 10000 STEP 1 DO       b:=RANDINT(2)+1;      CASE        IF b=1 THEN xn:=(xn+x1)/2; yn:=(yn+y1)/2;END;        IF b=2 THEN xn:=(xn+x2)/2; yn:=(yn+y2)/2;END;        IF b=3 THEN xn:=(xn+x3)/2; yn:=(yn+y3)/2;END;      END;       color:=RGB(255-a/40,0,a/40);      PIXON_P(IP(xn),IP(yn),color);     END;     WAIT(2);   END;   END;``` RE: Wow tried putting this program in the HP Guide: - tom234 - 05-19-2019 04:44 PM (05-19-2019 02:57 PM)DrD Wrote:  How about 10 of them? Code: ``` local x1:=160, x2:=299, x3:=21; local y1:=0, y2:=240, y3:=240; local xn:=160, yn:=0; local a, b, color; EXPORT Sierpinski() BEGIN   RECT();   FOR N FROM 1 TO 10 DO     FOR a FROM 1 TO 10000 STEP 1 DO       b:=RANDINT(2)+1;      CASE        IF b=1 THEN xn:=(xn+x1)/2; yn:=(yn+y1)/2;END;        IF b=2 THEN xn:=(xn+x2)/2; yn:=(yn+y2)/2;END;        IF b=3 THEN xn:=(xn+x3)/2; yn:=(yn+y3)/2;END;      END;       color:=RGB(255-a/40,0,a/40);      PIXON_P(IP(xn),IP(yn),color);     END;     WAIT(2);   END;   END;``` ///// It works thank you know I know it's me. RE: Wow tried putting this program in the HP Guide: - cyrille de brĂ©bisson - 05-20-2019 04:43 AM Hello, export Sier2() begin rect; local a=#0; while a<#160 do local b= #0; while b<#160 do pixon_p(a and b, a or b, 0); b:= b+#1; end; a:= a+#1; end; freeze; end; Cyrille