that might help out a bit.
Here it is:


Code:
:ClrHome
:Lbl A
:ClrHome
:Menu("Snake","Play",1,"Ultimate Game",98,"Highscores",2,"Quit",3)
:Lbl 5
:ClrHome
:Input "Code=",Str1
:If Str1="00549024058270010008400"
:Goto 99
:If Str1≠"00549024058270010008400"
:Goto 98
:Lbl 99
:0→L
:ClrDraw
:Horizontal 0
:Vertical 0
:Horizontal {-}62
:Vertical 94
:For(X,0,Q)
:End
:26→R
:48→B
:32→A
:Repeat pxl-Test(Ans,B)=2
:Pxl-On(Ans,B)
:If Ans=62 or Ans=0 or B=94 or B=0
:Goto 72
:L+1→L
:getKey
:If Ans
:Ans→R
:B-(R=24)+(R=26)→B
:A-(R=25)+(R=34)→A
:End
:If R=105
:Pause
:Lbl 72
:If L≥1000
:Goto 10
:If L<1000
:Goto 9
:Lbl 98
:1000→Q
:0→L
:ClrDraw
:Horizontal 0
:Vertical 0
:Horizontal {-}62
:Vertical 94
:For(X,0,Q)
:Pxl-On(randInt(1,62),randInt(1,93)
:Pxl-On(randInt(1,62),randInt(1,93)
:Pxl-On(randInt(1,62),randInt(1,93)
:End
:26→R
:48→B
:32→A
:Repeat pxl-Test(Ans,B)
:Pxl-On(Ans,B)
:L+1→L
:getKey
:If Ans
:Ans→R
:B-(R=24)+(R=26)→B
:A-(R=25)+(R=34)→A
:End
:If L≥1000
:Goto 10
:If L<1000
:Goto 9
:Lbl 3
:{-}10→Xmin
:10→Xmax
:{-}10→Ymin
:10→Ymax
:Output(1,1,"")
:Stop
:Lbl T
:ClrHome
:Goto A
:Lbl 1
:AxesOff
:FnOff
:0→L
:0→Xmin
:94→Xmax
:0→Ymax
:{-}62→Ymin
:ClrDraw
:50→Q
:Lbl C
:ClrDraw
:Horizontal 0
:Vertical 0
:Horizontal {-}62
:Vertical 94
:For(X,0,Q)
:Pxl-On(randInt(1,62),randInt(1,93)
:End
:26→R
:48→B
:32→A
:Repeat pxl-Test(Ans,B)
:Pxl-On(Ans,B)
:L+1→L
:getKey
:If Ans
:Ans→R
:B-(R=24)+(R=26)→B
:A-(R=25)+(R=34)→A
:If R=83
:Goto 5
:End
:If L≥1000
:Goto 10
:If L<1000
:Goto 9
:Lbl 9
:ClrHome
:Output(1,1,"Game Over")
:Output(4,1,"You Stink")
:Pause
:ClrHome
:Goto 11
:Lbl 10
:ClrHome
:Output(1,1,"Game Over")
:Output(4,1,"You're Good.")
:Pause
:ClrHome
:Goto 11
:Lbl 11
:ClrHome
:Output(1,1,"****************")
:Output(8,1,"----------------")
:Output(4,4,"Score:")
:Output(4,10,L)
:Pause
:ClrHome
:Goto 2
:Lbl 2
:ClrHome
:If L>M and L>N and L>O and L>P and L>Z and L>W
:Z→W
:If L>M and L>N and L>O and L>P and L>Z and L>W
:P→Z
:If L>M and L>N and L>O and L>P and L>Z and L>W
:O→P
:If L>M and L>N and L>O and L>P and L>Z and L>W
:N→O
:If L>M and L>N and L>O and L>P and L>Z and L>W
:M→N
:If L>M and L>N and L>O and L>P and L>Z and L>W
:L→M
:If L<M and L>N and L>O and L>P and L>Z and L>W
:Z→W
:If L<M and L>N and L>O and L>P and L>Z and L>W
:P→Z
:If L<M and L>N and L>O and L>P and L>Z and L>W
:O→P
:If L<M and L>N and L>O and L>P and L>Z and L>W
:N→O
:If L<M and L>N and L>O and L>P and L>Z and L>W
:L→N
:If L<M and L<N and L>O and L>P and L>Z and L>W
:Z→W
:If L<M and L<N and L>O and L>P and L>Z and L>W
:P→Z
:If L<M and L<N and L>O and L>P and L>Z and L>W
:O→P
:If L<M and L<N and L>O and L>P and L>Z and L>W
:L→O
:If L<M and L<N and L<O and L>P and L>Z and L>W
:Z→W
:If L<M and L<N and L<O and L>P and L>Z and L>W
:P→Z
:If L<M and L<N and L<O and L>P and L>Z and L>W
:L→P
:If L<M and L<N and L<O and L<P and L>Z and L>W
:Z→W
:If L<M and L<N and L<O and L<P and L>Z and L>W
:L→Z
:If L<M and L<N and L<O and L<P and L<Z and L>W
:L→W
:Output(1,1,"***HIGHSCORES***"
:Output(8,1,"----------------"
:Output(2,4,"1st:")
:Output(2,8,M)
:Output(3,4,"2nd:")
:Output(3,8,N)
:Output(4,4,"3rd:")
:Output(4,8,O)
:Output(5,4,"4th:")
:Output(5,8,P)
:Output(6,4,"5th:")
:Output(6,8,Z)
:Output(7,4,"6th:")
:Output(7,8,W)
:Pause
:Goto A
:ClrDraw
:Lbl E
:AxesOn
:ClrDraw
:ZStandard
:ClrHome
:Stop


That is the original code. Enjoy changing it to Casio BASIC.
What is that big block of... mess? (Edit: Specifically talking about the million character If statements one-after-another that all basically say the same thing) o.o That said, it might be a good idea to first learn how to make it optimized on an TI-83+/84+ before you convert it to Casio BASIC. I say that because, you have a massive amount of labels. That is, assuming you know TI-Basic better than Casio BASIC, because I think it would help more to learn how to write non-label-abusing code in a language that you already know. If you need any help, I'll gladly try to refactor it to not use labels (Although, in a separate thread).
I actually got this code from a youtube video. I just added the highscore list.
_player1537 wrote:
What is that big block of... mess? (Edit: Specifically talking about the million character If statements one-after-another that all basically say the same thing) o.o That said, it might be a good idea to first learn how to make it optimized on an TI-83+/84+ before you convert it to Casio BASIC. I say that because, you have a massive amount of labels. That is, assuming you know TI-Basic better than Casio BASIC, because I think it would help more to learn how to write non-label-abusing code in a language that you already know. If you need any help, I'll gladly try to refactor it to not use labels (Although, in a separate thread).
I think in either language he needs to learn what lists are and how to use them. That is absolutely disgusting code. Whose video was it? You need to get them here ASAP.
That block of code is mine for the highscore list. How would I reduse the size of that block?

PS: I optimized it in sourceCoder. It didn't optimize the big block.
Umm, I don't think you did. I can tell because of this line, and several like it:
Code:
:Output(2,4,"1st:")
If SourceCoder got to it, that would just be:
Code:
:Output(2,4,"1st:
What does that block even do?
I didn't optimize it. I gave you the original code. The block makes it so that all of the scores below the highest goes down when you get the highest score.
see the chain of If statements that are identical? Quick optimization:

If L>M and L>N and L>O and L>P and L>Z and L>W
Then
(All those variable declarations)
End

Also,
:Goto A
:ClrDraw
:Lbl E
That Clrdraw will never be used. Delete it.
I don't know how that ClrDraw got there.
Spenceboy98 wrote:
That block of code is mine for the highscore list. How would I reduse the size of that block?

PS: I optimized it in sourceCoder. It didn't optimize the big block.
SourceCoder is not a genius. It can only find simple optimizations, like some explicit -> implicit conditionals, missing DelVar usage, etc. It can't do large-scale refactoring of code like recognizing where you should be using a list instead of a billion variables and conditionals that all follow the same pattern. Although maybe I should make it at least detect and warn about that...
How would I make it a list?
How do you insert multiple items on one like
Code:
"<string>",<var>,"<string>", <var>,"<string>"
?
You want to insert all this items in the same string ?
Spenceboy98 wrote:
How would I make it a list?
Assuming you have, say, a ten-item high scores list, then the conceptual code (this is pseudocode) might look like this.

Initialization:

Code:
:10->dim(LHS
:Fill(0,LHS    //initialize all high scores to zero


Insert new score S:
Run a loop that ends if the current score S is higher than the score at slot LHS(X) in the list:

Code:
:1->X
:While X<=10 and S<LHS(X
:X+1->X
:End
:If X<=10
:Then        //Then we're better than at least one score
:LHS(X->T //Temporary storage
:S->LHS(X
:For(A,X+1,10 //Move all subsequent scores down one
:LHS(X->U
:T->LHS(X
:U->T
:End
:End //end the If/Then block


Makes sense?
Purobaz wrote:
You want to insert all this items in the same string ?

no I want this to print out onto the screen of the calculator as the answer.
krazylegodrummer56 wrote:
Purobaz wrote:
You want to insert all this items in the same string ?

no I want this to print out onto the screen of the calculator as the answer.

So, you have to concatenate all items in a string, before displaying it.

Use this code to convert a number to a string.
And then display the string wih :

Code:
Locate X,Y,Str 1


Or you can display each item separately :

Code:
Locate X,Y,<string>
Locate X+7,Y,<var>
...
another question where would I get a text file to .g3e eActivity file converter?
Nowhere: It doesn't exist yet
Oh well I was hopeing there would be one BUT there isn't
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement