HP Prime Cellular Automaton « Next Oldest | Next Newest »

 ▼ CompSystems Member Posts: 213 Threads: 60 Joined: Mar 2013 09-04-2013, 08:56 AM more info Video: http://www.youtube.com/watch?feature=player_embedded&v=imWvQHUjt2I Code: Quote: CADraw(Pop,Y,Color) BEGIN LOCAL I; FOR I FROM 1 TO 320 DO PIXON_P(I-1,Y,Color(Pop(I)+1)); END; END; CARun(Rule,Pop) BEGIN LOCAL Color,Sum,I,J,A,B,C; Color:={RGB(0,0,0),RGB(255,0,0),RGB(0,255,0),RGB(0,0,255)}; RECT(); CADraw(Pop,0,Color); FOR J FROM 1 TO 239 DO A:=Pop(320); B:=Pop(1); C:=Pop(2); // offset sum to avoid addition at rule access Sum:=A+B+C+1; Pop(1):=Rule(Sum); FOR I FROM 2 TO 319 DO Sum:=Sum-A; A:=B; B:=C; C:=Pop(I+1); Sum:=Sum+C; Pop(I):=Rule(Sum); END; Sum:=Sum-A+Pop(1); Pop(320):=Rule(Sum); CADraw(Pop,J,Color); END; FREEZE; END; EXPORT CA2D(Rule,Pop) BEGIN IF SIZE(Rule)#10 THEN MSGBOX("Rule must be list of size 10 "); ELSE IF SIZE(Pop)#320 THEN MSGBOX("Pop must be list of size 320"); ELSE CARun(Rule,Pop); END; END; END; EXPORT Rule1() BEGIN RETURN {0,1,2,0,1,3,3,2,3,0}; END; EXPORT Rule2() BEGIN RETURN {0,1,2,0,3,0,2,2,3,0}; END; // there are many more interesting rules // ... Pop1X(V) BEGIN LOCAL Pop; Pop:=MAKELIST(0,K,1,320,1); Pop(160):=V; RETURN Pop; END; EXPORT PopR() BEGIN RETURN MAKELIST(RANDINT(0,3),K,1,320,1); END; EXPORT Pop1() BEGIN RETURN Pop1X(1); END; EXPORT Pop2() BEGIN RETURN Pop1X(2); END; EXPORT Pop3() BEGIN RETURN Pop1X(3); END; In Basic Request for HP 0: On the catalog of programs, if a program contains n subroutines visible (export) allow explore with right cursor key 1: allow certain properties as read only etc 2; command to make a scroll over the image and accessed from HOME or CAS (~ PICTURE hp48/50) Edited: 4 Sept 2013, 10:39 a.m.

Forum Jump: