Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Please note that this program is actually composed of multiple TI-BASIC programs. Any time you see prgmXXXXXXXX without a colon (:) in front of it, that means that what's below it is the source of a separate program named XXXXXXXX.
- Comments can kinda be implemented in TI-BASIC by starting a line with double quotes, and that's how they're done here.
- Support programs (essentially functions) start with ZLIF (Z so they don't appear on the top of my program list, and LIF because they're made for prgmLIFE and I can only have a total of 8 characters in a program name).
- prgmLIFE
- :"WIDTH≤96
- :"HEIGHT≤62
- :
- :prgmZLIFINIT
- :
- :0→X
- :prgmZLIFCHCK
- :prgmZLIFROT
- :
- :While 1=1
- :For(X,1,W-1)
- :
- :If L₄(X+1):Then
- :prgmZLIFCHCK
- :prgmZLIFDRAW
- :0→C
- :END
- :
- :If C≤3
- :prgmZLIFROT
- :C+1→C
- :
- :Pxl-Off(H+2,X)
- :End
- :If P=1
- :Pause
- :End
- prgmZLIFINIT
- :94→W
- :60→H
- :
- :ClrHome
- :Disp "PAUSE EACH FRAME"
- :Disp "(Y,N)"
- :1→Y:0→N
- :Input Q
- :
- :ClrHome
- :Disp "LOAD L₄ and L₅"
- :Disp "(Y,N)"
- :Input L
- :
- :Output(8,1,"INIT. LISTS... ")
- :
- :ClrList L₁
- :ClrList L₂
- :ClrList L₃
- :
- :prgmZLIFLIST
- :
- :Output(8,1,"INIT. L₄, L₅ ")
- :
- :If L=1
- :prgmZLIFFIND
- :
- :Output(8,1,"INITIALIZED ")
- :
- :0→X
- :0→Y
- :Q→P
- prgmZLIFLIST
- :For(A,1,H+1)
- :0→L₁(A)
- :0→L₂(A)
- :0→L₃(A)
- :End
- :
- :For(A,1,W+1)
- :0→L₄(A)
- :End
- :
- :For(A,1,H+1)
- :0→L₅(A)
- :End
- prgmZLIFFIND
- :For(X,0,W-1)
- :For(Y,0,H-1)
- :pxl-Test(Y,X)→A
- :If A=1
- :Goto 0
- :Lbl 1
- :End
- :
- :(X/(W-1))*100→P
- :Output(8,15," ")
- :Output(8,15,iPart(P))
- :
- :End
- :Return
- :
- :
- :
- :Lbl 0
- :X+1→X
- :If X>1
- :1→L₄(X-1)
- :
- :1→L₄(X)
- :
- :If X<W
- :1→L₄(X+1)
- :X-1→X
- :
- :1→L₅(Y+1)
- :Goto 1
- prgmZLIFCHCK
- :0→L₄(X+1)
- :
- :0→Y
- :
- :For(Y,0,H-1)
- :If L₅(Y+1)≤0
- :Goto 1
- :
- :pxl-Test(Y,X)→A
- :If A=1
- :Goto 0
- :Lbl 1
- :End
- :Return
- :
- :
- :
- :Lbl 0
- :H→B
- :
- :Y-1→A
- :prgmZLIFMOD
- :R+1→R
- :L₁(R)+1→L₁(R)
- :L₂(R)+1→L₂(R)
- :L₃(R)+1→L₃(R)
- :
- :Y+1→R
- :L₁(R)+1→L₁(R)
- :L₃(R)+1→L₃(R)
- :
- :Y+1→A
- :prgmZLIFMOD
- :R+1→R
- :L₁(R)+1→L₁(R)
- :L₂(R)+1→L₂(R)
- :L₃(R)+1→L₃(R)
- :
- :If X>0
- :
- :1→L₄(X)
- :1→L₄(X+1)
- :1→L₄(X+2)
- :1→L₄(X+3)
- :Goto 1
- prgmZLIFDRAW
- :X-1→X
- :For(Y,0,H-2)
- :
- :If L₅(Y+1)≤0
- :Goto 2
- :
- :pxl-Test(Y,X)→A
- :
- :If A=0 and L₁(Y+1)=0
- :Goto 2
- :
- :Pxl-Off(Y,X)
- :If A=1
- :Goto 1
- :If A=0
- :Goto 0
- :Lbl 2
- :
- :If A=1:Then
- :If Y>0
- :2→L₅(Y)
- :2→L₅(Y+1)
- :If Y<H
- :2→L₅(Y)
- :End
- :
- :End
- :X+1→X
- :Return
- :
- :
- :
- :Lbl 0
- :0→A
- :If L₁(Y+1)=3
- :Then
- :Pxl-On(Y,X)
- :1→A
- :End
- :Goto 2
- :
- :
- :
- :Lbl 1
- :0→A
- :If (L₁(Y+1)=2) or (L₁(Y+1)=3)
- :Then
- :Pxl-On(Y,X)
- :1→A
- :End
- :Goto 2
- prgmZLIFROT
- :For(A,1,H)
- :
- :If L₅(A)>0
- :Then
- :
- :L₂(A)→L₁(A)
- :L₃(A)→L₂(A)
- :0→L₃(A)
- :End
- :End
- prgmZLIFMOD
- :If A≤0
- :B+A→A
- :
- :remainder(A,abs(B))→R
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement