The popular Mahjong game (4 players using ivory bricks) uses a points reckoning system that balances the individuals' scores in a certain way so that the net result always equals zero. This process is rather tedious and requires the person who is calculating to be "decoupled" from the ongoing social conversations, which destroys one of the nice aspects of the game. Therefore it is a good candidate for automation. My oldest son and I undertook the project of implementing such a calculator in ZBasic hardware using a ZX328L and a simple matrix keyboard and an LCD display. The youngest son contributed by generously allowing his wooden school-made encasing to be used for this project. The casing is designed to show off its internals.
The project is a nice example of the flexibility and power of the ZBasic platform, as shown for example by:
- The use of the FirstTime command to show a welcome text only a few times (a concise and cleaned-up version is shown in http://www.zbasic.net/forum/about1864.html.
- The use of the AN105 code for interfacing the matrix keyboard, providing for a very fluid behavior of the keyboard in practice.
- Object-oriented programming as a useful way to easily include functionality (for example: LCD display routines are used through the mix-in concept).
More info (including the circuit diagram and the code) can be found here at the ZBasic site.