Advertisement
TimJSwan

Tim Swan's LIGHTOUT in ti-Basic

Mar 28th, 2015
697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. ClrHome
  2. Prompt D
  3. ClrHome
  4. {4,8→dim([A]
  5. {4,8→dim([B]
  6. Fill(0,[A]
  7. Fill(0,[B]
  8. 1→X
  9. 1→Y
  10. 1→S
  11. 1→T
  12. 0→G
  13. For(A,1,4
  14. For(B,1,8
  15. Output(1+(A-1)2,1+(B-1)2,0
  16. End
  17. End
  18. For(C,–D,0
  19. randInt(1,8→X
  20. randInt(1,4→Y
  21. If C
  22. Goto A
  23. While 1
  24. If Y≠T≠S
  25. Then
  26. Output(T2-1,S2,"
  27. Output(T2,S2-1,"
  28. End
  29. Output(Y2-1,X2,")
  30. Output(Y2,X2-1,"U
  31. getKey→A
  32. X→S
  33. Y→T
  34. If A=26
  35. X+1→X
  36. If A=24
  37. X-1→X
  38. If A=25
  39. Y-1→Y
  40. If A=34
  41. Y+1→Y
  42. If X=9
  43. 1→X
  44. If Y=5
  45. 1→Y
  46. If X=0
  47. 8→X
  48. If Y=0
  49. 4→Y
  50. If A=31
  51. Then
  52. not(G→G
  53. For(E,1,8
  54. For(F,1,4
  55. If [B](F,E) and G
  56. Then
  57. Output(F2,E2,":
  58. Else
  59. Output(F2,E2,"
  60. End
  61. End
  62. End
  63. End
  64. If A=21
  65. Then
  66. Lbl A
  67. not([B](Y,X→[B](Y,X)
  68. If G
  69. Then
  70. If [B](Y,X
  71. Then
  72. Output(Y2,X2,":
  73. Else
  74. Output(Y2,X2,"
  75. End
  76. End
  77. not([A](Y,X→B
  78. B→[A](Y,X
  79. Output(1+(Y-1)2,1+(X-1)2,B
  80. If X-1≥1
  81. Then
  82. not([A](Y,X-1→B
  83. B→[A](Y,X-1
  84. Output(1+(Y-1)2,1+(X-2)2,B
  85. End
  86. If X+1≤8
  87. Then
  88. not([A](Y,X+1→B
  89. B→[A](Y,X+1
  90. Output(1+(Y-1)2,1+X2,B
  91. End
  92. If Y-1≥1
  93. Then
  94. not([A](Y-1,X→B
  95. B→[A](Y-1,X
  96. Output(1+(Y-2)2,1+(X-1)2,B
  97. End
  98. If Y+1≤4
  99. Then
  100. not([A](Y+1,X→B
  101. B→[A](Y+1,X
  102. Output(1+Y2,1+(X-1)2,B
  103. End
  104. End
  105. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement