Guess the Number

We're glad you came by, but you might find what you're looking for elsewhere.

TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it.

Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope.

no_image_2.png Name: Guess the Number
Author: TI-Basic Developer
Download: NumberGuess.zip
Compatibility: Parent page not set
File Size: 215 Bytes Try to guess the number, and see how many tries it takes you.

What the community thinks:

Guess
Mr Dino Mr Dino 12 May 2011 06:19

Good job. I made one similar to yours, but it was 536 bytes. Yours is way smaller. (mine uses labels and gotos.) I don't have a chord, however, and cannot connect. One major flaw, though. The number is stored as variable A. If the user types in A as a guess, it will be right. Don't let the cheaters get away with it! Here's a way to prevent them from cheating.

Input "YOUR GUESS?", Str1
If Str1="A"
Then
Pause "CHEATER"
Goto 1
End
expr(Str1)->A

What it does is prompt with input, so the user doesn't know that it is a string. Then it checks if the user tried to cheat with "A". If not, it stores the value of their number from String to the actual variable A. Then you can go check if the number was too high or low. However, it does have a flaw. If the user didn't input "A" or a number, it will cause an error. One way to fix this is to check if it is "A" or if it is a number. If not, give them a warning and start over. But all that takes up precious bytes. So decide: anti cheating or more bytes?

Good job! I hope you continue programming. Try adding different difficulties, or high scores.

by Mr Dino Mr Dino , 12 May 2011 06:19
Re: Guess
Mr Dino Mr Dino 12 May 2011 23:06

Wait. I'm sorry. There is another way to cheat. My previous method only checked one. If the user types in "1XA", it will work. Try this:

For(A,1,length(Str1
If sub(Str1,A,1)="B"
Then
Pause "CHEATER"
Goto 1
End
End
expr(Str1)->A

It checks every character.

by Mr Dino Mr Dino , 12 May 2011 23:06
Re: Guess
burr burr 13 May 2011 15:52

What you are referring to is validation, and we actually have a page already dedicated to that. In addition, instead of looping through all of the characters looking for the letter, you can simply use the inString( command.

by burr burr , 13 May 2011 15:52

Want to update this page?

  • to provide up-to-date versions of your program;
  • of this page to provide up-to-date information about your program.

A moderator will only process these changes if you add the word update to the

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /