For greater assistance this section will follow as closely as possible the order of the manual supplied with your console (link is to 1300k pdf file at whtech.com).
Do not try to take in all the information in one reading, but go back and read it again a few times.
A computer works as a large number of switches, which are either on or off. Each 'switch' is described as a BIT. In order to pass information more quickly, the computer looks at more than one BIT at a time. The TI99/4A uses a 16 bit processor: it is able to look at 16 bits at a time. For most purposes however, the computer looks at 'words' composed of 8 bits. These words are called BYTES. A BYTE is a binary number composed of eight numbers, which may be 0 or 1. In digital representation the BYTE has a maximum value of 255 (Binary 11111111).
The computer stores its commands (reserved words) as one byte, rather than a collection of letters. It can only identify the command words if you follow the rules regarding the characters permitted in front of and following command words. In general, you may only use a space, arithmetic operator, or ENTER, but there are exceptions which you will see in the program listings in the manual and in the books of TI programs now available.
For discussion of the error tracing commands (Trace, Untrace,Break) see the section on How to use TI Basic.
LIST The command LIST is used to list the contents of a program. Used on its own,it will list the program on the screen. You may use CLEAR (FCTN and 4) to halt the LIST. To start again at say line 400, you type in LIST 400- the hyphen indicating 'to the end', or LIST 400-600
LIST can also be used in many other ways. These are described in the section on modules and peripherals.
SAVE Please refer to the section on cassette handling.
LET LET is optional, but uses up one byte of memory every time you use it. It is better not to. LET A=2 is the same as A=2
END END is also optional, but in this case it is good practice to use it. By adding END to your program, you may be certain when you list it in the future, that you have the complete program, and not a 'working copy'.
However, TI BASIC does have 'relational operators' which will often help you out of this problem. These may be found described in the section on Advanced Programming.
For..to..step may also be used to provide delays: 100 FOR DELAY=1 TO 300 110 NEXT DELAY This will take a little over a second to complete in TI Basic.
INPUT Try to use a separate INPUT for each variable. It IS possible to input more than one variable eg by using INPUT A,B but this requires the program user to input two numbers separated by a comma.
The TI form of input, INPUT "HOW MANY?":N uses a colon separator (:), most other Basics use a semi colon (;).
'A' is a VARIABLE, and can be allocated to any number. The TI99/4A may have variable names up to fifteen letters long: you may for instance use: HIGHSCORE=12000 A variable representing a number is a NUMERIC VARIABLE and a variable representing a letter,a word, or a group of words is called a STRING VARIABLE. A string variable always ends with the dollar sign: MESSAGE$="YOU WIN" Strings (as they are called) are dealt with later.
eg FOR I=1 TO 5 READ A IF A=1 THEN 200 NEXT I DATA 2,3,1,0,6 if used often, could be replaced with: FOR I=1 to 5 READ B(I) NEXT I then when a check is required FOR I=1 TO 5 IF B(I)=1 THEN 200 NEXT I DATA 2,3,1,0,6
It is worth mentioning that DATA causes more problems in debugging a program than any other command. There must be enough DATA to fill all the READs in the program, and they must be numbers if a numeric variable is READ.
Be careful how many commas you use in your DATA lines : too many or too few can cause many hours searching for errors. The error messages you will receive may be some distance from a READ line, if you have loaded an incorrect value into a numeric variable due to missing out just one comma.
eg 100 PRINT "PRESS" 110 PRINT "1. TO START" 120 PRINT "2. TO TERMINATE" 130 PRINT 140 PRINT "H FOR HELP"
Will appear more quickly if you use: 100 PRINT "PRESS":"1. TO START":"2. TO TERMINATE"::"H FOR HELP"
TI Basic allows you to key in a program line up to 4 screen lines long, so use this facility. Notice that instead of a single PRINT to scroll one line, an extra colon has been used in our single line amendment. Each colon causes the screen to scroll once.
CALL SCREEN is used to set the screen colour, and CALL COLOR is used to set the character colours. Note that COLOR is spelt the American way.
To Try: 100 FOR N=1 to 8 110 CALL HCHAR(N,1,24+N*8,32) 120 NEXT N 130 FOR N=1 TO 16 140 CALL SCREEN(N) 150 FOR DELAY=1 TO 300 160 NEXT DELAY 170 CALL COLOR(N,N,1) 180 NEXT N 190 END
Characters are defined with CALL CHAR(CODE,STRING$),where STRING$ is a string or string variable made up of HEXADECIMAL characters (0 to 9 plus A to F). As each character occupies a grid of 8 x 8 dots, it can be defined by splitting it down the middle to form 16 rows of 4 dots. Each possible combination of ON and OFF dots in a row of four can be defined in terms of one of the sixteen hexadecimal characters. A character with one dot ON in the top right corner is defined as: "0100000000000000". The definition is by row, first the left side then the right. Each row of 4 dots can be considered a row of binary switches. The right switch is 1, the next 2, the next 4 and the leftmost switch 8. When a dot is ON, add its value to the others which are ON in the same row. You will obtain a unique number, from 0 to 15. From this decimal number you change to a single hexadecimal digit (hexadecimal numbers have a 'base' of 16). The number 15 for instance is hexadecimal F. You may purchase the EXTENDED BASIC module at some future date. As TI BASIC programs run faster in EXTENDED BASIC, it is worth noting that that language has only 14 character sets. Therefore,if you use characters coded 144 to 159 in your TI BASIC programs, the programs will not run in Extended Basic. There are several versions of the console around, and there have been slight changes in the relative shades of the colours used. If you purchase a program and the colours seem awful, it was probably written on a 99/4 or an NTSC 99/4A...you should be able to change the colours to something more suitable, and it will give you good programming exercise looking for the lines to amend. If you wish to place a single character on the screen, use the CALL HCHAR command, it is slightly faster than CALL VCHAR.
Sound is produced with CALL SOUND(TIME,F1,V1,F2,V2,F3,V3,N,V4) where TIME is in milliseconds, F1,F2 and F3 are FREQUENCY in Hertz (cycles per second) and V1,V2 and V3 are volume (0 loudest, 30 quietist). N is a noise generator which provides some sound effects.[N & V4 WILL NOT PRODUCE TI EFFECT IN TI EMULATOR] A CALL SOUND may use only one frequency if you wish: the second and third frequencies are optional and may be omitted. The Noise is also optional. A CALL SOUND will occupy the computer for about 50 milliseconds, and then, even if the sound is still continuing, it will proceed with the next instruction. If it comes to another CALL SOUND, the computer will wait until the first has finished, unless the second CALL SOUND has a negative time, in which case the first CALL SOUND will immediately be terminated and the second CALL SOUND begin.
TI state that you can only have tones down to 110 Hz on your computer, but that is not quite the case:
Try: 100 INPUT A 110 IF A<37 THEN 100 120 CALL SOUND(2000,200,30,200,30,A*3,30,-4,0) 130 CALL SOUND(500,200,30) 140 GOTO 100
If you wish the computer to assume the ALPHA LOCK key is down, while a program is running, you can instruct it using CALL KEY, and avoid having to request the program user to ensure the key is down. Use CALL KEY(3,K,S) in your program, and as soon as the program passes over it (no key has to be pressed) the computer will consider the alphalock key to be down, whether it is or is not. You resume normal operation with CALL KEY(5,K,S). These switching calls can use any variables you wish, and may be dummy calls or you may actually use them to obtain a key response.
In the appendix section you will find a list of the key codes which are available from the keyboard using the CTRL and FCTN keys.The normal keyboard, with and without using SHIFT will allow you access to characters 32 to 127 (a few of these codes do require the FCTN key).
IMPORTANT: If you use the split keyboard, CALL KEY(1.. and (2.. the value returned for keys X and M is only approximately zero, and although it prints on screen as zero will not equate with it. Instead of using IF KEY=0 THEN, you are forced to use IF KEY+1=1 THEN...
CALL JOYST A program illustrating the use of this command is developed in a later section of this book.
Please note that when using the joysticks, the alphalock key must be in the up position. If alphalock is down, the computer will not be able to sense when the joystick is pushed upwards.
Using Call Key(3...) does not affect joystick operation, but you should not use CALL JOYST(3...) as this may prevent correct operation of the joystick.
ATN ATN is a trigonometrical function which you may not need to use often, but in TI BASIC it may be used to obtain an accurate value for the mathematical constant PI: PI=4*ATN(1) This and the other trigonometric functions provided work in radians. You may convert radians to degrees by using ATN: DEGREES=RADIANS*180/4*ATN(1), or more simply DEGREES=RADIANS*45*ATN(1)
INT INTEGER is a numeric function you will use quite often. It removes the fraction from a number, so that 2.3 for instance becomes 2. It is frequently used with the RND function, and can also be used to round decimal numbers. For example, if B is a decimal number to 13 places, and you wish to print only the first two places, you could use: PRINT INT(B*100)/100 If you wanted the last decimal to be 'rounded', the alternative is PRINT INT(B*100+.5)/100
The 99/4A generates pseudo random numbers. If you have a short program:
100 FOR I=1 TO 10 110 PRINT RND 120 NEXT RND
Every time you run the program the SAME 'random' numbers will be printed. This can sometimes be of value if you wish to be certain of the effect but still have the appearance of randomness. You may instruct the computer to start the list of 'random' numbers somewhere else, by adding the line: 90 RANDOMIZE N where N is a numeric variable. The value of N determines where the random numbers begin.
Merely adding 90 RANDOMIZE, without 'seeding' the function with a value, will cause the computer to start at a truly random number, and if you run the program several times, different values will be printed each time.
RND takes a value between 0 and 1, and is usually used in the format: NUMBER= INT(RND*MAXIMUM)+1 The variable NUMBER will then take any integer value from 1 to MAXIMUM, including maximum. The maximum value of RND is .99999' so INT(RND*100) gives a maximum of 99. You have to add the odd 1 to enable you to actually reach the maximum you want.
You may prefer to have at the start of your program: DEF RAN(X)=INT(RND*X)+1 Then when you want a random number up to say 12, you may enter in your program: NUMBER=RAN(12). You have created your own random function. Also see DEF.
Many computers will not equate SQR(4)=2, or fail on some other comparison, due to internal rounding of numbers. Your 99/4A will equate all ten squares up to 100. Try it on a friends computer. (webnote: this was written in 1983) You may not need to use this very often, but it is an indication of the numeracy of the 99/4A. Try:
100 FOR I=1 TO 100 110 A=SQR(I) 120 IF I=A*A THEN 130 ELSE 140 130 PRINT I;"PASSED THE TEST CORRECTLY" 140 PRINT "NEXT VALUE OF I" 150 NEXT I
NOTE that 1,2,4,9,16,25,36,49,64,81 and 100 pass the test OK. The failures are due to internal rounding, which still exists, but it is not quite so marked on the 99/4A as on other computers . If your program needs to make a comparison such as this, use the INT function to remove any (unprinted) fraction. In the program above for instance,there is some improvement by using INT(A*A) in line 120. There is a bigger improvement using 110 A=INT(SQR(I)) which will remove from A any invisible fraction.
100 CALL KEY(0,K,S) 110 IF K=65 THEN 200 120 IF K=66 THEN 250 130 IF K=67 THEN 300 140 IF K=68 THEN 350 150 GOTO 400
In this case, the keys have adjacent ASCII codes, and it would be possible to use:
110 IF S=0 THEN 400 120 IF (K<65)+(K>68) then 400 130 ON K-64 goto 200,250,300,350
100 CALL KEY(0,K,S) 110 IF S=0 THEN 400 120 ON POS("ABCD",CHR$(K),1)+1 GOTO 400,200,250,300,350 omit 130-150
Although you may use a string up to 255 characters long, the POS function is unreliable for strings longer than 127 characters.
SEG$ SEG$ is used when you wish to print a SEGment of a string, or remove a part of a string. TI BASIC uses only one command to segment strings, SEG$. Other computers use LEFT$, RIGHT$, and MID$, but you only really need the one. It is used for instance in this DISPLAY AT routine taken from THE TEXAS PROGRAM BOOK.
100 REM 110 REM PRINT AT X,Y,M$ 120 REM ROUTINE 130 REM 140 FOR J=1 TO LEN(P$) 150 IF Y<32 THEN 180 160 Y=3 170 X=X+1 180 IF X<24 THEN 200 190 X=1 200 CH=ASC(SEG$(P$,J,1)) 210 CALL HCHAR(X,Y,CH) 220 Y=Y+1 230 NEXT J
VAL VAL is intended to make a number contained in a string available as a number, for use in mathematical operations. It changes "2" into 2, and may be used NO=VAL("2"). It is the opposite of STR$, used to change a number into a string: A$=STR$(2) The TI VAL function will change a string such as "2" to the numeric variable 2. For instance: A=VAL("123") This is of great importance when memory space is short, as a string variable representing "2" uses less memory than a numeric variable representing 2. This is explained in the section on Advanced Programming.
Please note that the TI VAL will only work if the string contains numbers only. It will not function for numeric expressions such as "2*3+8" nor if alphabetical letters are used such as "12 APPLES".
Below are some examples of DEFs you may wish to use: To print a random number from 1 to X. At the beginning of your program type: DEF RAN(X)=INT(RND*X+1) Then in your program, when you wish to use such a number, you type (for example) A=RAN(7) or A=RAN(LEVEL) where LEVEL is a numeric variable. Note that although X is used in the defining statement, you may use any number or variable when you use the new function. Although the function has here been called RAN, you may use any name you wish so long as it is not a reserved word( see TI manual for list). The DEF statement is best used at the beginning of your program. DEF PI=4*ATN(1) Then when you wish to use PI in your program, just use the variable PI. NB: This has the same effect if you omit the DEF function. There is no advantage in using DEF instead of a simple LET.
Further uses of DEF may be found in the Advanced Programming Section.
-It is better NOT to use a proportional font to print listings!
If you want to use an array of 16 values, before you use any of the values you must have the line DIM NAME(16) where NAME is the numeric variable for the tower of blocks.
We can place values in the array elements as follows:
100 DIM NAME(16) 110 FOR N=0 TO 16 120 NAME(N)=N*2 130 NEXT N
Now the variable NAME(3) has a value of 6. The variable is referred to in this way, with the 'level' after the variable name, and in brackets.
TI Basic differs from some other basics in the way it handles arrays in some important ways: You must use a number in the DIM statement. A variable is not accepted. Once an array has been DIMensioned, you may not alter the size of the array. If an array variable occurs in your program before a DIM statement, the array is automatically dimensioned as 10. You cannot then use the DIM statement for that array.
Both numeric and string variables may be arrayed.
TI Basic does NOT permit you to use the same name for an arrayed variable and a simple variable. You cannot use both NAME as a variable and NAME(3) say.
Arrays reserve sections of memory, and you should not use a larger array than is needed. A numeric array will use 8 bytes for each element, regardless of the value in the element. A string array initially occupies 2 bytes per element, but as you place strings in the elements,the space for each element will depend on the string you place in it (memory used= number of characters plus 1 byte).
If you can use string arrays instead of numeric arrays, you will usually save a great deal of memory.
A string array can be converted to a number by using the VAL function: eg A=VAL(SCORE$(2)) IF YOU DO THIS,ensure that you place the character "0" (zero) in any empty sectors to prevent possible program crashes.
As stated above, the TI 99/4A will assume the bottom sector is called Number Zero. Often you will find that having the base called Number One is quite adequate. If you do not use the 'zero' element,it is a waste of memory to have that element reserved, and TI allow you to instruct the computer to use a Base of 1.
The instruction to do this is OPTION BASE 1 (Note:The number is NOT in brackets!).
You can use the base 1 for all your arrays or none of them.Once set, you cannot reset the base, and as it is automatically set by any reference to an array before the computer finds the OPTION BASE statement, it MUST occur before any such reference.
In TI Basic therefore, FIRST: If you wish to set the base to 1, use OPTION BASE 1. Then, if your array is to have more than 10 elements, use DIM ARRAYNAME(NUMBER). Then you may use the array!
You may become more familiar with arrays by studying printed programs. (NB:Some other computers use the DIM statement to reserve memory for simple strings. This does not apply to the TI99/A.).
Two dimensional arrays are similar. It may help if you consider the first element name as a hotel floor, and the second as a hotel room. For instance: DIM NAME(FLOOR,ROOM). Use of multidimensional arrays should be cautious, and careful consideration given to the use of OPTION BASE 1. For example, a numeric array having dimensions (20,20) totals 21x21, or 441 elements,at 8 bytes each, that is 3.5k of memory used with just one DIM line! Use OPTION BASE 1 and the number of elements drops to 20x20=400. Times 8=3.2k, saving 300 bytes.
Note: The computer stores the line number from which you GOSUB. This memory is only freed when you RETURN. If you GOSUB, ensure that you RETURN or you will quickly find a MEMORY FULL message appearing.
It IS possible to jump into a subroutine with GOTO provided you jump out with another GOTO, but that type of programming can lead to errors if you are not very careful, and should only be resorted to when you have absolutely no option. This should be rare.
An ideal example of this can be found in a short routine to find out how much free memory there is after you have typed a program in. Add on to the end:
10000 A=A+8 10010 GOSUB 10000
Now type in RUN 10000. This little program will now run, and in due course the MEMORY FULL message will appear. Now type PRINT A, and press ENTER. The value of A is approximately equal to the memory space remaining.
(Your program may still not run even if there is a lot of space remaining: memory is still required to handle the values of the variables, the return addresses of GOSUBs and so on).
You MAY use GOSUB to enter a subroutine at any stage, you do not have to GOSUB to the beginning of a routine.
Within the limitations of memory, you MAY GOSUB from a subroutine, but keep an eye on the number of RETURNS !
The ON...GOSUB command is similar to the ON...GOTO command (which see), except that instead of a simple line transfer, the computer remembers where it has jumped from, and a RETURN will send it back to the line immediately following the ON...GOSUB. REMEMBER to watch your RETURNs.
When you amend a program line by re-entering it or by using the Edit mode, there is a pause before the cursor reappears, which becomes longer the longer your program is. During this pause the computer is deleting the previous version of the line, moving all the following lines up in memory and adding the new version of the line to the bottom of the program memory : in short, doing a great deal of work. When a program is running, and variables are defined, the values of the variables are stored in memory. When a new value is allocated to a variable, to avoid frequent delays to your program, the computer retains the old value in its memory, even though it will use the new value. As time progresses, the memory will become full of these old variable values. When memory becomes full, the computer discards the redundant values : this is called garbage collection. It is more efficient to only do this when memory becomes full than every time a variable is redefined, but a very small pause is caused. These pauses will be more frequent if your program is a long one, as there will be less memory to fill up with dead variable values.
Example: Type in: 100 CALL CLEAR 110 A$="FF818181818181FF" 120 B$="0000FF0000FF0000" 130 CALL HCHAR(12,1,140,128) 140 GOSUB 210 150 CALL CHAR(140,A$) 160 GOSUB 200 170 CALL VCHAR(1,12,140,120) 180 CALL CHAR(140,B$) 190 GOSUB 210 200 STOP 210 FOR T=1 TO 1000 220 NEXT T 230 RETURN 240 END
NEW {ENTER} and repeat: PRINT CHR$(140) {ENTER}
This TI BASIC program simulates two puzzles
The screen is used as a memory device, with CALL GCHAR used to find out what is in a particular position, and then the information is manipulated and new characters displayed.
The program can be speeded up by using a 6x6 array to hold the information and using that instead of GCHAR. This program will work: can you make it work better?
100 REM SQUARES S SHAW 1981 4X4 IS BEST 110 RANDOMIZE 120 DEF RAN(X)=CNT(X*RND)+1 130 GOSUB 2200 140 GOSUB 2100 150 GOSUB 1340 160 GOSUB 980 170 FOR C=8 TO 6+2*V STEP 2 180 FOR C2=5 TO 2*H+3 STEP 2 190 CALL GCHAR(C2,C,C4) 200 POSR=C2 210 POSV=C 220 IF C4=32 THEN 260 230 NEXT C2 240 NEXT C 250 REM 260 IF SCR=0 THEN 300 270 SCR=SCR+1 280 IF SCR=2 THEN 360 290 RETURN 300 CALL KEY(0,A,B) 310 IF A=ASC("P")THEN 130 320 CALL HCHAR(15,22,63) 330 CALL HCHAR(15,22,32) 340 IF B<1 THEN 260 350 KEY=POS("1234567890QWERP",CHR$(A),1)+1 360 IF (H=4)*(KEY>5)THEN 260 370 ON KEY GOTO 260,390,450,520,690,860,890,920,950,2300,2330, 2360,2390,2420,2450,130,130 380 SCR=SCR+1 390 REM ^ 400 IF POSR=5 THEN 260 410 CALL GCHAR(POSR-2,POSV,C3) 420 CALL HCHAR(POSR-2,POSV,32) 430 CALL HCHAR(POSR,POSV,C3) 440 GOTO 170 450 REM DOWN 460 IF POSR=15 THEN 260 470 IF (H=4)*(POSR=11)THEN 260 480 CALL GCHAR(POSR+2,POSV,C3) 490 CALL HCHAR(POSR+2,POSV,32) 500 CALL HCHAR(POSR,POSV,C3) 510 GOTO 170 520 IF H=6 THEN 580 530 IF POSV=8 THEN 260 540 CALL GCHAR(POSR,POSV-2,C3) 550 CALL HCHAR(POSR,POSV-2,32) 560 CALL HCHAR(POSR,POSV,C3) 570 GOTO 170 580 M$="" 590 C5=5 600 FOR C=8 TO 18 610 CALL GCHAR(C5,C,C2) 620 M$=M$&CHR$(C2) 630 NEXT C 640 M$=SEG$(M$,3,9)&SEG$(M$,2,1)&SEG$(M$,1,1) 650 FOR C=8 TO 18 660 CALL HCHAR(C5,C,ASC(SEG$(M$,C-7,1))) 670 NEXT C 680 GOTO 170 690 IF H=6 THEN 750 700 IF POSV=14 THEN 260 710 CALL GCHAR(POSR,POSV+2,C3) 720 CALL HCHAR(POSR,POSV+2,32) 730 CALL HCHAR(POSR,POSV,C3) 740 GOTO 170 750 M$="" 760 C5=5 770 FOR C=8 TO 18 780 CALL GCHAR(C5,C,C2) 790 M$=M$&CHR$(C2) 800 NEXT C 810 M$=SEG$(M$,11,1)&SEG$(M$,2,1)&SEG$(M$,1,9) 820 FOR C=8 TO 18 830 CALL HCHAR(C5,C,ASC(SEG$(M$,C-7,1))) 840 NEXT C 850 GOTO 170 860 C5=7 870 M$="" 880 GOTO 600 890 C5=7 900 M$="" 910 GOTO 770 920 C5=9 930 M$="" 940 GOTO 600 950 C5=9 960 M$="" 970 GOTO 770 980 T$="PRESS APPROPRIATE KEY TO" 990 R=17 1000 VR=3 1010 GOSUB 2260 1020 T$="MOVE BLANK SQUARE" 1030 R=18 1040 VR=3 1050 GOSUB 2260 1060 IF V<5 THEN 1110 1070 T$="OR SLIDE ROWS " 1080 R=19 1090 VR=3 1100 GOSUB 2260 1110 T$="1. UP 2. DOWN" 1120 R=20 1130 VR=3 1140 GOSUB 2260 1150 IF V>5 THEN 1210 1160 T$="3. LEFT 4. RIGHT" 1170 R=21 1180 VR=3 1190 GOSUB 2260 1200 RETURN 1210 T$="3.TOP< 4.TOP> 5.2< 6.2>" 1220 R=21 1230 VR=3 1240 GOSUB 2260 1250 T$="7.3< 8.3> 9.4< 0.4>" 1260 R=22 1270 VR=3 1280 GOSUB 2260 1290 T$="Q.5< W.5> E.6< R.6>" 1300 R=23 1310 VR=3 1320 GOSUB 2260 1330 RETURN 1340 CALL CLEAR 1350 REM DRAW 1360 FOR C=7 TO 7+2*V STEP 2 1370 FOR C2=4 TO 4+2*H STEP 2 1380 CALL HCHAR(C2,C,98) 1390 NEXT C2 1400 NEXT C 1410 FOR C=8 TO 6+2*V STEP 2 1420 FOR C2=4 TO 4+2*H STEP 2 1430 CALL HCHAR(C2,C,96) 1440 NEXT C2 1450 NEXT C 1460 FOR C=7 TO 7+2*V STEP 2 1470 FOR C2=5 TO 3+2*H STEP 2 1480 CALL HCHAR(C2,C,97) 1490 NEXT C2 1500 NEXT C 1510 IF V<5 THEN 1740 1520 FOR C=8 TO 18 STEP 2 1530 FOR C2=5 TO 15 STEP 2 1540 CALL HCHAR(C2,C,45+C/2) 1550 NEXT C2 1560 NEXT C 1570 CALL HCHAR(11,14,32) 1580 RANDOMIZE 1590 T$=" WAIT-RANDOMISING" 1600 R=17 1610 VR=3 1620 GOSUB 2260 1630 FOR Y=1 TO 32 1640 SCR=1 1650 KEY=RAN(14)+1 1660 GOSUB 170 1670 SCR=1 1680 KEY=RAN(2)+1 1690 GOSUB 170 1700 GOTO 1710 1710 NEXT Y 1720 SCR=0 1730 RETURN 1740 REM 1750 C3=65 1760 FOR C=5 TO 11 STEP 2 1770 FOR C2=8 TO 14 STEP 2 1780 CALL HCHAR(C,C2,C3,1) 1790 C3=C3+1 1800 NEXT C2 1810 NEXT C 1820 CALL HCHAR(11,14,32) 1830 REM 1840 T$=" WACT-RANDOMIZING" 1850 R=17 1860 VR=3 1870 GOSUB 2260 1880 FOR Y=1 TO 55 1890 SCR=1 1900 KEY=RAN(4)+1 1910 GOSUB 170 1920 NEXT Y 1930 SCR=0 1940 RETURN 1950 PRINT "SQUARES"::"STEPHEN SHAW 1981":"PRESS '1' OR '2' FOR:" 1960 PRINT "1. 6X6 PROBLEM":"2. 4X4 PROBLEM" 1970 PRINT "FOLLOW DIRECTIONS AT BOTTOM OF SCREEN AFTER DIAGRAM":"HAS BEEN DRAWN" 1980 CALL KEY(0,A,B) 1990 IF A=49 THEN 2050 2000 IF A=50 THEN 2010 ELSE 1980 2010 H=4 2020 V=4 2030 CALL CLEAR 2040 RETURN 2050 H=6 2060 V=6 2070 CALL CLEAR 2080 RETURN 2090 CALL CLEAR 2100 PRINT "SQUARES 1981"::"STEPHEN SHAW STOCKPORT":"THE OBJECT IS TO RESTORE " 2110 PRINT "THE ORIGINAL PATTERN OF ":"SQUARES,WHICH THE CO MPUTER":"HAS SCRAMBLED" 2120 PRINT "USING THE COMMANDS AVAILABLE.":"IN BOTH PUZZLES THE BLANK":"MOVES UP OR DOWN" 2130 PRINT "IN THE 6X6 PUZZLE":"IT CANNOT MOVE > OR < BUT": "THE WHOLE ROW SLIDES " 2140 PRINT "WATCH AS THE COMPUTER":"SCRAMBLES THE ORIGINAL" :"PATTERN TO SEE HOW IT":"WORKS!" 2150 PRINT "(BEING RANDOM YOU MAY END":"UP BACK AT THE START!)" 2160 PRINT "PRESS KEY P TO PLAY AGAIN":"WHEN YOU HAVE COMPL ETED":"YOUR PUZZLE" 2170 INPUT "PRESS ENTER":T$ 2180 CALL CLEAR 2190 GOTO 1950 2200 CALL CLEAR 2210 CALL CHAR(96,"000000FF") 2220 CALL CHAR(97,"1010101010101010") 2230 CALL CHAR(98,"101010FF10101010") 2240 CALL SCREEN(12) 2250 RETURN 2260 FOR G=1 TO LEN(T$) 2270 CALL HCHAR(R,VR+G,ASC(SEG$(T$,G,1))) 2280 NEXT G 2290 RETURN 2300 C5=11 2310 M$="" 2320 GOTO 600 2330 C5=11 2340 M$="" 2350 GOTO 770 2360 C5=13 2370 M$="" 2380 GOTO 600 2390 C5=13 2400 M$="" 2410 GOTO 770 2420 C5=15 2430 M$="" 2440 GOTO 600 2450 C5=15 2460 M$="" 2470 GOTO 770 2480 END
Web Stats Note 1: AddFreeStats will try to set a cookie when this page is loaded. The cookie relates to "*.addfreestats.com/" only and records that your iP address looked at this page, for purposes of tracking re-visits. . The cookie can be safely refused without impairing your web enjoyment. At present I cannot locate a relevant privacy policy on their site. How to manage and delete cookies Note 2: IF you click this link to AddFreeStats you will need to have javascript enabled to use their website. Otherwise you will see a blank page! Again, their foolishness will not interfere with your enjoyment of THIS web site!