Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit



CISC 101 Elements of Comp. Sc. F21


                                                                                                                                                                                  

Assignment #11

 

   Hide Assignment Information

Instructions

 

Did you ever play Bingo with your siblings when you were on a car trip?  No?  Well, never fear -- the rules are simple. You are going to write an electronic version of the game that will give you hours of  joy.  The joy will come from coding the game, not necessarily playing it.

Here's the general idea of the game.  Each player has a "bingo" card (known as just "card" from this      point forward).  Each card is a 5 X 5 grid (as shown in the picture above).  Each space in the grid            contains a word (or phrase) of an item that you might see.  So, perhaps "cone", "palm tree", "speed        limit sign" etc.  The driver of the car periodically calls out an item that they see and the players check their card and if that item is on the card, they mark it as "FOUND".  The first one to get a BINGO          (defined by a goal -- see below) wins the game.

The items that you will use for the cards are specified on www.cs.queensu.ca/home/cords2/bingo.txt

There may be up to 3 players at one time, each having a randomly generated card.  Prior to each          game, the goal (ie. how a player obtains a "bingo" and wins the game) is set -- perhaps a full card or 4 corners.  (Possible goals are defined below).

If a player achieves the goal by marking off items that have been seen, they win.  When a player gets a Bingo, the game ends.

When your program starts, it will read the website consisting of the potential items and store it as a list of strings.   The data should be read and the data stored only once even if the user chooses to     play the game multiple times.  The data must be read by your program --- the items must NOT be     hard-coded in your program.

There may be 1-3 players for each round.  Each player is identified by a name (the user should be       prompted for the number of players and a name for each player which will be used to identify the      player).   As each player is added, a card is generated for them.  The card is generated by randomly    selecting items from the list of potential items.  Each item may appear at most once on any one card but items may appear on more than one of the cards.


Each round proceeds as follows:

1) cards are written to the screen (formatting is not terribly important but \t (a tab) will be useful for  formatting).  Those items that have been "found" should be clearly marked as such.  You do not need to keep track of which items were found, only that the item in a particular location has been marked  as found.  Your output may look something like this:  (Note that this is for a 3X3 card -- yours will be 5X5 cards):

Henrietta's card:

convertible bus           ambulance

FOUND      train         stop sign

yield sign    FOUND  FOUND

Steve's card:

 


dog              fire truck

FOUND      FOUND


FOUND

FOUND



ambulance shoe on road FOUND

2) the (simulated) caller chooses an item randomly from the list of potential items and displays it on the screen.  The caller is prompted by user input - that is, the user should initiate a new item being  "called" by some sort of input. For instance, after printing the current cards on the screen, your         program might prompt the user for some value to indicate that the caller should "see" a new item.    Items may be "seen" only once per round so you will need to keep track of what has already been    called.

3) each card is checked to see if the newly seen item appears on the card.  If so, the item is "marked" as "FOUND" and the card is checked for a valid Bingo.

4) if a Bingo is found, the winning card is printed on the screen with a message saying "XXX wins!"       (where XXX is the player's name).   There may be more than one winner --- your program should           check all cards in each round & declare all the winners).      If a Bingo is found, the current game ends.   The user should be given the opportunity to play again -- at which time your program begins again by asking for the number of players, their names and a goal..  You should not re-read the data file (it           should not have changed in the previous round).

 

Goals

A "goal" indicates the rules that must be satisfied in order to declare that a Bingo has been achieved. We will implement three goals from which the user may choose:

1. Full Card -- all items on the card must be found.

2. Single Line -- all items in a single horizontal or vertical line must be marked as FOUND

3. Four Corners -- the items in each of the four corners of the card must be marked as FOUND.

Only one goal will be chosen per round.   Your program should be only checking for the chosen goal each round.  That is, if your goal is "Full Card", your program should not check for "Single Line"            bingos.

What to Submit

Upload your python file to the assignment dropbox.    Please check your files after uploading.    If you upload the wrong files, you get a mark of 0 -- it is YOUR responsibility to check to ensure that you     have submitted the correct files.    Do not zip your files together, upload them individually.