The Game:

LastMatch is a game for two players - in this case: You and your QL. The
"matchsticks" are arranged into four piles containing 1, 3, 5, and 8
matches respectively. Players alternate in taking turns. A turn consists of
removing one or more matches from any one pile. The player who is forced to
remove the last match has lost.
Illustration of Match

Take turns removing one or more matches from one of four piles.

For a reminder of the rules press F1 (or click the "i" icon) inside the

The game is deterministic, but can be infuriatingly hard to crack, possibly
because it appears deceptively simple at first. Nice party trick, though!
This implementation gives you a window of opportunity to beat it (its first
move is random), after that it's just a question of how long before you
realise that you're just wriggling in the crook of fate..


The program requires the Enhanced Pointer Environment (PE) to run. For Qdos
this means ptr_gen, Wman, and Hot_rext. QJump's TK2 toolkit is also needed.
SMSQ/E has all this built in.

While not a 100% requirement, it is expected that such a system will have a
mouse and the necessary software to drive it.

In addition LastMatch requires ptrmen_cde, the EasyPointer toolkit. This
useful toolkit enables many other PE programs to be run too. The current
version is V4.10. Make sure you are using this for the most recent PE

The compiled program needs Qlib_run pre-loaded. You can also run the
program in SBASIC/SuperBASIC, in which case you also need to LRESPR the
LastMatch-specific toolkits MATCH_app and MATCH_bin, and depending what
Qlib toolkits you have loaded, you may need to REMark out the line 160

This may seems a lot for a lapsed or novice QL user, but for most people
who have used their QLs for a while, they represent a natural progression,
no worse than the progression from MSDOS -> Windows V3.x -> Windows 95 and
so on!

See the Contacts page for information on where these system
extensions can be found. They are all free these days!

LastMatch can be played on a 128k BBQL, provided the extensions mentioned
are loaded.


Unfortunately there is a bug in the older versions: I had quite forgotten
that PAUSE doesn't take a channel parameter in Qdos! (It does in Minerva
BASIC and SBASIC - for good reason.) That means that some of the previous
versions will crash, whether compiled or not, under Qdos, but not Minerva
or SMSQ/E. How that slipped past Quality Control I have no idea.. The
current version has been tested on all systems and should work as
advertised, both as S*BASIC code and compiled.

So this (V0.04) is the Final, or Definitive, First Version! Hopefully all
bugs have been removed, and it should run across all systems!

I have included some of the older versions in case you wish to see how the
development progressed. The game play of all is the same.


LastMatch was my first PE project using Albin Hessler's excellent
EasyPointer programming suite. It is still one of the simplest ways to get
into PE programming and to quickly develop simple - or complex - modern-
looking programs for QL systems. The suit has been much enhanced by Marcel

My code in LastMatch is not pretty by any measure. But then I've seen
worse! I do try to improve all the time, so don't be put off by this from
investigating any of my later projects! The code should be simple enough to
follow once one has penetrated my idiosyncrasies.

Previously I offered different variants of LastMatch with many of the extra
toolkits compiled in to save the casual user some trouble. Since the
Q-Liberator (Qlib) compiler is now free for all, I've left it to users to
compile their own version if they dont like the bare bones version
included here. The alternative Qlib directives header (in MATCHheader_bas)
contains information on how they can be included. The PE systems toolkits
must, for obvious reasons, be loaded separately at boot.

I have included two previous versions of the source code for reference: An
early Qdos version and an SMSQ/E-specific version. You can find them in
..match_old_ as MATCH01_bas and MATCHsms_bas.

The program-specific PE components are packed into the MATCH_app binary as
per EasyPointer convention. Those are the main window menu, the matchstick,
blank and title sprites.

Previously I used in-line DATA statements to hold data that was repeatedly
used, eg for item statuses or BEEP parameters for the tunes. This to avoid
wasting space by putting data into arrays and thereby doubling the space
required. But that meant that there was no getting away from line numbers
(due to necessary RESTORE <line no> statements). By taking them out and
converting the data to binary all that was needed was a command to return
the address of each data block. The individual values - all integers -
could then be PEEK_W'ed from those locations.

I didn't do this with the help texts as Qdos has no PEEK$ command. But
since the text data was the only block left I could simply use RESTORE
without a line number to reset the data pointer to the beginning of the
program on each use.

Final Word:

I've gone to the trouble of making these changes and preparing this
document in the (vain?) hope that more QLers will be encouraged to write PE
utilities and games. I feel a lot of people are put off by the perceived
complexity of writing PE programs. But mastering complexity is like eating
an elephant: You do it one small piece at a time. I know I learnt a lot
about PE from knowing nothing to writing this simple little game! So get
back in harness and have a go!

(That being said, Id do most things very differently now! ;o) )

Program Status:

©PWitte 1994, 1999, 2021, 2022

V0.04, pjw, 2022 Mar 15

              Conditions and DISCLAIMER as per