Question: Write a Python 3.6.3 program that simulates playing Bingo. In Bingo, each player has a card of numbers arranged in a 55 grid with five

Write a Python 3.6.3 program that simulates playing Bingo. In Bingo, each player has a card of numbers arranged in a 55 grid with five randomly-chosen numbers from 1 to 15 in the B column, 16 to 30 in the I column, 31 to 45 in the N column, 46 to 60 in the G column, and 61 to 75 in the O column. The central space is free" and is considered occupied. The 24 numbers on a Bingo card are unique.

A caller randomly calls numbers from 1 to 75 without replacement, each player marking the corresponding number, if it is present on their card, as occupied. The first player to have five occupied numbers in a row horizontally, in a column vertically, or along either of the two major diagonals is the winner. How to represent a Bingo card in Python. A dictionary will be used to represent a Bingo card. Here, the keys are the letters B, I, N, G, and O and the value for each key is a list of five integers.

Write a Python 3.6.3 program that simulates playing Bingo. In Bingo, each

Note. The main(), print_card(), and open_file_command() have been written for you. These functions drive the program, prints a Bingo card stored in a dictionary, and reads a Bingo card from a file, respectively.

Link to code needed to be completed: https://repl.it/repls/ImpressionableWorthlessCockerspaniel

Your job is to write the three functions (check_bingo(), generate_random_card(), simulate_bingo()) described above.

a) Write the check_bingo(card) function. Here, card is a Bingo card represented as a dictionary as described on the previous page. Your code will return True if card has Bingo. Otherwise, it will return False.

b) Write the generate_random_card() function. You will write code to randomly generate a Bingo card. Your Bingo card must be represented as a dictionary as described earlier (also see comments in code). Your code will return a dictionary that represents a valid Bingo card. When writing your function, you might find the random.shuffle() command for lists helpful.

player has a card of numbers arranged in a 55 grid with

c) Write the simulate_bingo(n,k) function. Complete this function to simulate k games (or trials) of Bingo, where n cards (or players) are active in the simulation. Your function will return three values: the minimum, maximum, and average number of calls required to get Bingo among the k games of n cards. For example, if n = 10 and k = 100, then your simulation would report results for playing Bingo 100 times among 10 players. Remember, for each of the k games, you should generate a new set of Bingo cards. To complete the code for this function, make sure to make use of the previous code in parts (a) and (b) that you have written.

card= {,B':[7,15 , 11 ,2,10], : [25 , 22, 30, 28, 27] N' [44,40,0,37,39], 'G' ,0%(62,70 ,74,68,75] } [57,50,46,55,59]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!