Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prgmCYCLONE
- WRITTEN BY: Toothless the Night Fury
- LANGUAGE: TI-BASIC
- TOTAL BYTES: 304 (not including comments)
- //SETUP (Clear homescreen, delete A, set B to 1 for first loop)
- :ClrHome
- :DelVar A
- :1 → B
- :Output(2,3,"-----^------
- //DISPLAY LOOP
- :For(A,3,6
- :"! // Stores "!" to Ans, a very fast variable and should be used as often as possible.
- :Output(A,2,Ans //Outputs an "!" from (2,3) to (2,6)
- :Output(A,15,Ans //Outputs an "!" at (A,15), where A=3 to 6.
- :End
- :Output(7,3,"------------
- //LOOP 1. This loop is separate because it starts at a specific location.
- :For(A,9,15
- :Output(B,A,"o // Outputs an "o" at (B,A), where B=1 and A=9 to 15.
- :rand(5 // Delays the symbol
- :getKey → K // Stores getKey to K and Ans, but Ans is faster.
- :If Ans=105 // If player pressed Enter.
- :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.
- :Output(B,A,"_ // Outputs a "_" where the o is.
- :End
- //MAIN LOOP: Repeats the two nested loops.
- :While 1 // Loops infinity. Loop is ended by the "Goto A".
- :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.
- :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.
- :rand(5
- :getKey → K
- :If Ans=105
- :Goto A
- :Output(B,A,"_
- :End
- :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.
- :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.
- :rand(5
- :getKey → K
- :If Ans=105
- :Goto A
- :Output(B,A,"_
- :End
- :End //Ends and loops again at While 1
- //ENDING
- :Lbl A
- :"YOU_LOSE. // Stores "YOU_LOSE" in Ans.
- :If A=8 and B=1
- :"YOU_WIN. // If A=8 and B=1, stores "YOU_WIN" in Ans.
- :Output(1,1,Ans //Outputs Ans, either "YOU_LOSE" or "YOU_WIN"
- //CLEANUP
- :DelVar A
- :DelVar B
- :"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement