Category Archives: Ti-83

The Halving Algorithm and the Guessing Game for the TI-83/TI-84

The first task for each student is to write a program where the computer thinks of a number, and the student gets to guess the number (and the program says if the guess is too high, too low, or just right). The program keeps soliciting the user for a guess until the correct answer has been provided. On the TI-83, to have the computer pick a number from 1 to 1000, you use the random number generator under Math->Prb->randInt. The following line of code is how the Ti-83 picks a number from 1 to 1000, and stores it into the variable A:

randInt(1,1000) -> A

I will leave the rest of the program writing to you. You’ll use Lbl, if, Input, math tests (>, <) and Disp.

I originally got the idea for a number guessing program when I was 12. I got it from the book, Basic Computer Games. This book made quite an impression upon me, so it is a pleasure to pass along a snippet (click on the image below to see page 75):


The second task for the student is to think of the best way to guess numbers. For example, consider that I am thinking of a number from 1 to 1000, and I ask you to guess that number (and I will tell you if you are too high or too low). Two bad ways to go about guessing would be to begin at one and count up to 1000 till you got it, or to begin and 1000 and count down. There must be a better way. Find that way. And then come up with a statement that will tell me the most number of guesses it would take for a person to figure out the secret number.

Do the same thing as if the number to be guessed is between 1 and 10.

Then do it again for a number between 1 and 100. Then 1 and 1000. Can you find a general pattern that will tell you the maximum number of guesses it would take to find the hidden number for any range?

Bonus Assignment: This following line of thinking was not covered in our last class. But consider what it would be like to play the game of Guess in reverse… bear with me, and I’ll try to explain. Imagine that instead of randomly picking a number, the computer randomly picks “too high” or “too low” at each guess. That is, the computer itself does not know the secret number, but discovers it with the guesser. Can any number be written as a sequence of “too high” and “too low” statements? Don’t worry if this Bonus Assignment makes no sense. But if you follow the gist, have fun thinking about it. And welcome to the world of open-ended questions.

Axis and Allies Ti-83 Program

I bought the Axis and Allies starter kit (the exact one shown here).

I wanted to play with my younger kids, but I found that the dice rolling was too time consuming and cumbersome. So I wrote a Ti-83 / Ti-84 program to manage all the vehicles and soldiers and their damage, dice and speed. That is, I took everything about each tank and soldier (as defined on their corresponding cards) and I put them into the calculator. I then put all the attack / casualty and defensive fire rules into little programs that use the data. In this way, you can play the starter game with your youngest kids. They only need to think about the objective of the game, movement and what they want to fire upon during each phase.
Continue reading

Ti-84 Risk Game

I have some friends who play RISK regularly enough that they decided to write a C# program that speeds up the game for dice rolling. Just enter the number attacking and the number defending, and the laptop tells you who won. Great idea! So, I thought it would be great to write the same kind of app for a TI-84. That way, the calculator can be passed around to each player, and they can manage the dice.

I wrote this on the TI-84 Plus Silver edition, but it should work on the TI 83. I copied the code over to my computer through the USB link. I spent a few hours writing it, and I didn’t want my son to delete it as he is programming the same device — so I backed it up to my computer and I thought that other people may derive some pleasure from it. So here is the binary version. And following is the text version:

Continue reading