Shisen1K - A 1k version of Shisen a public domain minigame by Paolo Ferraris (pieffe8@libero.it) For ZX Spectrum 16k/48k/128k/+2/... blah blah blah! This minigame does not work with hardware devices like Microdrive and Interface 1 that change the memory address where BASIC programs are loaded. What is new in version 1.21 - This file has been almost completely rewritten. No code changes. What is new in version 1.2 - Fixed a bug introduced in version 1.1. That caused improper reinsertion of tiles with the back command, in the variant without gravity. What is new in version 1.1 - Shisen1K now hilights all tiles of the same kind of the one under the cursor (that's for compensating the fact that in the real Shisen tiles are more distinguishable) - Sound effects, when removing two tiles, added Shisen is a game similar to Mahjongg, and it uses the same tile set. The board consists of tiles arranged randomly to form a rectangle (normally 18x8, in this minigame 14x6). The goal of the game is to remove all tiles from the board. There are four tiles of each kind, and you can remove only pairs of tiles of the same kind. Two tiles (of the same kind) can be removed only if they can be connected by at most three horizontal or vertical segments that do not pass over other tiles. Examples of valid moves one segment is enough: A-------A A | | A two segments are needed here: A | +--A no way to remove the two A's with one or two segments for the presence of other tiles, but with 3 it is okay: A | C +--+ B | | A A--+ | | B | | A--+ next situation is a deadlock: there is no way to link the two A's with at most three segments without passing over B, and the same for the B's. AB BA Risk of deadlock: if we remove the two A's on the left, we go to the previous example. That shows how it is important to choose carefully the pairs of tiles to be removed. A AB A BA Shisen 1k supports the gravity variant of the game by default: each time a pair of tiles is removed the tiles that were above fall down. Next situation will bring to a deadlock without gravity: AB BA CCDD but with gravity, if we remove the two D's, we get: A BB CCA where the two B's and the two A's can be removed. The main commands are four arrows : move the cursor ENTER : select the tile under the cursor [If you are using a real 40-key Spectrum 16/48k or your emulator doesn't support the arrow keys (very unlikely), you can use the key combinations CAPS SHIFT+5,6,7,8]. If the cursor is over a tile, all tiles of the same kind are highlighted also. To remove a pair of tiles, just select them in sequence. To deselect a tile, press ENTER on that tile again. To start a new game, you can choose among the following commands N : start with a new random board backspace : toggle gravity on/off and start with a new random board S : choose the board to start the game [backspace on an original 40-key Spectrum is CAPS SHIFT+0] A board number ranges from 1 to 65535, inclusive. The board number for current game is reported in the bottom left of the screen. Pressing 'S' a flashing "L" appears. You can now type the board number. Shisen 1k can help you finding which tiles can be removed. H : show available moves Each time 'H' is pressed, a different pair of tiles that can be removed is shown, until there are no pairs left. Pressing ENTER when a pair is shown removes such pair. If 'H' is pressed when a tile is selected, only pairs that contain such tile are shown. Shisen1K remembers all removals done so far, and allows to go back and forward these moves. The keys that can be used for that are B : back F : forward R : restart the board (i.e. undo all removals done so far) L : last move (i.e. undo all 'back' commands) Note that using these keys is considered cheating. The border color, that is initially cyan, changes to give some information. White : you win! Black : sorry, no moves left Red : you cheated! I hope you will enjoy the game for at least a few minutes :-) - A few notes about the development of this minigame. I know Shisen since the '80s (from a coin-op) and I like it more than Mahjongg. I first implemented the game for PC in QuickBasic in text mode about ten years ago. Last year I saw an implementation of the game (the best, in my opinion) for KDE. Then I decided to write it again for the 2002 minigame compo. My initial idea was to implement the basic features only and fill the remaining memory with tile pictures, but the space left was enough for small pictures only. Then I decided to use alphabet letters and fill the remaining space with additional features, like the back/forward commands and a very basic help system: only one move. The program was exactly 1024 bytes, but some code rearrangments allowed me to save 100 bytes! The audio routine for the 128k version that I tried to write at this point was too big and then discarded. Then the gravity variant, that is present in the KDE implementation, came into my mind. I decided to implement it into a separate 1k program, but 1024 bytes were enough for mode toggling code also, so that a single program contains both versions. Finally, further optimizations allowed me to complete the help system as it is now and add the option to choose the board.