Skip past logotype.

My entries to Minigame 2003

Here are the entries I to date have sent to Minigame 2003. The task was to write a game for an eight-bit computer in a maximum of one (1) kilobyte or four (4) kilobytes.

The two programs described on this page are released according to the GNU General Public License, version 2.

The Potion

Frustrating.
 — Cs.

Initially I found the adventure frustrating, but in fact it's not that bad.
 — nich.

A nice, short adventure. Well, too short :-(
 — tjentzsch.

I enjoyed it!
 — Wyndex.

[Screenshot from “The Potion”]

Background

You are going about doing your own business, when you suddenly are transported to the middle of a dark forest in a far away land. You have no idea what you are doing here or how to get out, it is your task to find out.

Instructions

This is a simple text adventure game. It accepts commands on the form verb noun, for example: take key. A full list of commands is given below. Your first object of the game is to figure out what the object of the game is, then to carry out the task that has been presented for you.

The game recognises these one-word commands:

  1. n, s, e, w: Directional movement.
  2. i: Display inventory.
  3. look: Display room description.
  4. quit: Exit the game.
  5. license: Display license terms (not in the 4k version).

The game recognises these verbs, which must be used with a noun:

take, pick up, lift, read, talk to, unlock, open, turn, hit, punch, kick, kill, pour, empty, drink, throw, look at, examine, drop.

Requirements

This game plays on the Commodore C64, and is written in C and assembler. The source can also be compiled to run on most systems with a C compiler.

The 4K version has its texts slightly stripped down from the “full” version of the game. Unfortunately, the version I sent in also contained a bug in the initialization routine, which went unnoticed on my part until it was too late, it worked fine for me when I tested the game myself. The game finished in 30th place of 37 entries in the 4K category, 50th from 63 total.

[CSDb]

Tic Tac Math

Not interesting. Perhaps because I hate maths and tic tac toe?
 — Dbug.

Uninspiring twist on a solved game
 — mcmartin.

A reminder of how slow those BASIC 7.0 draw commands can be.
 — jcompton.

At least it's original! :)
 — Wyndex.

Like the use of math in this twist of tic-tac-toe! Like the use of different colors for pieces and text for players. I like different beeps for correct/incorrect! Nice use of C128 BASIC!
 — bhz.

You now have me writing a version on the Vic for my daughter.
 — ottawavic.

[Screenshot from “Tic Tac Math”]

Instructions

This is the classic Tic Tac Toe, but with a twist. To place your game piece on the board, you must give the correct answer to a mathematical problem. If you give an incorrect answer, your opponent get the piece.

First select where you want to place the piece by entering the row and column (for instance A2), and then give the answer to the problem and press Return or Enter. A beep will indicate whether you gave a correct or incorrect answer.

The first player to get three-in-a-row or to get five pieces on the board, wins. Remember that you can give your opponent the win if you give an incorrect answer!

Requirements

This games plays in the Commodore C128 40 column mode, and is written entirely in BASIC 7.0.

If started from 80 column mode, it will automatically switch over to 40 column mode for you.

The game idea is built on the Swedish TV gameshow “Prat i kvadrat”, which I think in turn is based on a show called “Hollywood Squares”. Since implementing an entire quiz show in one kilobyte is out of the question, I made it a maths game instead. Originally, it sported the number-to-text engine from last year's None Shall Pass, but since the game then weighed in at about 1½ kilobyte even before I added the graphics, it had to go early on.

The game finished in 25th place of 26 entries in the 1K category, 61st from 63 total. Not a very good score, but I hadn't expected much better, like last year's maths game it was mostly a fun idea.

The program can be fetched here.

Commented source code listing
Entry point
1
FAST:
Speed up initialization (and blank the screen)
COLOR.,12:COLOR4,12:
Gray screen
f(1)=6:f(2)=7:
Set up player colours
p$="{ct n}Player":
String used in a couple of places
GOSUB2:
Paint the board
GOTO9
Go to the main game
Paint board
2
GRAPHIC1,1:
Set graphics mode and clear screen
COLOR1,8:CHAR,1,.,"{ct n}Tic Tac Math
Print title bar
3
FORr=1TO3:
Three rows
 y=r*32-16:
Y coordinate for this row
 COLOR1,1:
Black brush
 CHAR,.,r*4-1,CHR$(64+r):
Paint row label
 CHAR,r*4-2,14,STR$(r):
Paint column label
 IFr<3THEN
Only two dividers
  j=y+28:
Coordinate for divider
  DRAW,j,16TOj,103:
Draw vertical divider
  DRAW,16,jTO103,j
Draw horizontal divider
4
 FORk=1TO3:
Three columns
  x=k*32-16:
X coordinate for this column
  WIDTH2:ONb(r,k)GOSUB5,6:
Paint the game piece in this square (if any)
 NEXT:
 WIDTH1:
Restore brush
NEXT:
RETURN
Paint player one
5
COLOR1,6:
Green
DRAW,x,yTOx+22,y+22:DRAW,x+22,yTOx,y+22:
Cross
RETURN
Paint player two
6
COLOR1,7:
Blue
CIRCLE,x+11,y+11,11:
Circle
RETURN
Checked key entry
7
DO:
 GETKEYa$:
Get a key
LOOPUNTILINSTR(g$,a$):
Loop until a valid key is entered
RETURN
Winner
8
COLOR1,f(v):CHAR,20,5,p$+STR$(v)+" wins":
Display who won
GETKEYa$:
Wait for a key
GRAPHIC.:
Return to 40 column text mode
END
Exit
Main game
9
DEFFNr(x)=INT(RND(.)*x+1):
Random number generator, interval [1,x]
s=1:
Set current player to player one
SLOW:
Display the screen again
DO:
Main game loop
 v=s:
V contains player who will get the piece
 COLOR1,f(s):
Player's colour
 CHAR,20,5,p$+STR$(s):
Tell whose turn it is
 q$="
Clear input buffer
20
 DO:
  CHAR,20,6,"_":
Cursor
  g$="abc":GOSUB7:CHAR,20,6,a$+"_":
Get a row (A-C)
  h=ASC(a$)-64:
Remember it
  g$="123":GOSUB7:CHAR,21,6,a$:
Get a column (1-3)
  w=VAL(a$):
Remember it
 LOOPWHILEb(h,w)
Loop until an empty square is selected
50
 a=FNr(79)+20:
Set up a random number for first term
ONFNr(3)GOSUB90,91,92
Determine what to do
60
 COLOR1,1:CHAR,2,16,STR$(a)+r$+STR$(b)+" =
Print the problem
62
 DO:
  CHAR,13,16,q$+"_{space*3}":
Display current entry + cursor
  GETKEYa$:
  IFLEN(q$)<4ANDa$>"/"ANDa$<":"THENq$=q$+a$
Only store max four digits
63
  IFa$=CHR$(20)THENq$="
Delete clears the entire buffer
70
 LOOPUNTILa$=CHR$(13):
Loop until we press Return or Enter
 f=30000:l=5:
Sound for correct answer
 IFVAL(q$)<>cTHEN
Check if it is correct
  f=f/3:l=20:
Sound for incorrect answer
  v=3-s
Piece goes to other player
72
 SOUND1,f,l:
Beep
 b(h,w)=v:
Place the piece on the board
 GOSUB2:
Paint the board
 p(v)=p(v)+1
Increase number of pieces for player
73
 IFp(v)=5OR
Five pieces on board gives the victory
   b(1,w)=b(2,w)ANDb(2,w)=b(3,w)OR
Check for horizontal line
   b(h,1)=b(h,2)ANDb(h,2)=b(h,3)
Check for vertical line
   THEN8
Go to winner routine
75
 IFb(2,2)AND(b(1,1)=b(2,2)ANDb(2,2)=b(3,3)OR
Check for diagonal
             b(1,3)=b(2,2)ANDb(2,2)=b(3,1))
Check for the other diagonal
   THEN8
Go to winner routine
80
 s=3-s:
Switch to the other player
LOOP
Addition
90
b=FNr(79)+20:
Select the other term
c=a+b:
Correct answer
r$=" +":
Visual indication
RETURN
Subtraction
91
b=FNr(a):
The second term must not be higher than the first
c=a-b:
r$=" -":
RETURN
Multiplication
92
a=FNr(60):b=FNr(11)+1:
Select first and second terms from a smaller set
c=a*b:
r$=" {ct n}x":
RETURN

[CSDb]

[HTML 4.01!] [Any browser is fine with us!] $Date: 2020-10-11 14:36:41 $ | peter@softwolves.pp.se

Back to Softwolves' Commodore page | Peter's home page