Program 1: Bingo

Due Date and Submission Requirements


The goal of this lab is:


Background and Directions

In this assignment, you will create a program that will simulate a game of Bingo (slightly-simplified) ! If you are not familiar with Bingo, you should spend a few a moment to learn how Bingo is played. In our version of bingo, we do not use any letters.

Your program will read in a Bingo Card from a file, bingocard.txt and place the values into a 5x5 2D array. The middle spot (array[2][2]) is a 0, which indicates that spot is the free space. The program will print out the bingo card, and repeatedly generate random values between 1 and 45 (inclusive) until the player earns a bingo. If the random value is on the player's bingo card, then that spot is marked on the card with an X (❌). It is possible for the program the roll the same number multiple times. You dont need to handle duplicates (although it doesn't require much code to handle duplicates if you want to try). A bingo occurs when there are five marks in a row vertically, horizontally, or diagonally. The program print out the updated card and the random value until the player earns a bingo. There should be some kind of waitkey (ie the enter key) between each iteration. You should make an effort to look your bingo card look nice, and you should try to match the sample output the best that you can.

You will develop your solution from scratch, but you should at least have two Classes. You must use a 2D array to represent the bingo card. You will need to use the Scanner, Random, and FileReader libraries.

You need to include comments in your code. In general, each method should have a brief comment explaining what the method does. If there is a long, complex line of code, you should also include a brief comment for that as well. Getters and setters do not need methods.

If you work with a partner, make sure you include the name of your partner in a comment at the top of your code.

Assumptions

The bingo card will always be 5x5.
Free space will always be in the middle.
The random values will always be between 1 and 45 (inclusive).

Input file

Required Output

The output will be pretty long, since this game will last several round before the player earns a bingo. You do not need to match the sample out exactly, but it should be very similar.

Optional Hints

I would recommend having a printCard() method that prints out the 2D array. A isGameOver() method that will determine if a bingo has been earned. a roll() method that will generate a random value, and update the bingo card. I would recommend having a int[][] for the bingo card, but also a boolean[][] two dimensional array that is used "behind the scenes" to keep track of which numbers have been marked. You can then use this boolean 2D array to determine if the game has been won.

Grading (100 points)

Requirement Points
Your program reads in from the input file into a 2D array correctly 20
The program repeately generates a random value between 1 and 45 10
The bingo card get correctly updated and printed out nicely after each number rolled 20
Bingos are detected vertically 10
Bingos are detected horizontally 10
Bingos are detected diagonally 10
The program ends when a bingo is earned 10
Your programs contains an adequate amount of comments 10






Program 1 solution