jurjen@cwi.nl (Jurjen NE Bos) (08/19/90)
Here is the game HEXATOM for the HP48SX. If you never heard about it, that's
OK, because I invented it a few years ago with a friend.
It looks a little bit like the game "Black Box" (trademark of ?).
The rules are as follows:
There is a board consisting of 50 hexagons. In those hexagons, there
is a number of atoms hidden by your opponenent (in this case, the calculator).
You must try to find the atoms by sending light rays through the grid.
You can send a light ray from any side of the board, so that there are six
directions.
A light ray is absorbed if it runs into an atom, and it bounces off if it
comes close to an atom:
_ _ _ _ _ _ _ _
_/ \_/ \_/ \_/ \_ _/ \_/ \_/ \_/ \_
\_/ \_/*\_/ \_/ \_/ \_/*\_/ \_/
_/ \_/.\_/ \_/ \_ _/ \_/ \_/ \_/ \_
\_/.\_/ \_/ \_/ \_/ \_/.\_/ \_/
_/.\_/ \_/ \_/ \_ _/ \_/.\_/.\_/ \_
.\_/ \_/ \_/ \_/ \_/.\_/ \_/.\_/
_/ \_/ \_/ \_/ \_ _/.\_/ \_/ \_/.\_
\_/ \_/ \_/ \_/ .\_/ \_/ \_/ \_/.
Absorbed by an atom Reflected
A move is done by sending a light ray. As reply you get the edge of the board
at which the ray left the board, and "---" if it is absorbed.
Watch out for combinations like this:
_ _ _ _ _ _ _ _
_/ \_/*\_/ \_/ \_ _/ \_/ \_/ \_/ \_
\_/ \_/ \_/ \_/ \_/ \_/*\_/ \_/
_/ \_/.\_/ \_/ \_ _/ \_/ \_/*\_/ \_
\_/.\_/*\_/ \_/ \_/ \_/.\_/ \_/
_/.\_/ \_/ \_/ \_ _/ \_/.\_/ \_/ \_
.\_/ \_/ \_/ \_/ \_/.\_/.\_/ \_/
_/ \_/ \_/ \_/ \_ _/.\_/ \_/ \_/ \_
\_/ \_/ \_/ \_/ .\_/ \_/.\_/ \_/
Absorbed by two atoms Double reflection
There is also a triple reflection, which in effect reverses the ray.
The game is started by pressing PLAY (the first variable), and then
entering the number of atoms you like. It gets harder with more atoms,
of course.
The program draws a board on the screen, with the atoms hidden.
You now have the following options:
1-5 selects a (wiggly) row of tiles
A-J selects a column of tiles
S-X selects a direction
Backspace erases the selection
ENTER sends a ray, and tells you the exit position
* shows where the atoms are
(blue) OFF turns the calculator off in the middle of a game
The best way to try out everything is to press * immediately. You can then
see how things work, before starting to play seriously.
Happy playing!
@HEXATOM written by Jurjen N.E. Bos
@August, 1990
%%HP: T(3)A(R)F(,);
DIR
PLAY
\<< init
WHILE 1
REPEAT draw 0 WAIT unmark
CASE DUP 20 <
THEN IP 10 - col
END DUP 25 <
THEN IP 14 - col
END DUP 40 \>= OVER 50 < AND
THEN IP 40 - dir
END { 82,1 83,1 84,1 72,1 73,1 } OVER POS DUP
THEN row DROP
END DROP { 51,1 55,1 91,3 75,1 } SWAP POS DUP
THEN { enter \<< { 0 0 0 } 'move' STO \>> OFF unhide }
SWAP GET EVAL
END DROP 335 ,07 BEEP
END
END
\>>
ATOMS { }
M 0
move { }
FIELD
\<< "GROB 128 64 "
"0007C3C178FC7C111704000C1000000000884422980402211204000800C00000" +
"00884420190402011204000887C00000008FC320197C320F1204000888000000" +
"00884420190402311244000888C0000000884422980402211244000888C00000" +
"0088C3C178F40C311783000C9800000000000000000000000000000000000000" +
"008F00E308F00E308F0000E00200000000401014040101404010001102C00000" +
"00401014040101404010001547C0000000202808020280802020001542000000" +
"F1202808020280802020001542C000001010C700F10C700F10C700154AC00000" +
"F020280802028080202800E87400000001202808020280802028000000000000" +
"0140101404010140401010000000000011401014040101404010100000000000" +
"E08F00E308F00E308F00201931D340000040101404010140401010B54150A000" +
"00401014040101404010105541D1A0000020280802028080202800154A40A000" +
"80202808020280802028001934C34000C010C700F10C700F10C7000000000000" +
"A020280802028080202800000000000090202808020280802028000000000000" +
"F140101404010140401010000000000080401014040101404010100000000000" +
"808F00E308F00E308F00200000C1000000401014040101404010100000220000" +
"0040101404010140401010000020000000202808020280802028000000C10000" +
"E02028080202808020280000000200001110C700F10C700F10C700002222E300" +
"01202808020280802028000022C18000E0202808020280802028000041008000" +
"01401014040101404010100080E3800011401014040101404010100041148000" +
"E08F00E308F00E308F002000221480000040101404010140401010002A088000" +
"0040101404010140401010000808000000202808020280802028000004001000" +
"E02028080202808020280000080800001110C700F10C700F10C700002A082200" +
"01202808020280802028000022142200C0202808020280802028000022142200" +
"204010140401014040101000A2E32200104010140401014040101000A2002200" +
"F18F00E308F00E308F002000632222000040101404010140401010002222C100" +
"0040101404010140401010000022000000202808020280802028000000410000" +
"402028080202808020280000004100006010C700F10C700F10C7000000800000" +
"4020280802028080202800000080000040202808020280802028000000000000" +
"4040101404010140401010000000000040401014040101404010144000080000" +
"E08F00E308F00E308F0024400008000000001014040101404010144E44EC17E6" +
"000010140401014040101C719209882900002808020280802028044F11E98829" +
"0000280802028080202804418219A8290000C700F10C700F10C7044E44E11729" +
OBJ\-> DUP 'FIELD' STO
\>>
init
\<< FIELD PICT STO { } 'PL' STO 0 'M' STO { 5 1 6 } 'move' STO
"HEXATOM by Jurjen Bos
number of atoms:" { "5" { -1 1 } V } INPUT OBJ\-> { }
DO RAND 5 * IP 1 + RAND 10 * IP 1 + L\->C
IF DUP2 POS
THEN DROP
ELSE +
END
UNTIL DUP2 SIZE \<=
END 'ATOMS' STO DROP { # 0h # 0h } PVIEW
\>>
row
\<< 'move' 1 ROT PUT mcol
\>>
col
\<< 'move' 2 ROT PUT mrow
\>>
dir
\<< 'move' 3 ROT PUT move LIST\-> DROP2
CASE DUP2 AND
THEN
IF move check NOT
THEN 'move' 1 0 PUTI 0 PUT
END DROP2
END
THEN mrow DROP
END
THEN mcol
END
END
\>>
check
\<< LIST\-> DROP 3 DUPN
IF 0 > ROT 0 > AND SWAP 0 > AND
THEN { 0 DROP 5 10 AND 5 10 > 1 0 DROP 1 1 > 1 1 AND 5 }
SWAP 3 * DUP 2 - SWAP SUB LIST\-> DROP
5 ROLL == 4 PICK 2 MOD ROT EVAL ROT ROT == OR
ELSE 3 DROPN 1
END
\>>
draw
\<< PICT (105;68) move M\->S 2 \->GROB REPL
IF 9 FS?
THEN move mark
END
\>>
mark
\<< LIST\-> DROP ROT ROT L\->C dirs ROT GET 2 / - (-1;1) +
'PL' OVER STO+ PICT SWAP GROB 3 3 705070 GXOR
\>>
unmark
\<< 1 PL SIZE
IF DUP2 \<=
THEN
FOR I PICT PL I GET GROB 3 3 705070 GXOR
NEXT { } 'PL' STO
ELSE DROP2
END
\>>
L\->C
\<< DUP 7 * SWAP 2 MOD 2 / ROT + 10 * R\->C
\>>
M\->S
\<< LIST\-> DROP ROT 9 SF
IF DUP NOT
THEN DROP " " 9 CF
END ROT
IF DUP
THEN 64 + CHR
ELSE DROP " " 9 CF
END + SWAP
IF DUP
THEN 82 + CHR
ELSE DROP " " 9 CF
END +
\>>
enter
\<<
IF 9 FS?
THEN PICT (107;50) 'M' INCR 1 \->GROB REPL
IF SCAN
THEN "---"
ELSE DUP mark M\->S
END PICT (105;60) ROT 2 \->GROB REPL
ELSE 335 ,07 BEEP
END
\>>
SCAN
\<< move LIST\-> DROP dirs SWAP 6
START LIST\-> ROLLD 6 \->LIST
NEXT ROT ROT L\->C
WHILE ATOMS OVER POS NOT
OVER C\->R DUP 5 > SWAP 55 \<= AND OVER 0 > AND SWAP 70 \<= AND AND
REPEAT SWAP
CASE DUP2 2 GET + ATOMS SWAP POS
THEN
DO LIST\-> ROLLD 6 \->LIST
UNTIL DUP2 2 GET + ATOMS SWAP POS NOT
END
END DUP2 6 GET + ATOMS SWAP POS
THEN
DO LIST\-> ROLL 6 \->LIST
UNTIL DUP2 6 GET + ATOMS SWAP POS NOT
END
END
END SWAP OVER 1 GET +
END
IF ATOMS OVER POS
THEN DROP2 1
ELSE SWAP 4 GET SWAP OVER +
C\->R 10 / IP SWAP 7 / ROT dirs SWAP POS 3 \->LIST 0
END
\>>
unhide
\<< 1500 ,03 BEEP 1 ATOMS SIZE
FOR I ATOMS I GET PIXON
NEXT
\>>
dirs { (0;-10) (-7;-5) (-7;5) (0;10) (7;5) (7;-5) }
mrow
\<< move 1 5 PUT check move 1 1 PUT check
CASE OVER XOR
THEN 4 * 1 + 'move' 1 ROT PUT
END NOT
THEN 'move' 1 0 PUT
END
END
\>>
mcol
\<< move 2 10 PUT check move 2 1 PUT check
CASE OVER XOR
THEN 9 * 1 + 'move' 2 ROT PUT
END move check AND NOT
THEN 'move' 2 0 PUT
END
END
\>>
PL { }
PPAR { (-6;5) (124;68) X 0 (0;0) FUNCTION Y }
END
ON exits the game
--
| | "Never imagine yourself not to be otherwise than what |
| Jurjen N.E. Bos | it might appear to others that what you were or might |
| | have been was not otherwise than what you had been |
| jurjen@cwi.nl | would have appeared to them to be otherwise." |