### Author Topic: BASIC One-Liners  (Read 4054 times)

0 Members and 1 Guest are viewing this topic.

#### calcdude84se

• Needs Motivation
• LV11 Super Veteran (Next: 3000)
• Posts: 2272
• Rating: +78/-13
• Wondering where their free time went...
##### BASIC One-Liners
« on: January 10, 2011, 09:59:15 pm »
Post your favorite useful (or useless) one-line snippets of TI-BASIC code here!
I'll start us off with a few of my favorites, list operations:
Code: ("Total Occurences") [Select]
"Returns how many times Ans is an element in L1sum(Ans=L1
Code: ("Single-Occurrence index") [Select]
"Finds where Ans is in L1 provided it only occurs once1+dim(L1)-sum(cumSum(L1=Ans
Code: ("Occurrence index") [Select]
"Finds the index of the Xth occurrence of Ans in L1 (indexed from 1)1+dim(L1)-sum(X<=cumSum(L1=Ans
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
I'll put it online when it does something.

#### SirCmpwn

• Guest
##### Re: BASIC One-Liners
« Reply #1 on: January 10, 2011, 10:00:55 pm »
Shortest (and hardest) game ever:
Code: [Select]
Disp "The Game"

#### Masinini

• LV2 Member (Next: 40)
• Posts: 33
• Rating: +0/-0
##### Re: BASIC One-Liners
« Reply #2 on: January 10, 2011, 10:02:47 pm »
Lbl 99.

Story is, I used to use number lbl's only, and before I knew how to optimize and about sub routines, I had a program that used 99 lbl's.
Output(1,1,"By the pricking of my thumb"
Txt(1,1, "Something wicked this way comes."

#### calcdude84se

• Needs Motivation
• LV11 Super Veteran (Next: 3000)
• Posts: 2272
• Rating: +78/-13
• Wondering where their free time went...
##### Re: BASIC One-Liners
« Reply #3 on: January 10, 2011, 10:03:08 pm »
Also, before someone does it, no ':'s except as part of a string
Sir, that can be optimized to
Code: [Select]
Disp "The Game
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
I'll put it online when it does something.

#### DJ Omnimaga

• Clacualters are teh gr33t
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55942
• Rating: +3154/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: BASIC One-Liners
« Reply #4 on: January 10, 2011, 10:15:17 pm »
Also, before someone does it, no ':'s except as part of a string
Aw... I was gonna post xLIB xLIB Revolution source code

#### Runer112

• Moderator
• LV11 Super Veteran (Next: 3000)
• Posts: 2289
• Rating: +639/-31
##### Re: BASIC One-Liners
« Reply #5 on: January 10, 2011, 10:26:17 pm »
Code: [Select]
:prgmXXR

#### DJ Omnimaga

• Clacualters are teh gr33t
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55942
• Rating: +3154/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: BASIC One-Liners
« Reply #6 on: January 10, 2011, 10:32:43 pm »
Lol Runer112. Finally it seems XXR isn't one single line, though. I thought it did because it barely used any text and the menu texts were sprites.

On an off-topic note I remember these days

That was after XXR made Engadget front page, though (along with plenty of other blogs including Japanese ones). Still, I think that was the only time where a program beat VTI, Mario and MirageOS at once
« Last Edit: January 10, 2011, 10:37:21 pm by DJ Omnimaga »

#### sjasogun1

• LV3 Member (Next: 100)
• Posts: 88
• Rating: +8/-1
##### Re: BASIC One-Liners
« Reply #7 on: January 13, 2011, 04:14:37 am »
Not really a one-liner, but still pretty small game written on my fx-9860 GII (yes on the calc itself, using the program function, not very efficiënt but whatever):

Spoiler For Spoiler:
“PRESS ANY NUMBER AND THEN EXE TO BEGIN”
? --> A
CLRTEXT
RAN# --> A
LOCATE 1,2,A
IF A<0.9
THEN LOCATE 12,2,”<0.9”
LOCATE 1,3,”SUCCESS!”
LOCATE 1,4,”LEVEL 1 COMPLETE”
LOCATE 1,5,”PRESS ANY NUMBER AND”
LOCATE 1,6,”THEN EXE TO CONTINUE”
? --> A
CLRTEXT
RAN# --> B
LOCATE 1,2,B
IF B<0.75
THEN LOCATE 12,2,”<0.75”
LOCATE 1,3,”SUCCESS!”
LOCATE 1,4,”LEVEL 2 COMPLETE”
LOCATE 1,5,”PRESS ANY NUMBER AND”
LOCATE 1,6,”THEN EXE TO CONTINUE”
? --> A
CLRTEXT
RAN# --> C
LOCATE 1,2,C
IF C<0.45
THEN LOCATE 12,2,”<0.45”
LOCATE 1,3,”SUCCESS!”
LOCATE 1,4,”LEVEL 3 COMPLETE”
LOCATE 1,5,”PRESS ANY NUMBER AND”
LOCATE 1,6,”THEN EXE TO CONTINUE”
? --> A
CLRTEXT
RAN# --> D
LOCATE 1,2,D
IF D<0.2
THEN LOCATE 12,2,”<0.2”
LOCATE 1,3,”SUCCESS!”
LOCATE 1,4,”LEVEL 4 COMPLETE”
LOCATE 1,5,”PRESS ANY NUMBER AND”
LOCATE 1,6,“THEN EXE TO CONTINUE”
? --> A
CLRTEXT
RAN# --> E
LOCATE 1,2,E
IF E<0.05
THEN LOCATE 12,2,”<0.05”
LOCATE 1,3,”SUCCESS!”
LOCATE 1,4,”LEVEL 5 COMPLETE”
LOCATE 1,5,”YOU WON! CONGRATULATIONS!”
LOCATE 1,6,”PRESS ANY KEY TO FINISH”
ELSE LOCATE 12,2,”>0.05”
LOCATE 1,3,”FAIL…”
IFEND
ELSE LOCATE 12,2,”>0.2”
LOCATE 1,3,”FAIL…”
IFEND
ELSE LOCATE 12,2,”>0.45”
LOCATE 1,3,”FAIL…”
IFEND
ELSE LOCATE 12,2,”>0.75”
LOCATE 1,3,”FAIL…”
IFEND
ELSE LOCATE 12,2,”>0.9”
LOCATE 1,3,”FAIL…”
IFEND
Veni, vidi, cecidi
(I came, I saw, I fell down dead)
MSPAFORUMS: http://www.mspaforums.com/