Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Continuing with Bingo Submit your code to the project3 link on Blackboard. Now that we have our Bingo Cards we should play Bingo!!! Create a

Continuing with Bingo Submit your code to the project3 link on Blackboard. Now that we have our Bingo Cards we should play Bingo!!! Create a program that will: do everything from program 2 (create bingo cards). Add an option 4 to your menu for Play Bingo read in a bingo call (e,g, B6, I17, G57, G65) checks to see if the bingo call read in is valid (i.e., G65 is not valid) marks all the boards that have the bingo call checks to see if there is a winner, for our purposes winning means 5 tokens in a row or column 5 tokens in a diagonal 1 token in each of the 4 corners of the game board Loop accepting bingo calls until there is a winner, and display an appropriate message specifying which user won, and how they won (5 in a row with calls B6, I20, ...; 5 in a column with calls ...; 5 on a diagonal with calls ... ; 4 corners with calls ...)

This is my code from project number 2. how do i modify my code given below to complete the tasks mentioned above? If possible please use my code below so i can easily understand.

#include #include #include

int get_random_number(int min, int max) { return min + (rand() % (max - min + 1)); } int min_for_col(int column_index) { return (column_index * 15) + 1; } int max_for_col(int column_index) { return (column_index + 1) * 15; } void print_bingo_card(int cards[5][10][5][5], int player, int card) {int i, j; printf("B I N G O "); for(i = 0; i < 5; ++i) { for(j = 0; j < 5; ++j) { if(i == 2 && j ==2) { printf("F "); } else{ printf("%2d ", cards[player][card][i][j]); } } printf(" "); } printf(" "); }

int main () { srand(time(NULL)); int num_players, num_cards, i, j, k, l, m, num; int bingo_cards[5][10][5][5]; int count[75]; int num_rows = 5, num_cols = 5; int already_exists = 0; printf("Enter number of players:"); //asking for player count scanf("%d", &num_players);//scanning user input printf("Enter number of cards per players:");//Asking for number of cards per person. scanf("%d", &num_cards);//scanning user input for(i = 0; i < num_players; ++i){ for(j = 0; j < num_cards; ++j){ for (k = 0; k < num_cols; ++k) { for(l = 0; l < num_rows; ++l){ while(1) { num = get_random_number(min_for_col(k), max_for_col(k)); already_exists = 0; for(m = 0; m < 1; ++m){ if(bingo_cards[i][j][m][k] == num){ already_exists = 1; } } if(already_exists == 0){ break; } } bingo_cards[i][j][l][k] = num; } } } } //histogram calculations for( i = 0; i < 75; ++i){ count[i] = 0; } for(i = 0; i < num_players; ++i){ for(j = 0; j < num_cards; ++j){ for (k = 0; k

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago