Advertisement
TimJSwan

Tim Swan's SNAKE2 in ti-Basic

Mar 28th, 2015
1,535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. ClrHome
  2. 4→X
  3. 4→Y
  4. {8,16→dim([A]
  5. Fill(0,[A]
  6. DelVar L₁
  7. DelVar L₂
  8. 15→L
  9. For(A,1,L
  10. X→L₁(A
  11. Y→L₂(A
  12. End
  13. L→M
  14. 0→D
  15. 1→C
  16. While 1
  17. randInt(0,9→B
  18. If not(B
  19. Then
  20. randInt(1,8→T
  21. randInt(1,16→S
  22. If [A](T,S)=0
  23. Then
  24. 2→[A](T,S
  25. Output(T,S,".
  26. End
  27. End
  28. Output(Y,X,"O
  29. 1→[A](Y,X
  30. getKey→A
  31. If A=26
  32. 0→D
  33. If A=24
  34. 1→D
  35. If A=34
  36. 2→D
  37. If A=25
  38. 3→D
  39. If D=0
  40. X+1→X
  41. If D=1
  42. X-1→X
  43. If D=2
  44. Y+1→Y
  45. If D=3
  46. Y-1→Y
  47. If X=17
  48. 1→X
  49. If X=0
  50. 16→X
  51. If Y=9
  52. 1→Y
  53. If Y=0
  54. 8→Y
  55. X→L₁(C
  56. Y→L₂(C
  57. If [A](Y,X)=1
  58. Then
  59. Disp "DEATH
  60. Disp "LENGTH:
  61. Disp M
  62. Stop
  63. End
  64. If [A](Y,X)=2
  65. Then
  66. M+1→M
  67. End
  68. If C>L
  69. C→L
  70. C+1→C
  71. C→F
  72. If F>L
  73. 1→F
  74. If C>M
  75. 1→C
  76. Output(L₂(F),L₁(F),"
  77. 0→[A](L₂(F),L₁(F)
  78. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement