Fractal Image

Graphical Calculator

General
Home Page
About Me
Gryphon's Jokes
Fractal Images
Air Attack
About Air Attack
Dogfight Animation
3D Planes Illusion
Flight Tips
Tactical Test
Jedi Squadron
Games
Warcraft 2 Clan
Doom
Programming
Java - Artificial Life
Lotus 123 Scripts
Casio Graphic Calculator
AI Wars
QBASIC
ICQ

A graphical calculator is essential for all A-level maths students and the course includes some programming. I found the language of my CASIO fx-7300G easy to pick up with my experience and enjoy writing programs for it. Sometimes when we do programs in lessons I end up teaching the teacher! I often see a better way of doing things than what is in the textbooks too.

My most impressive program was a 3D maze. There were two problems: calculators are not designed for this sort of thing and I only had 500 bytes of program memory and 26 variables. This made a relatively simple program difficult because it forced me to think carefully and make the code as short as possible. At first I did not know whether it was possible to fit it in 500 bytes; it had to be perfectly optimised for program size. The programs are shown below. Note that -> represents the assignement operator and not - then >. Also => is the conditional operator.

Program 0:
Lbl 2
Prog 7
60->M
Lbl 1
Plot 0,0
Dsz M:Goto 1
Q=1=>Prog 1
Q=1=>Goto 2
?->N
1->0
N=8=>Prog 1
N=6=>Prog 2
N=4=>Prog 3
Goto 2
Program 1:
K+I->X
L+J->Y
Prog 9
V=0=>X->K
V=0=>X->K
Program 2:
-1->O
Prog 3
Program 3:
JO->P
-IO->J
P->I
Program 6:
.2(.6^M-1)/-.4-->N
.2(.6^(M+1)-1)/-.4->O
P=1=>1-N->N
P=1=>1-O->O
V=1=>Plot N,N
V=0=>Plot N,O
Plot O,O
Line
Plot O,1-O
Line
V=1=>Plot N,1-N
V=0=>Plot N, 1-O
Line
M=0=>V=0=>0->Q
Program 7:
1->Q
Range 0,1,0,0,1,0
Plot 1,0
Plot 1,1
Line
Plot 0,1
Line
0->M
Lbl 1
K+MI-J->X
L+MJ+I->Y
1->P
Prog 9
Prog 6
0->P
K+MI+J->X
L+MJ-I->Y
Prog 9
Prog 6
Isz M
K+MI->X
L+MJ->Y
Prog 9
M>5=>Goto 2
V=0=>Goto 1
Plot O,O
Plot 1-O,O
Line
Plot O,1-O
Plot 1-O,1-O
Line
Lbl 2
M=1=>0->Q
Program 9:
X+16Y->W
Int (W/32)->U
Int (A[U]/2^(W-32U))->W
1->V
W/2=Int (W/2)=>0->V

Total Memory Used: 479

Notes:

The programs may be put in different slots but do not forget to change the subroutine calls (`Prog' command). If your calculator gives programs names instead of numbers then change the 'Prog' commands appropriately .

Controls:

To start run program 0. When the question mark is displayed enter 8 to move forward, 4 to turn left and 6 to turn right (this corresponds to the arrows on the numeric pad on a computer keyboard).

Maze Design:

The maximum size of a maze is 16x16. All of the information is stored in the value memories A to H. Each contains information for 32 squares or two rows in the maze. The programs do not include a maze, you must set it up yourself. Here is an example:

3222405119->A
2688937813->B
2197924733->C
2685516765->D
2886840279->E
2890247509->F
2902560125->G
4294943231->H
1->K:6->L:1->I:0->J

You can type these in comp mode or enter them in a program so that if you use these variables in other programs you will not have to type in all of the numbers again. K and L are the X and Y co-ordinates of you in the maze and can range from 1 to 14 (0 and 15 are at the edges of the maze and should always contain walls). I and J are the direction which you face and may only be one of four combinations:

I 1 -1 0 0
J 0 0 1 -1
Direction East West North South

If you want to design your own maze then first draw a 16 by 16 grid and mark which squares contain walls. Next split it into groups of two rows, the top pair are stored in variable A, then next in variable B and so on. Set each variable to 0. For each variable take the two rows it represents and write the numbers 0 to 15 in the top row and 16 to 31 in the bottom row. Now look at which squares have walls, for each one add 2 to the power of the number in it to the variable. There are two limitations to your design: it must have a wall all around the edge and you can not have open spaces (no corridors wider than 1 square).