WP 20161014 20 00 23 Rich
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 therefore 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 project is a nice example of the flexibility and power of the ZBasic platform, as shown for example by:

  1. 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.
  2. The use of the AN105 code for interfacing the matrix keyboard, providing for a very fluid behavior of the keyboard in practice.
  3. 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.