
Bingo is a game of chance in which each player matches numbers printed in different arrangements on cards with the numbers the game host (caller) draws at random, marking the selected numbers with tiles. When a player finds the selected numbers are arranged on their card in a row, they call out "Bingo!"
Due: 26th November, 2020 (Thursday), 23:59
Instructions
Submit your source file (.c file) to elearn.nthu.edu.tw. Your filename should contain your student ID.
Due to the tight schedules, it is impossible to postpone the due date of an assignment. For late assignments, 20% of your original marks will be deducted if you hand in 1- day late, 40% for 2-day, 60% for 3-day and 80% for 4-day. Assignments handed in 5 days after the due date will not be accepted.
Task Description
In this assignment, you are to write a program to help a player play the game Bingo. In our version of Bingo, each player is given a card containing an nxn array of numbers. The numbers are in the range 0 to 99 and will not repeat. An example of a 5x5 array is shown below.
Then the referee will randomly select a number from 0 to 99 and each player will search for the number in his array. If the number is present, he will mark it off. This is repeated until some player has a complete row, column or diagonal marked off. That player will then declare himself a winner and the game is stopped. For example, suppose the sequence of numbers chosen by the referee is:
12, 99, 70, 23, 49, 21, 1, 50, 7, 88, 17, 45, 97, 65, 33. Then the player holding the above card will mark the corresponding entries on his table :
As soon as he marks off the number 33, he has a diagonal and a row completed. Therefore, he declares himself a winner. Notice that some numbers (e.g., 70 and 23) in the sequence are not present in the table.
Suppose on the other hand, the sequence of numbers is:
12, 99, 70, 23, 49, 21, 1, 50, 7, 88, 17, 45, 97 when some other player has completed a row/column/diagonal, the game is stopped.
Your program will input an integer n in the range 0 to 99. This represents the number of rows and also the number of columns of the table. This is followed by n lines of integers, each line containing n integers. This represents the nxn table. Finally, there will be a sequence of integers in the range 0 to 99 followed by a -1 value, each value on a separate line. You may assume that the numbers in the sequence do not repeat and that the sequence of numbers will be ended (with a -1) as soon as a row, column or diagonal is completed. A sample input is given below.
Your table should have n columns and n rows. Each column is 3-character wide and there should be 1 blank space between two columns. Column 1 should start in the left margin. If a number should be marked, put enough stars (*) in front of the number so that the stars and the number together is 3-character wide.
