Description
Lab J will provide some background help for this mini assignment.
Week 10, slides 28 to 44 will help you with CGI development.
YOU CAN WORK IN A TEAM OF TWO, if you want, for this assignment. Both team
mates will hand in the same files.
QUESTION: Web Game
We will build a simple multi user web dungeon crawler-like game.
You or your team must build it cooperatively with your classmates.
You can only use HTML, CGI and C. No CSS. No JS, etc.
The goal of the game will be to get 100 gold pieces.
You start the game with 10 gold pieces.
Each dungeon room you enter results in a win of 10 gold pieces or a loss of 5 gold pieces.
You will gain or lose gold by engaging in a Q/A activity. Each room will have either a
single COMP206 question or a single Zelda question. If the player answers correctly
they get 10 gold pieces. If they answer incorrectly, they lose 5 gold pieces. When you
cannot pay, you die. When you get 100 gold pieces, you win.
This is an equal opportunity dungeon, so you can start from any room. Simply type the
URL of anyone’s room to start the game. Your room does not need to be pretty. It only
needs to be functional. If you want to make it pretty, then please go ahead, but stick to
HTML, CGI and C. Have fun with this.
Each room is responsible to (1) show a question, (2) a picture, (3) be able to process the
user’s response to the question, (4) award 10 gold or (5) remove 5 gold, (6) display how
much gold the user has, (7) display a DIE and (8) WIN message.
Each room will have a textbox input field and a submit button. In that textbox the user
can either answer the question posed by the room to win 10 gold pieces or lose 5 gold
pieces, or they can input a command. Valid commands are: NORTH, SOUTH, EAST,
WEST, or GOLD. Each of the directions is connected to another classmate’s room. This
means that your room must connect to four other rooms. If we do this right, a player will
be able to travel to all 250-500 rooms. You only need to make sure that your room
connects to four other rooms.
Once the user has 100 gold they win. When a user presses submit with 0 gold a lose
message is automatically displayed. If the user has some gold, even 1 gold piece, the
game validates the attempt. If the person got it correct, then they get 10 more gold pieces,
otherwise they lose 5 gold pieces. If they do not have enough gold pieces to pay for the
loss, then they automatically die.
Mini Assignment #7 COMP 206
This is what you need to do:
STEP 0 – The public_html directory
Lab J shows you how to create the public_html directory. Please do this.
You will need to create four files: index.html, answers.c, addgold.c and a picture.
The index.html file will be your dungeon room. The rest of the files are described
below.
STEP 1 – Build the room using HTML and CGI
Your dungeon room must look like this:
You can center your NAME OF ROOM with the tag
To make the game more fun you must add at least one picture to your page. Use
the command:

Mini Assignment #7 COMP 206
The
directory. Write the filename in the src=”filename” attribute and specify how big
you want the picture to be using the height and width attributes.
Then write the question. Possible tags you might want to use are: bold,
underline.
Then write the instruction: “Please type NORTH, SOUTH, EAST, WEST, GOLD,
or answer the question.”
All the initial interaction with the room will be through the textbox and submit
button. The player will need to enter one of the five commands NORTH, SOUTH,
EAST, WEST, or GOLD, or provide the answer to the question in the textbox and
then press the submit button. Pressing the submit button will call the program
answer (from gcc -o answer answer.c) to process the player’s request.
The commands NORTH, SOUTH, EAST, and WEST are movement commands.
These commands cause the player to exit the room and enter another room. You
will need to talk to four other teams in our class to get their room URL.
The command GOLD will display the number of gold pieces the player currently
possesses.
The player will input their command in the textbox and then press the submit
button. The submit button will call the program answer. This will be
implemented using the