Richard JP Le Guen.ca

Skip to Content
All about Software Development on the WWW
RSS feed

Navigation

Soen287 Tutorials

Tutoring Courses

4 Week Programming Project (extension!)

Overview

Generalizing what you learned from the tutorials Maintaining State Using Query Strings, Maintaining State Using Cookies and Changing Server State: POST Requests, create a web-based poker game script.

The first time a user visits the poker game script they should be asked to provide their name as input.

After that, the on the next visit, the game will deal them 5 cards, whose face value they can see. The game should also deal another non-user player 5 cards, whose values should not be available to the user nor the client.

After choosing up to three cards they'd like to discard, the game deals them that many cards so they once again have 5 cards.

The game should also tell the user what the hand they have.

In More Detail

Server Side

The main part of the project is to write a Perl CGI script which maintains state.

  1. On the first visit, it outputs an HTML page – including an HTML form – prompting for the player's name.
  2. The next client-server interaction deals cards – five face up for the player and five face down for a computer player.
  3. Having seen his cards, the next client-server interaction discards up to three cards, and draws three new ones from the deck. All the discarding and drawing of cards occurs in one client-server interaction.
  4. Once cards have been discarded and dealt both hands are shown to the player.
  5. The next client-server interaction should re-shuffle both hands back into the deck and return to step 2.

You are not allowed to make use of the CGI.pm Perl module.

Client Side

The client side has three main functions:

  • Display the name of the poker hand the user is holding in the page itself; not using alert() nor confirm(). (don't worry about optimizing or efficiency, but make sure it observably works, ie doesn't take an hour to run)
  • Help the player to select up to three cards to discard by providing some sort of visual cue that a card has been selected for discard; a colorful border or a change in size.
    • the selecting can be done with a simple <form> and checkbox <input> elements, but bonus marks will be available if one clicks on the cards themselves.
  • Again display the name of the poker hand the user is holding, the hand the computer player is holding, and who wins.
  • No client side code is to execute until the window.load event.

You are not allowed to make use of JavaScript frameworks such as JQuery.

Style, Look and Feel

Your poker game has to be a two-column page, with information (the player's name, the computer player's name, the player's current hand etc) in the side column and the cards in the main column.

You are required to hotlink to images of the cards, like in tutorial.

Theory and Security

You should explain in your readme file what steps your have taken – if any – to ensure your site does not suffer from the common web site problems of:

  • Exposed Source Code
  • Cross Site Scripting
    • Explain why HTML entities are important in protecting your web site from XSS attacks.
  • Cross Site Request Forgeries
    • Specify what HTTP request method (GET/POST/HEAD etc) you chose to use for each client-server interaction and why.

You should also explain how your CGI script maintains state and why you chose that method.

What to Submit

Submit an archive file which contains:

  1. A readme.txt file
  2. The Perl CGI script
  3. An external JS file
  4. An external CSS file

You must submit a readme.txt file, which should include your name, your ENCS username, and your student ID number. If you don't you will be penalized by up to %20 in addition to losing marks for any missing work which would have been in the readme file.

This is a team submission: only one team member need submit.Put any other team members' names in your readme file.

Content © 2008-2012 Richard Jean-Paul Le Guen