NOTE: QUIZBOWL.BIM Now implements a 4-team system: OK for 2 to 4 teams/players.

I am putting this up in response to a request for a 'Quiz Bowl' program using
the parallel port. It's a good example of how quick and easy it is to program
something like this with a State Machine:

I just wrote a quick "Quiz Bowl" program using the free (from me) PARPORT
package program called BITMACH.  This is a DOS program that runs on ANY PC
compatible machine.  You use BITMACH to create a visual State Machine that has
several steps that do what you want the machine to do.  The BITS that the
State Machine can control are the Parallel Port Output bits.  The BITS that
the State Machine can TEST to make decisions are the Parallel Port Input bits.
The software 'fixes' the parallel port funnyness so you simply see 8
sequential input bits and 8 output bits.  Disclaimer:  This is still Beta
level SW, but it works.  The line editing is clumsy.  The NAMEBITS program
used to identify the bits you use SHOULD be integrated into BITMACH.  In My
Other Spare Time.  Etc.

QUIZ BOWL: This assumes 2 to 4 teams each have a switch they can push to signal
that they want to answer first. The machine must decide which team pushed
THEIR button first, and activate some signal. Then it must reset for the
next round.

Look at the screen dump of BITMACH below (you need to set fixed font, or
print it with fixed font; I changed the usual DOS Box characters for this).
The input and output bits are usually active LED-like 'blobs' but I changed
them to the "B" character here.

NOTE! NOTE! UPDATE! The file QUIZBOWL.BIM has a modified version that
supports 4 teams unstead of the two shown below. Same idea...

OUTPUT BITS ON LEFT: TEAM1, READY, and TEAM2 are LED's connected directly
from the parallel port outputs to ground. BEEPER is an optional 5V beeper
that signals READY and a question is about to be asked.

INPUT BITS ON RIGHT: TEAM1SW and TEAM2SW are the switches each team has.
These are momentary switches connected directly from the parallel port
inputs to ground. The connector Pin Numbers on the port are shown. Use
any pin from 18 to 25 as ground. The input bits were set to INVERT in the
NAMEBITS program which set up the pin assignments, so they appear as
1's when the switches are closed.

Each step can set output bits, or leave them alone (X).
Each step can have a StepName, and a NextStep name it can go to.
Each step can test input bit(s) for 0 or 1 or (X) Don't Care and goto NextStep
Each step can do other stuff like control timers and counters.

NOTES on STEPS:

3       turns on the READY LED
4       turns on the Beeper
5       uses an internal WAIT command for 200 Milliseconds
6       turns on the Beeper off again
7,8,9   loop, waiting for a Team Switch to be pushed.
8       is a special case TEST which forces it and step 7 to be BOTH
        evaluated each loop instead of waiting forever for the first switch
7 and 8 have NextStep values that make the state change to the right team if
        a switch is pushed.
10 - 13 Is the TEAM1 action: light its LED, make a unique BEEP, WAIT
14 - 17 Is the TEAM2 action: light its LED, make a unique BEEP, WAIT

|-----------------------------------------------------------------------------|
|Help|Load|Quit|Edit|Run |Stop|Step|Break|   |Save|        |F2:File   STOPPED |
| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8  | F9| F10|        |Dn Arrow          |
|-----------------------------------------------------------------------------|
|OUTPUT NAMES AND PIN NUMBERS    The BitMachine!   INPUT PIN NUMBERS AND NAMES|
|TEAM1LED--(2)-----------------                   ---------------(17)-I       |
|READYLED--(3)--------------- |                   | -------------(16)-I       |
|TEAM2LED--(4)------------- | |                   | | -----------(15)-TEAM2SW |
|BEEPER  --(5)----------- | | |                   | | | ---------(14)-TEAM1SW |
|OUT4    --(6)--------- | | | |                   | | | | -------(13)-I       |
|OUT5    --(7)------- | | | | |                   | | | | | -----(12)-I       |
|OUT6    --(8)----- | | | | | |                   | | | | | | ---(11)-I       |
|OUT7    --(9)--- | | | | | | |                   | | | | | | | -(10)-I       |
|               | | | | | | | |                   | | | | | | | |             |
|StepName Step  |O|U|T|P|U|T| |                   | |I|N|P|U|T| |     NextStep|
|-------- ----  B B B B B B B B                   B B B B B B B B     --------|
|START       3  0 0 0 0 0 0 1 0                   X X X X X X X X             |
|BEEPIT      4  0 0 0 0 1 0 1 0                   X X X X X X X X             |
|            5  C: WAIT 200                                                   |
|ENDBEEP     6  0 0 0 0 0 0 1 0                   X X X X X X X X             |
|LOOP        7  X X X X X X X X                   X X X 1 X X X X     TEAM1   |
|            8  TEST ---------->                  X X 1 X X X X X     TEAM2   |
|            9  X X X X X X X X                   X X X X X X X X     LOOP    |
|TEAM1      10  0 0 0 0 0 0 0 1                   X X X X X X X X             |
|           11  C: BEEP 1                                                     |
|           12  X X X X X X X X                   X X 0 0 X X X X             |
|           13  C: WAIT 5000                                          START   |
|TEAM2      14  0 0 0 0 0 1 0 0                   X X X X X X X X             |
|           15  C: BEEP 2                                                     |
|           16  X X X X X X X X                   X X 0 0 X X X X             |
|           17  C: WAIT 5000                                          START   |
|           18  X X X X X X X X                   X X X X X X X X             |
|-----------------------------------------------------------------------------|
|StepNow =   2| PgmDesc: Quiz Bowl Game (Maybe)            | Samples = 99590  |
|-----------------------------------------------------------------------------|


Anyway, I thought this might be an interesting example of how easy it was to
implement something like this. The BITMACH can do a lot more, like Timers
and Counters, executing external DOS programs etc, but I wanted this to
stay simple.  Get the package at
http://homepages.together.net/~tking/bitnbyte.htm
if you want to play with this or see more (alleged) documentation. Print
out BITMACH.CRD for a quick reference card.

Use SEEBITS first, when you hook up hardware to the parallel port bits,
to make sure you have stuff working right first. Make sure you
SET PARPORT=LPT1   (or your port) at the DOS prompt first.

The Quiz Bowl program is QUIZBOWL.BIM which you load with F2 in BITMACH.
There are lots of other examples in the package.  You'll want to push <alt>Q
to shut up the Step Click when you run this.  Single Step it to see how it
works.

I have been using this some with Middle School kids. I would like to
collaborate with anyone who is using BITMACH with kids to develop good
materials.

Any suggestions are welcome.

Terry King
tking@together.net

