Advertisement
Guest User

prgmCYCLONE (Commented)

a guest
Jan 17th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. prgmCYCLONE
  2. WRITTEN BY: Toothless the Night Fury
  3. LANGUAGE: TI-BASIC
  4. TOTAL BYTES: 304 (not including comments)
  5.  
  6. //SETUP (Clear homescreen, delete A, set B to 1 for first loop)
  7. :ClrHome
  8. :DelVar A
  9. :1 → B
  10.  
  11. :Output(2,3,"-----^------
  12.  
  13. //DISPLAY LOOP
  14. :For(A,3,6
  15. :"! // Stores "!" to Ans, a very fast variable and should be used as often as possible.
  16. :Output(A,2,Ans //Outputs an "!" from (2,3) to (2,6)
  17. :Output(A,15,Ans //Outputs an "!" at (A,15), where A=3 to 6.
  18. :End
  19.  
  20. :Output(7,3,"------------
  21.  
  22. //LOOP 1. This loop is separate because it starts at a specific location.
  23. :For(A,9,15
  24. :Output(B,A,"o // Outputs an "o" at (B,A), where B=1 and A=9 to 15.
  25. :rand(5 // Delays the symbol
  26. :getKey → K // Stores getKey to K and Ans, but Ans is faster.
  27. :If Ans=105 // If player pressed Enter.
  28. :Goto A // Leaps out of loop to bottom. WARNING: Incorrect usage leads to memory leaks. Here is okay because the program ends soon after it leaps out.
  29. :Output(B,A,"_ // Outputs a "_" where the o is.
  30. :End
  31.  
  32. //MAIN LOOP: Repeats the two nested loops.
  33. :While 1 // Loops infinity. Loop is ended by the "Goto A".
  34.  
  35. :For(B,1+7(A=1),7-5(A=1),1-2(A=1 // Uses Boolean logic to combine two loops into one. If A does not equal 1, B=1 to B=7. If A=1, B=7 to B=2. The For( loops an additional time for an unknown reason, which is why the digits are not 1 to 8 and 8 to 1.
  36. :Output(B,A,"o // Outputs an "o" from (1,15) to (7,15) the first time. Outputs (8,1) to (2,1) the second time, and repeat.
  37. :rand(5
  38. :getKey → K
  39. :If Ans=105
  40. :Goto A
  41. :Output(B,A,"_
  42. :End
  43.  
  44. :For(A,16-15(B=1),2+13(B=1),-1+2(B=1 // Above. If B does not equal 1, A counts down from 16 to 2. If B=1, A counts up from 1 to 15.
  45. :Output(B,A,"o // Outputs an "o" from (8,16) to (8,1) the first time. Outputs (1,1) to (1,16) the second time, and repeat.
  46. :rand(5
  47. :getKey → K
  48. :If Ans=105
  49. :Goto A
  50. :Output(B,A,"_
  51. :End
  52.  
  53. :End //Ends and loops again at While 1
  54.  
  55. //ENDING
  56. :Lbl A
  57. :"YOU_LOSE. // Stores "YOU_LOSE" in Ans.
  58. :If A=8 and B=1
  59. :"YOU_WIN. // If A=8 and B=1, stores "YOU_WIN" in Ans.
  60. :Output(1,1,Ans //Outputs Ans, either "YOU_LOSE" or "YOU_WIN"
  61.  
  62. //CLEANUP
  63. :DelVar A
  64. :DelVar B
  65. :"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement