hrd — the puzzle game: HuaRongDao
Synopsis
hrd [pattern]Description
Run the RuaRongDao game with the "pattern" if one is given at the command line, otherwise run the game with the default pattern. See the PATTERN section below for more information.HuaRongDao is an ancient Chinese game. The rules are very easy to understand, but the game is not so easy to solve.
The aim of the game is to move pieces in order to free the largest one from the bottom side of the board, with as few steps as possible. You may not make one piece jump over another, nor can any two pieces overlap. Continuously moving one piece is counted as a single step.
Usage
The following commands are supported by this program.- 0-9
- Mark the desired piece selected. The peice is then moved by one or two direction letter: l for LEFT, r for RIGHT, u for UP, or d for DOWN. Normally the arrow keys can also be used as the direction command.
- q
- Quit the game.
- u
- Undo one step.
- r
- Redo one step.
- b
- Save a bookmark. A single letter is prompted as the bookmark slot, valid bookmarks are a-z, A-Z, or 0-9.
- l
- Load from a bookmark. A bookmark slot is prompted.
Ctrl-C can be used to cancel the current command. ENTER can be used to reset the prompt and echo area.
Ctrl-L can be used to redraw the screen.
Pattern
A pattern can be encoded as a string. Each grid of the board is encoded as a letter. Each row is followed by a dot.- Q
- To indicate a big square.
- L R
- To indicate the left and the right of a horizontal rectangle respectively.
- T B
- To indicate the top and the bottom of a vertical rectangle respectively.
- P
- To indicate a small square.
- _
- To indicate an empty grid.
The dafault pattern can be encoded as TQQT.BQQB.TLRT.BPPB.P__P.
Files
- $HOME/.hrd/bookmark
- The bookmark file.