G FOR ATARI N W R E PROGRAM N°. 09970012 PROGRAM INEASIC Let OSCAR ease the chore of learning to program. 320 LET A = INT ( 1 1 * RND (l)) r ISMBI * « OSCAR is a super programming tutor. By hitting only a few keys, you run two simple BASIC programs — MILES PER GALLON and OSCAR'S DRILL (a multiplication game). Then see in detail how the programs were created. PROGRAM IN BASIC / DATABAR SOFTWARE PROGRAM IN BASIC™ / DATABAR SOFTWARE G E N W A R E PROGRAM IN BASIC SEE HOW THEY RUN On the following bar code pages are two exercises that reveal the types of programs you’ll soon be able to write using OSCAR and the Genware series. The first program is a simple multipli- cation game. The second program cal- culates a car’s gas mileage. We’ve done all the writing of these programs to let you examine how they are constructed. All you have to do is scan the programs into your computer with OSCAR and run them. When you see how they run, then you’ll switch the program to the lines of code that make up the program in order to see what a BASIC program looks like. Soon you’ll be writing your own pro- grams in the code you study here. OSCAR'S Drill The first program, OSCAR’s Drill™ , is a simple multiplication game, the type you would write if your child needs practice with multiplica- tion. OSCAR's Drill ™ presents num- bers between 0 and 10 for a player to multiply and asks the player to type in the correct answer. A player starts with 20 points. If an answer is correct, the player gets 5 additional points. If wrong, the player loses 2 points. One game has only four problems, but you can keep playing as long as you like. After You've Played the Game Now you’ll want to examine the BASIC language lines that make up the program. See the Program Instructions for how to do this. You’ll look at the program line by line in sec- tions. Program lines start at 50 and go up in intervals of 10. Lines 50 to 250, therefore, refer to a program’s first 15 lines. You use line numbers in BASIC programs to tell the computer the order in which to execute the state- ments. Miles Per Gallon™ Your second program, Miles Per Gallon™ , is an example of how some- one might use a computer for calculat- ing a car’s gas mileage for a trip to Phoenix. The program takes the mile- age readings from the car’s odometer each time the driver fills the tank with fuel, and then keeps a running tally of the fuel economy the car has attained from fill to fill. Miles Per Gallon ™ is a completed program that doesn’t require your input. But study closely the BASIC language code that makes up the pro- gram. The program is a bit more com- plicated than OSCAR’s Drill™ , so it has more “REM” lines. Again, look at the program line-by-line to get clues on how programs are written. You’ll want to refer to “The BASICs of Pro- gramming” article (page 44) to help you understand some of the other basic elements of these two programs. What Types of Statements? Here are the various types of state- ments you’ll be examining in the pro- gram listings for OSCAR’s Drill™ and Miles Per Gallon™ : DATA: Used in a program, it lists information that will be assigned to the variables in the READ statement. FOR-NEXT: Used to cause a loop , or repetitions, of part of a program. For example, after the command FOR I = 1 to 10, the program runs, executing all statements, until it hits a line that says NEXT I. Then it goes back to the line beginning FOR again for nine rep- etitions. GOTO: Tells the program to jump to the line named. IF-THEN: A programming state- ment in which an action is taken when a condition is true. For example, the statement, “IF A = B THEN 220” tells the computer to determine if A equals B, and if so, to go to line 220 in the pro- gram. INPUT: Stops program and requests information from the person running the program; it then assigns that information to a variable. For example, if you enter 8 in answer to INPUT S, the program assigns a value of 8 to the variable S. LET: Tells the computer that what- ever follows is true. For example, LET C = 1 means C is equal to 1. PRINT: Instructions to the com- puter telling it to put a statement on the monitor. READ: Assigns information to vari- ables from DATA statement. REM: A note to people reading a program listing. Program Instructions ■ Load OSCAR’s Drill ™ into your computer with OSCAR. Then type “RUN.” (Refer to your User’s Manual if you have difficulties.) ■ A multiplication problem will appear. Type your answer to the multiplication problem and press RETURN or ENTER. (Do not type a let- ter or press RETURN or ENTER without first pressing a number; the program will end and you will have to type “RUN” to play again.) ■ At the end of the game type “Y” (yes) if you want to play again or “N” (no) if you don’t, and press RETURN or ENTER. ■ If you’ve pressed “N,” type List 50-130 (50, 130 for Atari) and press RETURN or ENTER to see the first nine lines of the program. After studying these lines list the next section in the same way following this chart: OSCAR'S DRILL 50-130 510-590 140-220 600-700 220-300 710-740 310-410 750-820 420-500 830-850 ■ Follow the same instructions for Miles Per Gallon ™ using this chart: M. P. G. 50-100 470-530 110-180 540-600 190-210 610-650 220-280 660-720 290-350 730-800 360-460 ■■■■ □SCAR'S DRILL GENWARE™ PROGRAM PAGE ru 1 OF 2 “ PROGRAM NO. 09970004 © 1983 DATABAR CORPORATION H ATARI® OSCAR'S DRILL PROGRAM PAGE rw GENWARE™ 2 OF 2 “ PROGRAM NO. 0997000A ©1983 DATABAR CORPORATION H ATARI MILES PER GALLON GENWARE™ PROGRAM PAGE 1 OF 2 □ lIllllilllllllllllllllllllllllllllllllllllllllHIIIIIIIlIHlIIIIIIIIHIIl IlilllllllllllllllllH llllllllilllilillllHH IIIIIIUlIillllllllllinillllllllllilllllllllHIIIinil iiiiiiiiiiiiiiiiiiiiiiiiiiniiiiiiiiniiiiiB iiiiiiiiiiiiiiiiiiiiiiiii iiniiiiiiiiiHiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiniiini iiiiiiiiiiiiiiiiiiiHiiiiiiiiiiniiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiini^ iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiniiiniiiiini iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiH IIIIIIIIIIIIIIIIIIIIM Ill I I I Hiiiiiiiittiiiinuiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiNiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiniinin^ iiiiiiiiiniiiiiiiiiiiiiiiiiiiuHiiiiiiiiiiiiiiiii iniiiiiiiiiiiiiiiiiiiniiiiiiiiiiiiiHiiiiiiiiiiiiiiiiiii II lll'llll lllllllllllllll IIIIMI lllllll II lllllll II I llll IIMIII IIIIIM -lllllllll iiiiiiiiimiiiiihiiiiim IIIIIIIIIIIIIIIIIIIIIIIIIM I Ill iiiiiiiiiiiiiiiiiiiiiiigiiiiiiiiiiiiiiiiiiiiiiiiiiniiiB iMiiiiin iiiiiiiiiiiiiiiiiiiiiiiiiiniiniiniiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii ii i ill ii i ii ii ii ii 1 1 in in ii in m iiiiiiiiiHiiiiiiiiiiiiiiiiigiiiniiiiiiiiniii iiiiiiiiiiiiiiiiiiiii iiigiiiiiiiiiiigiiigiiiiiiiiiiiigiiiiiiiiiiiii iiiiiiiiiiiiiggiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinii iiiiiiiiiiiiigiiiiiiiiiiiiiiiiiiiigiiiiiiiiiiiiiniiHiiiiii iiiniiiniiigiiiiiiiiiiiiiiiiiiiiiiiiiiiiiniia liiiiiiiiiiiiiiiiiiiiiiingiiiiiiiiigiigiiiiiiiiiiiii iigiiiiiiiiiiiigiiiiiiiiiiiiiiiiiiiiiiiinii 5J ATARI® PROGRAM NO. 09970008 © 1983 DATABAR CORPORATION MILES PER GALLON PROGRAM PAGE ™ GENWARE™ 2 OF 2 “ lllllllllllllllllllllllllllllllllllllllllllllllllllll in i ii 111 iii iiii ii ii min iiiiiiiiiiiiniiiiiiiHiiiiiiiiiiiiiiiiiiniiin iininiiuiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiini iiiiniiiiiiiiiiiiiniiiiiiiiiiiiiiiiiiiiuiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiniiiHiiiiiuiiiiiiiiiiiiiiiiiiiniiiiiiiiiii iiiiiiiiiiiiniiiiiiiiiiiiiiiiiiiiiigiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiniiiiiiiiuinuiiii iiiiiiiiiiiiiiiiiiiiii iiiiiiiiinttiiiiiiiiiiiiiiiiiiiiiiiiiniiiiiiiiiiii iiiiiiiiiiiiiiH niiiiiiiiiiiiiiiiiiiiiiiiniiiiiiiiiiiiiHiiiii iiiiiiniiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiininiiiiuiiiiiHiiiiii iiiiiiiiiiiiiiiiiib iiiiiiiiiiiiiiiiiib iiiiiiHiiiiiiiiiiiiiiiiiiiiiiiiniiiiiiiiiiiiiiiiiiiiiiiiii iiiiiniiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiniiiiiiniiiii iiiiiiiiiiiniiiiiiiiiinuiiiiiiiiiiiiiiiiHiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiim iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii PROGRAM NO. 09970008 ©1983 OATABAR CORPORATION H ATARI