Bingo
The standard Bingo card is a 5 by 5 table containing integers between 1 and 75, with a free spot at the center that contains 0.
The first column in the table contains only integers between 1 and 15, the second column numbers are all between 16 and 30, the third are 31 to 45, the fourth 46-60, and the fifth 61-75. There are no duplicate numbers on a Bingo card.
There are about 155 × 145 × 135 × 125 × 11 4 possible arrangements of the numbers on a bingo card.
Before the game starts, each player is given a Bingo card. The game also has a "caller", who issues a list of all the integers between 1 and 75 in random order. As each number is called, players mark the appropriate squares on their cards. The middle square, the free square, is always marked.
The winner of the game is the first person whose Bingo card has one of the following winning conditions:
Read the Wikipedia page on Bingo.
Implement a method
public void write(String outputFile)
shuffle()
method below)
between 1 and 75 to the output file. The first five lines of the output represent
the Bingo card. Each line is a row of five integers separated by
spaces. The third number in the third line, the free square, is always
contain the number 0. Next will come seventy five integers, all in one line, in random order.
For example,
3 18 34 60 75 12 26 38 47 73 2 23 0 49 66 15 21 43 58 67 6 22 31 56 62 59 69 7 39 32 44 27 53 21 25 28 9 17 61 12 37 5 55 [et cetera, until all numbers have been listed]
The first column in the Bingo card configuration must contain only integers between 1 and 15; the second column numbers are all between 16 and 30, the third are 31 to 45, the fourth 46-60, and the fifth 61-75. There are no duplicate numbers on a Bingo card.
You are also to implement
public void shuffle(ArrayListlist)
write()
method. Note, you cannot call the Collections.shuffle()
method.
Implement a method
public void read(String inputFile)
write()
. You will store a Bingo card
configuration (the first five lines) in a two-dimensional array of integers, called card
.
A list of 75 integers should be stored in the array stream
.
Implement a method
public int playGame()
We provide two sample bingo inputs for testing purposes: test1.txt should return 55, and test2.txt should return 69.
Your assignment will be graded first by compiling and testing it. After that, we will read your code to determine whether appropriate classes were used, as well as judge the overall style and modularity of your code. Points will be deducted for poor design decisions and un-commented, or un-readable code.
Here is the point breakdown: