Gold Runner
A game for the PX-42F calculator, in the style of the classic Lode Runner
You are a lone runner in a maze of brick floors, ladders and ropes. Gold lies about, and guards want you. Take every piece of gold, then climb out of the top of the screen. You can't jump and you can't fight: all you can do is run, climb, hang from ropes and dig holes for the guards to fall into.
Starting the game
Gold Runner is a Games & Apps program. It needs the PX-42F firmware with app API version 3 or later (a firmware from the same time as this game will do).
- Copy
GOLDRUN.bininto theBIN/GAMESfolder of thePX-42Fdrive. (Settings → USB Drive → Connect to Computer makes the drive appear on your computer; the project'smake installdoes the copy.) - Eject the drive and let the calculator come back.
- Settings → Games & Apps → Games → GOLDRUN.
The game runs on its own, then the calculator comes back just as you left it: your stack, programs and the rest are not touched.
The title screen
- ENTER (or R/S) starts a game.
- The game starts at the highest level you have reached. ▲ and ▼ (or 8 and 2) pick a lower one, or go back up to the highest.
- ON goes back to the Games & Apps menu.
The keys
The number keys are a direction pad, as they are laid out on the calculator:
Move and dig
| Key | Does |
|---|---|
| 4 6 | Run left, right. Along a rope, you move hand over hand. |
| 8 2 | Climb up, down a ladder. On a rope, 2 lets go and you drop. In a hole, 8 climbs out. |
| ▲ ▼ | The same as 8 and 2, if you prefer them. |
| 7 9 | Dig a hole on your left, right. |
| Σ+ XEQ | The same as 7 and 9: the two top corner keys, handy with a thumb on each side. |
| R/S | Pause. R/S again to go on, or ENTER to end the game and go back to the title screen. |
| a short ON | Pause too. On the pause screen ON quits Gold Runner. |
| ← (backspace) | Give up a man: you lose one and the level starts again. For when you are stuck. |
| ON held 2 seconds | Turns the calculator off, as everywhere. |
A key you hold keeps you moving; a quick tap moves you a little (a quarter of a tile), good for lining up exactly. Holding two directions follows the one pressed last. Everything is done by the position of the keys, so it works the same whatever the key labels say, and in ALPHA mode.
The screen
A level is 28 tiles wide and 16 high. The black bar at the top shows:
LV 1 SCORE 000250 MEN 5 GOLD 8
- LV: the level you are on.
- SCORE: your points.
- MEN: how many lives you have, counting the one you are playing.
- GOLD: how much gold is still to be taken. It includes the gold the guards are carrying.
What things are
| Thing | What it does | |
|---|---|---|
| Brick | A floor or wall. You and the guards can't walk through it. You can dig it. | |
| Solid wall | The same, but it can't be dug. The bottom row is always this. | |
| Ladder | Climb up and down. You can step off it to either side. You can stand on the top of one. | |
| Rope | Hang from it and move along it. Let go with down. You grab it if you fall onto it. | |
| Gold | Walk onto it to take it. | |
| You | Faces the way you last went. Has its own pictures for running, climbing, hanging, falling and digging. | |
| A guard | The same figure with a hollow head. A small mark at the top right of him means he is carrying gold. |
There is one more thing you can't see: in every level a hidden ladder waits for you to take the last piece of gold. When you do, a high tone plays and the ladder appears, going up to the top of the screen.
How to play
When a level starts, its name and number are shown over the map. Press any key, or wait four seconds, to begin. The guards start moving at once.
- Take all the gold. Just walk onto each piece. GOLD in the bar counts down.
- Get to the top. The ladder that appears leads to the top row. Reaching the top row finishes the level: you get a bonus and a spare man, and the next level starts.
- Don't get caught. A guard touching you costs a man.
Moving about
- You stand on bricks, on solid walls, on the top of a ladder, and on a trapped guard's head. Anywhere else, you fall. A fall can be as long as the screen is high, and it doesn't hurt.
- You can't jump or climb a single step. To get up to another floor you need a ladder.
- Moving up needs a ladder (or a hole you are in). To step on or off a ladder you must be lined up with it: if you press up or down a little to one side of one, you slide to the middle first.
- On a ladder you can only step to the side when you are level with a floor.
- Hanging from a rope, you can go along it, drop with 2, or go on to a floor at its end.
Digging and guards
Digging
Stand still on a floor beside a brick and press 7 (left) or 9 (right). You turn and dig the brick below and beside you, the one just in front of your feet, not the one under them. The brick wears away for about a quarter of a second, during which you can't move, and then a hole is there.
You can dig when:
- you are standing on something, lined up with a tile (not in the middle of a step), and not on a ladder or a rope;
- the tile beside you is empty, and the tile below that one is a brick;
- no guard is in the way.
If you press the key when you're not quite lined up, the game waits a moment (about a third of a second) for you to be, and digs then.
What a hole does
- It stays open for about 5 seconds. For the last half second you see the brick growing back from the bottom.
- If the floor is one brick thick, the hole goes right through: whoever steps in falls to the floor below. That is a way down when there's no ladder.
- If the floor is two bricks thick or more, the hole has a bottom, and whoever steps in is trapped.
- You can climb out of a hole by pressing up, whenever you like.
- When the brick comes back, anyone still inside it is lost. For you that is a man; for a guard, a score of 75 points.
The guards
- Each guard hunts you by the shortest way he can find, up and down ladders, along ropes, and into holes. If there is no way to you he wanders towards you as well as he can.
- He runs two thirds as fast as you, so you can always outrun one on the level, but he doesn't give up.
- A guard that falls into a hole is trapped for roughly four or five seconds, then climbs out. If the brick returns first, he is gone, and a new one appears from the top of the screen.
- Guards can't pass through one another, but they walk over a trapped guard's head, and so can you.
- A guard that walks over gold picks it up. He carries it for a while and then drops it where he is standing. If he falls into a hole he drops it at once, onto the floor above the hole. A trapped guard that is carrying gold is how you get it back.
Men and score
| You get | Points |
|---|---|
| a piece of gold | 250 |
| a guard lost to a closing hole | 75 |
| a level finished | 1500, and an extra man (up to 9) |
- You start a game with 5 men. Being caught, being in a hole when it closes, or giving up with ← costs one, and the level starts again from the beginning, with all its gold.
- When the last man goes: GAME OVER. ENTER goes back to the title screen.
- Finish the last level and you win.
- Your best score is kept, and shown on the title screen. A new best is saved when the game ends, or when you leave it.
Tips
- Look first. The game doesn't wait, but the level name screen does, and the guards only start after you press a key.
- Dig before the guard is on top of you. A hole in the guard's way, one tile ahead of you, is the safest trap. Dig, step back, and watch him fall in.
- Mind the clock. A guard falling in late is trapped for less time than the hole stays open, so he may be lost; falling in early he climbs out before it closes. Either is fine, as long as you are not near.
- Don't dig yourself in. If you drop into a hole, press up at once to climb out. Waiting inside when it closes costs a man.
- Let guards do the carrying. A guard with your gold in his hands is out of the way and slow. Trap him to get it back.
- Use the heads. A trapped guard is a bridge across a pit, and can be a step to a ladder top you couldn't reach.
- Ropes are escape routes. A guard has to go all the way round to follow you across a gap that you cross hand over hand, and you can drop off in the middle.
- A level that has gone wrong (a guard stuck with the last gold, say) can be restarted with ←, at the cost of a man.
Your own levels
The game has six levels built in. For others, make a text file named LEVELS.TXT and
put it in the game's own folder on the drive, BIN/GAMES/GOLDRUN/ (the folder is made the
first time the game saves something; make it yourself if it isn't there). If the file has any levels in
it, they replace the built-in ones: up to 255 of them and 80 KB. Delete the file to get the
built-in ones back. Your saved progress is by level number, so changing the levels can leave you with
a "highest level" that no longer means anything: reset it by deleting SAVE (see below).
The format
Each level is 16 lines of 28 characters, one for each row of tiles, from the top of the screen down.
Shorter lines are filled with spaces; longer ones are cut. A blank line ends a level. A line starting with
; is a comment, and the last comment before a level is its name, shown on the level screen
(up to 23 characters).
| Character | Is |
|---|---|
# | brick (can be dug) |
@ | solid wall (can't be dug) |
H | ladder |
- | rope |
$ | gold |
S | a ladder that appears when all the gold is taken |
& | where you start (one a level) |
0 | a guard (up to 6 a level; a seventh is left out) |
. or space | empty |
Use . for empty tiles, not spaces: a line of nothing but spaces counts as a blank line and
ends the level.
; Two floors
..........................S.
..........................S.
..........................S.
..........................S.
..........$.....$.........S.
####H#######################
....H.......................
....H.......................
....H.......................
....H.......................
....H.........$...0.........
######################H#####
......................H.....
......................H.....
..&.....$.............H.....
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
A level needs all 16 lines; one with fewer is ignored. Check yours with the checker below.
Making them playable
- Put solid wall (
@) along the bottom row. The edges of the screen are walls, and so is everything outside it, including above the top row. - The way out. Put the
Sladder in one column from the floor you can reach to the top row (row 1 of the file). You finish by reaching the top row. - Ladders between two floors run from the brick row of the upper floor down to the walking row of the lower one, so you can step off at both ends. A ladder can be one tile longer at the top: you can climb one tile above its end.
- Floors one brick thick let you and the guards fall through a dug hole. For a trap use two bricks.
- A tile holds one thing. Gold, a guard, or your start on a rope or ladder tile replaces it (a guard or start tile ends up as empty). Keep ropes and ladders clear of them.
- Gold in a pocket of bricks is fine: you dig down to it. Gold you can never reach, or a top you can never get to, is not (see the checker below).
- Digging is only possible with a brick below an empty tile, so a floor with a brick wall beside it stops you digging that way.
The checker
On your computer, python3 tools/make_levels.py MYFILE.TXT (in the Gold Runner project) checks
a file: exactly one start, some gold and an S, no unknown characters, at most 6 guards, and
that from the start you can reach every piece of gold and, after that, the top row. The check counts
digging generously (any brick beside a floor can be dug, in any order) and ignores the guards, so a level
that fails it has a real mistake, while one that passes can still be too hard.
The built-in levels are written the same way, in levels/builtin.txt. Run
python3 tools/make_levels.py with no file after changing that, to check them and rebuild
src/levels_data.c; then make.
Files the game keeps
File (in BIN/GAMES/GOLDRUN/) | Is |
|---|---|
SAVE | Two numbers in a text file: your best score and the highest level reached (counting from 0). Written when a level is finished and when a game ends. Delete it to start from nothing. |
LEVELS.TXT | Your levels, if you made some (above). |
The game only writes the drive when a level is finished or a game ends, never while you play, so it doesn't wear the calculator's flash.
If something is wrong
| You see | Try |
|---|---|
| GOLDRUN isn't in the Games menu | The file must be in BIN/GAMES (not BIN/APPS) on the drive.
The firmware must support app API version 3. |
| The calculator says the app can't run | The firmware is older than the game needs. Update it (Settings → USB Drive → Update Firmware). |
| My levels don't appear | The file must be named LEVELS.TXT, in the game's folder
BIN/GAMES/GOLDRUN/, and each level needs all 16 lines. Check it with make_levels.py. |
| I can't dig | You must be standing still on a floor (not on a ladder or rope), with an empty tile beside you and a brick below that tile. A hole already open there doesn't count either. |
| I can't get the last gold | A guard is carrying it. Trap him, or wait: he drops it after a while. |
| The ladder to the top didn't appear | Look at GOLD in the bar: it isn't 0. A guard has some. |
| I'm stuck | ← gives up a man and starts the level again. |
| The calculator turned off | Held ON for 2 s, the Sleep Timer ran out, or the battery is empty. The game ends, and the calculator's own memory is as you left it. |
For tinkerers
The game is open source and built with the PX-42F app framework. The numbers that set how it plays
are at the top of src/gold.c:
| Name | Is | Now |
|---|---|---|
TICK_MS | the length of a step; everything moves one step at a time | 45 ms |
OPEN_TICKS | steps a hole stays open | 120 (5.4 s) |
ESCAPE_MIN, ESCAPE_RANGE | a trapped guard climbs out after this many of his steps, plus up to the range | 55 + 0-29 |
GUARD_MOVES / GUARD_PERIOD | a guard moves on this many steps out of every this many | 2 of 3 |
CARRY_MIN, CARRY_RANGE | how long a guard keeps gold before dropping it | 70 + 0-89 |
START_LIVES | men at the start | 5 |
GOLD_POINTS, GUARD_POINTS, LEVEL_POINTS | the scores | 250, 75, 1500 |
The pictures are drawn as text in src/sprites.c (an X is a black pixel) and can be
edited as they look. make sim plays a scripted game on a computer and saves screenshots;
make sim CFLAGS_SIM=-DGR_TRACE prints where everyone is on every step.