Just what the title says:

Code:

Pause "PRESS ENTER TO START
1→L
0→P
ClrHome
randInt(1,5,5→L₁

Lbl 01
0→T
ClrHome
For(A,1,5
Output(2A,6L₁(A)-5,"°
End
Output(1,1,P
Repeat Ans or T>100
T+1→T
getKey
End



Ans-10→K
If L₁(5)=K and T<100
Then
P+1→P
For(A,4,1,­1
L₁(A→L₁(A+1
End
randInt(1,5→L₁(1
Else
L-1→L
End
If L
Goto 01
ClrHome
Disp "YOU LOSE: ","SCORE:",P


(255 bytes)

Please add any suggestions or revisions below!

TO PLAY: use the first row of keys
What is the function of the command
L,(A
I've never seen this before and it doesn't seem to refer to an Ans anywhere.
CalcMeister wrote:
What is the function of the command
L,(A
I've never seen this before and it doesn't seem to refer to an Ans anywhere.

I think it did something at a time. Hmm... *deletes it*
_iPhoenix_ wrote:
CalcMeister wrote:
What is the function of the command
L,(A
I've never seen this before and it doesn't seem to refer to an Ans anywhere.

I think it did something at a time. Hmm... *deletes it*
I like it, thought obviously youll have to find some way to deal with the input lag associated with BASIC. I'd add a highscore system right off the bat, just use H or Theta or some value people won't use often.
CalcMeister wrote:
_iPhoenix_ wrote:
CalcMeister wrote:
What is the function of the command
L,(A
I've never seen this before and it doesn't seem to refer to an Ans anywhere.

I think it did something at a time. Hmm... *deletes it*
I like it, thought obviously youll have to find some way to deal with the input lag associated with BASIC. I'd add a highscore system right off the bat, just use H or Theta or some value people won't use often.

Yes. I was thinking of using a (custom) list with only one element. Just add
At the beginning:


Code:
Unarchive ʟTILES
1->dim(ʟTILES


and at the end:



Code:
If P>ʟTILES(1:Then
P->ʟTILES(1
Disp "NEW HIGHSCORE!
Else
Disp "HIGHSCORE: ",ʟTILES(1
End
Archive ʟTILES
TheLastMillennial wrote:
CalcMeister wrote:
_iPhoenix_ wrote:
CalcMeister wrote:
What is the function of the command
L,(A
I've never seen this before and it doesn't seem to refer to an Ans anywhere.

I think it did something at a time. Hmm... *deletes it*
I like it, thought obviously youll have to find some way to deal with the input lag associated with BASIC. I'd add a high score system right off the bat, just use H or Theta or some value people won't use often.

Personally I'd use a custom list and then archive it so it wont get lost with a RAM reset. There's a nice article about high scores here
Your programs looking good! Very Happy


Thanks, and good idea! I'll edit the post.
Here it is with a little crude highscore system added in.

Code:
SetUpEditor T
5->dim(|LT
Disp "HIGHSCORES:",|LT
Pause "PRESS ENTER TO START
DelVar PrandInt(1,5,5->A
1
While Ans
   DelVar TClrHome
   For(A,1,5
      Output(2A,6|LA(A)-5,"^^o
   End
   Output(1,1,P
   Repeat K or T>99
      getKey->K
      T+1->T
   End
   0
   If T<99 and K-10=|LA(5
   Then
      P+1->P
      augment({randInt(1,5)},|LA
      DeltaList(cumSum(Ans)-Ans->A
      1
   End
End
ClrHome
augment(|LT,{P->T
SortA(|LT
DeltaList(cumSum(|LT->T
Archive |LT
Disp "YOU LOSE:","SCORE:
P

EDIT: It now puts the high-score list in archive and won't crash if the list is deleted (it will just be reset to 0,0,0,0,0)
EDIT2: The code was 300 bytes so I optimized out a few, it is now 246.
mr womp womp wrote:
Here it is with a little crude highscore system added in.

Code:
SetUpEditor T
5->dim(|LT
Disp "HIGHSCORES:",|LT
Pause "PRESS ENTER TO START
DelVar PrandInt(1,5,5->L1
1
While Ans
   DelVar TClrHome
   For(A,1,5
      Output(2A,6L1(A)-5,".
   End
   Output(1,1,P
   Repeat K or T>99
      getKey->K
      T+1->T
   End
   0
   If L1(5)=K-10 and T<99
   Then
      P+1->P
      augment({randInt(1,5)},L1
      DeltaList(cumSum(Ans)-Ans->L1
      1
   End
End
ClrHome
If P>min(|LT
Then
   augment(|LT,{P->T
   SortD(|LT
   DeltaList(cumSum(|LT)-|LT->T
End
Archive |LT
Disp "YOU LOSE: ","SCORE:",P

EDIT: It now puts the highscore list in archive and won't crash if the list is deleted (it will just be reset to 0,0,0,0,0)
EDIT2: The code was 300 bytes so I optimized out a few, it is now 266


Very good. If anyone thinks they can optimize an further (I doubt it's possible) please do!
Sure we can! Smile


Code:
      P+1->P
      augment({randInt(1,5)},|LA
      DeltaList(cumSum(Ans)-Ans->A
      1

can be

Code:
      augment({randInt(1,5)},|LA
      DeltaList(cumSum(Ans)-Ans->A
      P+1->P


This works, because P+1!=0
PT_ wrote:
Sure we can! Smile


Code:
      P+1->P
      augment({randInt(1,5)},|LA
      DeltaList(cumSum(Ans)-Ans->A
      1

can be

Code:
      augment({randInt(1,5)},|LA
      DeltaList(cumSum(Ans)-Ans->A
      P+1->P


This works, because P+1!=0


Clever... I have a modificaton my self, this time to the code that does the high scores:

Code:
5->dim(|LT

at the beginning and

Code:
If P>min(|LT
Then
   augment(|LT,{P->T
   SortD(|LT
   DeltaList(cumSum(|LT)-|LT->T
End

at the end, can be turned into

Code:
6->dim(|L1

at the beginning and

Code:
P->|L1(6
SortD(|L1
5->dim(|L1

at the end. Not 100% sure this is an improvement, but it sure is clearer to understand and utilize
  
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 1 of 1
» 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