Advertisement
TehVulpes

TI Life

Jul 24th, 2013
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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.
  2.  
  3. Comments can kinda be implemented in TI-BASIC by starting a line with double quotes, and that's how they're done here.
  4.  
  5. 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).
  6.  
  7. prgmLIFE
  8. :"WIDTH≤96
  9. :"HEIGHT≤62
  10. :
  11. :prgmZLIFINIT
  12. :
  13. :0→X
  14. :prgmZLIFCHCK
  15. :prgmZLIFROT
  16. :
  17. :While 1=1
  18. :For(X,1,W-1)
  19. :
  20. :If L₄(X+1):Then
  21. :prgmZLIFCHCK
  22. :prgmZLIFDRAW
  23. :0→C
  24. :END
  25. :
  26. :If C≤3
  27. :prgmZLIFROT
  28. :C+1→C
  29. :
  30. :Pxl-Off(H+2,X)
  31. :End
  32. :If P=1
  33. :Pause
  34. :End
  35.  
  36.  
  37.  
  38. prgmZLIFINIT
  39. :94→W
  40. :60→H
  41. :
  42. :ClrHome
  43. :Disp "PAUSE EACH FRAME"
  44. :Disp "(Y,N)"
  45. :1→Y:0→N
  46. :Input Q
  47. :
  48. :ClrHome
  49. :Disp "LOAD L₄ and L₅"
  50. :Disp "(Y,N)"
  51. :Input L
  52. :
  53. :Output(8,1,"INIT. LISTS...  ")
  54. :
  55. :ClrList L₁
  56. :ClrList L₂
  57. :ClrList L₃
  58. :
  59. :prgmZLIFLIST
  60. :
  61. :Output(8,1,"INIT. L₄, L₅    ")
  62. :
  63. :If L=1
  64. :prgmZLIFFIND
  65. :
  66. :Output(8,1,"INITIALIZED     ")
  67. :
  68. :0→X
  69. :0→Y
  70. :Q→P
  71.  
  72.  
  73.  
  74. prgmZLIFLIST
  75. :For(A,1,H+1)
  76. :0→L₁(A)
  77. :0→L₂(A)
  78. :0→L₃(A)
  79. :End
  80. :
  81. :For(A,1,W+1)
  82. :0→L₄(A)
  83. :End
  84. :
  85. :For(A,1,H+1)
  86. :0→L₅(A)
  87. :End
  88.  
  89.  
  90.  
  91. prgmZLIFFIND
  92. :For(X,0,W-1)
  93. :For(Y,0,H-1)
  94. :pxl-Test(Y,X)→A
  95. :If A=1
  96. :Goto 0
  97. :Lbl 1
  98. :End
  99. :
  100. :(X/(W-1))*100→P
  101. :Output(8,15,"   ")
  102. :Output(8,15,iPart(P))
  103. :
  104. :End
  105. :Return
  106. :
  107. :
  108. :
  109. :Lbl 0
  110. :X+1→X
  111. :If X>1
  112. :1→L₄(X-1)
  113. :
  114. :1→L₄(X)
  115. :
  116. :If X<W
  117. :1→L₄(X+1)
  118. :X-1→X
  119. :
  120. :1→L₅(Y+1)
  121. :Goto 1
  122.  
  123.  
  124.  
  125. prgmZLIFCHCK
  126. :0→L₄(X+1)
  127. :
  128. :0→Y
  129. :
  130. :For(Y,0,H-1)
  131. :If L₅(Y+1)0
  132. :Goto 1
  133. :
  134. :pxl-Test(Y,X)→A
  135. :If A=1
  136. :Goto 0
  137. :Lbl 1
  138. :End
  139. :Return
  140. :
  141. :
  142. :
  143. :Lbl 0
  144. :H→B
  145. :
  146. :Y-1→A
  147. :prgmZLIFMOD
  148. :R+1→R
  149. :L₁(R)+1→L₁(R)
  150. :L₂(R)+1→L₂(R)
  151. :L₃(R)+1→L₃(R)
  152. :
  153. :Y+1→R
  154. :L₁(R)+1→L₁(R)
  155. :L₃(R)+1→L₃(R)
  156. :
  157. :Y+1→A
  158. :prgmZLIFMOD
  159. :R+1→R
  160. :L₁(R)+1→L₁(R)
  161. :L₂(R)+1→L₂(R)
  162. :L₃(R)+1→L₃(R)
  163. :
  164. :If X>0
  165. :
  166. :1→L₄(X)
  167. :1→L₄(X+1)
  168. :1→L₄(X+2)
  169. :1→L₄(X+3)
  170. :Goto 1
  171.  
  172.  
  173.  
  174. prgmZLIFDRAW
  175. :X-1→X
  176. :For(Y,0,H-2)
  177. :
  178. :If L₅(Y+1)0
  179. :Goto 2
  180. :
  181. :pxl-Test(Y,X)→A
  182. :
  183. :If A=0 and L₁(Y+1)=0
  184. :Goto 2
  185. :
  186. :Pxl-Off(Y,X)
  187. :If A=1
  188. :Goto 1
  189. :If A=0
  190. :Goto 0
  191. :Lbl 2
  192. :
  193. :If A=1:Then
  194. :If Y>0
  195. :2→L₅(Y)
  196. :2→L₅(Y+1)
  197. :If Y<H
  198. :2→L₅(Y)
  199. :End
  200. :
  201. :End
  202. :X+1→X
  203. :Return
  204. :
  205. :
  206. :
  207. :Lbl 0
  208. :0→A
  209. :If L₁(Y+1)=3
  210. :Then
  211. :Pxl-On(Y,X)
  212. :1→A
  213. :End
  214. :Goto 2
  215. :
  216. :
  217. :
  218. :Lbl 1
  219. :0→A
  220. :If (L₁(Y+1)=2) or (L₁(Y+1)=3)
  221. :Then
  222. :Pxl-On(Y,X)
  223. :1→A
  224. :End
  225. :Goto 2
  226.  
  227.  
  228.  
  229. prgmZLIFROT
  230. :For(A,1,H)
  231. :
  232. :If L₅(A)>0
  233. :Then
  234. :
  235. :L₂(A)→L₁(A)
  236. :L₃(A)→L₂(A)
  237. :0→L₃(A)
  238. :End
  239. :End
  240.  
  241.  
  242.  
  243. prgmZLIFMOD
  244. :If A≤0
  245. :B+A→A
  246. :
  247. :remainder(A,abs(B))→R
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement