Don't have an account? Register now to chat, post, use our tools, and much more.
Online Users
There are 114 users online: 7 members, 83 guests and 24 bots.
Members: chickendude, JosJuice, nsg, Spyro543.
Bots: Magpie Crawler (4), Googlebot (19), MSN/Bing (1).
SAX
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

"Here's the Breakdown." => TI-BASIC
Author Message
Weregoose
Authentic INTJ

Super Elite (Last Title)

Joined: 25 Nov 2004
Posts: 3976

 Posted: 07 Mar 2010 06:54:10 pm    Post subject: Everybody's favorite "guess the number" game, written in TI-BASIC: randInt(1,100→A Repeat A=B Input "GUESS? ",B If A>B Disp "TOO LOW." If AB. Remember that A is the number that we're trying to accurately guess, and B is the one that we just tried. If the mystery number is larger than (greater than) our current guess, then the calculator will tell us that we guessed too low. The line with the Disp—which means "display this text on the home screen"—is only performed if the test above it is true. After lines four and five, another test checks to see if our guess is too high. (If it is, then the appropriate text is displayed.) In the second-from-last line is an End. This marks the bottom of the Repeat loop – more importantly, this is where the calculator makes the decision to leave the loop based on whether or not the condition at the top of the loop is presently met. Basically, the A=B (the calculator's secret number versus our guess) is either true or false at this point. If it is true, then the program will break free from the loop (even if it has only gone through once, which means, amazingly, that we got the number right on our first try). If it is false and A does not equal B, then we get to start the loop all over again. The next thing that would happen is that the program would ask us to guess its number. When we make a correct guess and break free from the loop, the next line that the program deals with is the first one to follow the End. All that there is left is for the program to exclaim, "CORRECT!" So, what happens when you change the 100 in the first line to 1000000? (I'll see you when you're done!)Last edited by Guest on 01 Jul 2010 07:06:34 am; edited 1 time in total
 Display posts from previous: All Posts Oldest FirstNewest First
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.

»
 Page 1 of 1 » All times are GMT - 5 Hours

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.026828 seconds.