Here - 1000 BiT

Here - 1000 BiT Here - 1000 BiT

11.07.2015 Views

Assignment 22:1. Write a program which draws a square. Let the user choose what color it will be. Saveit to tape.2. Add to the program so that it has one to six spots on it like dice.3. SINBAD'S MAGIC CARPET program is shown below. You improve it. Changing theformula in line 215 gives different carpets. Add a "super" outside loop which drawsone carpet after another, each changed a little in color design. Do this by puttingvariables into line 215 which are changed in the super loop.10 REM SINBAD'S CARPET20 PRINT "(CLR)"100CC=55296105C=CC+500110SC=1024115 CH=96+128150FORI=SCTOSC+999155 POKE I.CH160 NEXT I210 FOR 1=1 TO 11 :FOR J=0 TO 18212R=(l+J)*7/22215K=K+(R+3)/(R+5)216IFK>15THENK=0220 POKE C+IM0+J.K222 POKE C-I*40+J,K224 POKE C+IM0-J.K226 POKE C-IM0-J.K250 NEXT J,l130

n INSTRUCTOR NOTES 23 SECRET WRITING AND THE GET COMMAND^ This lesson concerns the GET command.^ GET is a method of requesting a single character from the keyboard.^There is no screen display at all. No prompt or cursor is displayed, and the keystroke isnot echoed to the screen.O The utility of the GET command lies just in this fact. For example, a requested word maynbe received with a series of GETs without displaying it to bystanders.Another advantage over INPUT is that no RETURN key pressing is required. This^ makes GET useful in "user friendly" programming for menus and in games for^ moves, etc.r*\ When the GET command is executed, the computer looks into the line buffer for acharacter. If it finds one, it returns it to the variable. (If the variable is numeric and the^ keystroke was not, a ? SYNTAX ERROR is printed.)If the line buffer is empty, it returns zero to a numeric variable or "" (the empty string)^ to a string variable.O For most situations where you want to think, then press a key, you must put GET into aloop, and keep looking at the buffer until a non-empty string is present.^ The line buffer has a "queue" up to 10 characters long. So for some cases, you can "typeahead" up to 10 characters.nQUESTIONS:^ 1. Compare INPUT and GET. For each question reply "GET" or "INPUT".nna) Gets whole words and sentences at once.b) Shows a cursor.c) Gets one character at a time.^ d) Shows the keystrokes on the screen.C} e) Does not need a RETURN keypress.O 2. Why do you usually need to put GET into a short loop?n131

Assignment 22:1. Write a program which draws a square. Let the user choose what color it will be. Saveit to tape.2. Add to the program so that it has one to six spots on it like dice.3. SINBAD'S MAGIC CARPET program is shown below. You improve it. Changing theformula in line 215 gives different carpets. Add a "super" outside loop which drawsone carpet after another, each changed a little in color design. Do this by puttingvariables into line 215 which are changed in the super loop.10 REM SINBAD'S CARPET20 PRINT "(CLR)"100CC=55296105C=CC+500110SC=1024115 CH=96+128150FORI=SCTOSC+999155 POKE I.CH160 NEXT I210 FOR 1=1 TO 11 :FOR J=0 TO 18212R=(l+J)*7/22215K=K+(R+3)/(R+5)216IFK>15THENK=0220 POKE C+IM0+J.K222 POKE C-I*40+J,K224 POKE C+IM0-J.K226 POKE C-IM0-J.K250 NEXT J,l130

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!