The Pyramid Game
Test your problem-solving abilities with this intriguing puzzle for the Amiga. Careful attention to detail and great graphics make this game an impressive one. 512K of memory and Workbench 1.2 are required.
"The Pyramid Game" is a classic strategy puzzle that demonstrates the power of Amiga Basic. It's a stacking game in which you rear-range disks on a stick, attempting to sort them by size.
I wrote the first version of The Pyramid Game in C for an IBM-compatible computer. Suprisingly, the Amiga Basic version is nearly as fast as the original.
The Pyramid Game requires luck, skill, and logic for the best scores. If you're a programmer, take a close look at the Amiga Basic listing. You'll learn about using fonts in BASIC programs. You'll also learn how to move graphic images quickly.
Typing It In
The Pyramid Game is written entirely in Amiga Basic. Type it in and save it to disk.
The Pyramid Game requires two system files: graphics.bmap and diskfont.bmap. You can find these files on your Extras disk. Use the CLI to copy them from the Extras disk to the libs directory of your Workbench disk. The Pyramid Game uses several system fonts, so be sure to boot up with a Workbench disk that has all the fonts (the Workbench disk that came with your computer should work.)
In this game, the player is well on the way to solving the puzzle.
To run The Pyramid Game, simply double-click on its icon from the Workbench. AmigaBASIC will load, and The Pyramid game will start automatically. It is very important to start the program by double-clicking on it's icon, rather than loading Amiga Basic from the CLI, otherwise you'll get an "Out of heap space" error on an Amiga with 512K of memory. Don't try to run other programs at the same time; otherwise, you'll get the same error.
Solving The Puzzle
When the game begins, you'll see the title screen. Press a key to begin. The Pyramid Game is divided into two windows. The left window shows the puzzle itself. The right window shows the status of the game, including how many moves you've made and how to exit the game.
The puzzle is a stack of 16 rectangluar pieces, each a different size. The pieces are scrambled at the beginning of the game; press a key to stop the movement.
Each position is labeled with a letter from A to P. When a corresponding key is pressed, all pieces from that letter to the top are inverted. For example, if you press the D key, the piece at A will swap places with the piece at D, and the piece at B will swap places with the piece at C.
With a little luck and some careful thought, you should be able to arrange the pieces into a pyramid. When you've solved the puzzle, a window labeled "options" appears on the screen. This window gives you a short menu. You can choose X to exit the game, R to replay the same game, or N to start a new one.
The R option is useful when you want to try to better your previous score with the same puzzle, or when you're competing with a friend. Use the N option for a new configuration of the puzzle pieces.
Incidentally, you should not exit from the game with the Amiga Basic Quit menu option, or with Control-C. If you do, the custom screen used by The Pyramid Game remains open, and thus uses valuable memory.
About The Program
The Amiga Basic GET and PUT statements use the powerful Amiga hardware to move image blocks, so they're very fast. The 16 puzzle pieces are first drawn on the screen with line commands, and then stored in a two-dimensional array with the GET command. Another array is used to keep track of the position of the pieces as they are shuffled and then moved.
The Pyramid Game also demonstrates how to use disk-based fonts in Amiga Basic.