[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Little game...



Anyone still here?  I needed to do something interesting, as well as
learn GTK a little more, so I implemented a little game that I mentioned
as a possibility here a while ago:  Chain Reaction.  Originally from a
Compute's Gazette C64 magazine.  Hopefully they won't sue me.

It *is* done and workable for a two player game.  To-do:
 - Aesthetic improvements: make colored pictures of number of bombs on
each square instead of numbers
 - Add code to check when game is over
 - Add computer AI

When all that's done, I think it will be a somewhat worthy addition to
the list of GTK games.  :-)

The object of the game:  Blow your opponent off the board.  :-)

Board:  6 X 5 grid.  Starts empty.  Each cell can hold x-1 bombs, where
x is the number of adjacent (not diagonally) cells.  Like, corner cells
can hold one bomb, other side cells can hold two, interior cells hold
3.  Currently all cells display (x:y) where x is the player number of
owns the square (0 for not owned) and y is the number of bombs in the
cell.

Play:  Player 1 starts by clicking on the square he wishes to place a
bomb on.  Must be owned by him or unowned.  If he already has one or
more bombs on it, one more is placed there.  If too many bombs are in
that cell, it "blows up".  When it blows up, the player immediately owns
all adjacent cells, one more bomb is placed in each adjacent cell, and
the cell that blew up is cleared and unowned.  And explosions occur in a
"chain reaction" form - hence the name of the game.  If an explosion
makes another cell explodable, it explodes immediately.  When all
possible explosions have occurred (usually none near the beginning of
the game), player 2 clicks on a square and the whole process starts over
again.

There is currently no indication of when the game is over, but it's
pretty easy to tell by looking.

hmm, Netscape is screwey, more later...
gcc -Wall -g game.c -o chain `gtk-config --cflags` \
    `gtk-config --libs`