You are here:   ArielOrtiz.com > Programming Languages > Final Project: Collector

Final Project: Collector

Objectives

During this activity, students should be able to:

This activity helps students develop the following skills, values and attitudes: ability to analyze and synthesize, capacity for identifying and solving problems, and efficient use of computer systems.

Activity Description

This activity can be solved in teams of two or three people.

Using the Erlang programming language, write distributed server and client programs that allow you to play a text mode version of the Collector card game with the following rules:

Game Rules: Collector

(Adapted from: Card Games Web Site)

This game is for 2 to 4 players.

The object of the game is to collect a full set of 13 cards (King to Ace) — the suit of the cards doesn't matter. Each player starts off with 5 cards dealt from a shuffled 52-card deck. The remaining cards are placed face down as a drawing stock.

The game is played as follows:

  1. Each player selects simultaneously one card from their hand and places it face down so that nobody else sees it.
  2. All the placed cards are turned face up at the same time.
  3. Each player has the choice of drawing two (unknown) cards from the stock, or taking one of the face up cards played by the other players.
  4. The played cards that were not chosen are added to the bottom of the deck.

This process is repeated until someone has a complete set of 13 cards of different ranks. The first player who correctly claims to have a complete collection wins.

During step 3, make sure that the process of choosing the card(s) to keep takes place in an equitative way. So, assuming A, B, C, D, are players, in the first round the choosing order should be A, B, C, D. In the second round the order should be B, C, D, A, and so on.

Example: Bill and Chris start off by picking up 5 cards each. Bill has [1, 3, 5, 4, King], so he decides to dispose of the King. Chris has [2, 4, 6, 6, 1]; since he already has one 6 he decides to discard the other. Neither one of them picks the other's card to add to their hand, so they put the King and the 6 at the bottom of the deck and they both draw two cards. Bill now has [1, 3, 5, 4, 6, 7], and he decides to discard his 3. Chris has [2, 4, 6, 1, 5, 3] and doesn't want to get rid of any of his cards, but he has to. He plays the 3 and takes Bill's 3. Bill puts Chris's three at the bottom of the deck and draws two cards, but Chris doesn't since he took Bill's card. They keep playing till someone has [Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King].

The client program must allow the player to see at every moment all his cards, as well as the number of cards held by the other players.

Deliverables

Place all the project source files in a ZIP file called collector.zip and deliver it using the Online Assignment Delivery System (SETA). No assignments will be accepted through e-mail or any other means.

IMPORTANT: All the program source files must include at the top the authors' personal information (name and student id) within comments. For example:

        
%% ITESM CEM, May 10, 2010.
%% Erlang Source File
%% Activity: Collector
%% Author: Steve Rogers, 449999

    .
    . (The rest of the program goes here)
    .

Due date: Monday, May 10.

Evaluation

This activity will be evaluated using the following criteria:

-10 The program doesn't contain within comments the authors' personal information.
10 The program contains syntax errors.
DA The program was plagiarized.
20-50 The program doesn't work, but it seams that some significant amount of time was spent in it.
60-90 The program works, but has some flaws.
100 The program works as requested.
© 1996-2010 by Ariel Ortiz (ariel.ortiz@itesm.mx)
Made with Django | Licensed under Creative Commons | Valid XHTML | Valid CSS