You have to make a simulator of cricket match. Make two teams of 11 players each. Each player will have his name, runs s
Posted: Fri Jun 10, 2022 11:55 am
QUESTION
ONLY c++. and plz follow the guidelines..
You have to make a simulator of cricket match. Make two teams of 11 players each. Each player will have his name, runs scored, balls faced, balls bowled, runs given, wickets taken. [use 1D/2D/3D arrays]. Your match simulation will be performed using excessive use of random function. The execution of the simulation will be in the following order ● Match will be simulated for N number of overs. Value of N will be read from the configuration.txt file. [use filing] Toss will be done and any team can win the toss and bat first. [random function] ● Player 1 and Player 2 of the batting team will appear on the score card. Player 1 will face the first ball. Later on, the batsman facing the ball will be decided as follows: [setw()] O Score 1,3,5 will mean other end batsman will face next ball. O Over completed means other end batsman will face next ball. ● Bowler 1 will be the last player of Team B. Bowler 2 will be the second last player of team B and so on. Last fiver players of Team B will be bowlers. Each bowler can bowl a maximum of total_overs/5 overs (e.g. for a 20 over match, maximum overs bowled by a bowler would be 4). Ball will be bowled by pressing ENTER key. Each ball bowled will get a hit which will get some score randomly (-1-6). If -1 comes, batsman is declared OUT. [Scoreboard changes will be done by clearing the screen and then drawing again with new values. You can use system("clear") function to clear the console and should have your own function to draw() scoreboard again with new values which should be passed to the function.] ● All batsmen don't have same probability of getting out, that is, a bowler (player number 6 to 11) will have 50% chance of getting out on each ball and 50% of getting any score from 0-6. Similarly, a batsman (player number 1 to 5) will have 10% chance of getting out and 90% chance of getting score 0-6 on each ball.
APAKISTAN INNINGS (50 overs maximum) BATTING M SR Aamer Sohail vc+Stewart b Pringle 20 21.05 Ramiz Raja ✓lbw b Pringle 36 30.76 Imran Khan (c) vclllingworth b Botham 72 159 5 65.45 Javed Miandad 125 ✓c Botham b Illingworth 58 4 0 59.18 ✓b Pringle 42 46 Inzamam-ul-Haq 4 0 120.00 Wasim Akram run out (†Stewart) 33 4 21 0 183.33 Saleem Malik not out 0 1 2 0 0 0.00 TOTAL 50 Ov (RR: 4.98) 249/6 Did not bat: Ijaz Ahmed, Moin Khan †. Mushtaq Ahmed, Aaqib Javed Fall of wickets: 1-20 (Aamer Sohail, 4.6 ov), 2-24 (Ramiz Raja, 8.2 ov), 3-163 (Javed Miandad, 39.3 ov). 4-197 (Imran Khan, 43.3 ov), 5-249 (Inzamam-ul-Haq 49.5 ov), 6-249 (Wasim Akram, 49.6 ov) BOWLING O M R W ECON WD NB 10 Derek Pringle 22 3 v 2.20 3 5 Chris Lewis 10 52 0 5.20 1 2 lan Botham 7 42 1 v 6.00 1 0 Phil DeFreitas 10 42 0 4.20 0 0 Richard Illingworth 10 0 50 1 v 5.00 0 0 Dermot Reeve 3 0 22 0 7.33 1 0 There should be a function to find total score to be displayed on the scorecard which is also displayed by a function. Total score is actually sum of scores of all players who batted. Similarly, total dismissed is sum of all players who got out. If a batsman is DISMISSED/OUT, his score card will be displayed until ENTER is pressed again. After that, main score card is displayed again. [You can stop output until a key is pressed by using cin.get() function. And then clear the screen and then redraw Scoreboard] Javed Miandad vc Botham b Illingworth 58 98 125 4 0 59.18 ● The innings of the team playing first will end if all overs are bowled or all players are dismissed. In any case, full scorecard should be displayed showing full innings summary. There should be a special key to press during the program which will prompt user to enter the over number to directly jump to; so that we can skip ENTER key for each ball and possibility to jump to a particular over or the end of innings directly. To make more interesting, you can introduce an optional short delay after each ball bowled so that you can see how match is proceeding. Seconds innings will be executed same as before except that the target, remaining score, remaining overs, required run rate is also included in the score card. You don't need to display first innings scoreboard when second innings is being played. 2 2 0 1 R 4 8 B 19 26 110 98 35 18 4s 0 1 6s 0 0 1
A ENGLAND INNINGS (Target: 250 runs from 50 overs) BATTING SR Graham Gooch (c) 43.93 lan Botham 0.00 Alec Stewart + 43.75 Graeme Hick 47.22 Neil Fairbrother 62 88.57 Allan Lamb. 31 75.60 Chris Lewis 0 0.00 Dermot Reeve 15 32 46.87 Derek Pringle 18 16 112.50 Phil DeFreitas 10 8 13 O 0 125.00 Richard Illingworth 14 10 9 2 0 140.00 TOTAL 49.2 Ov (RR: 4.60) 227 Fall of wickets: 1-6 (lan Botham, 2.5 ov), 2-21 (Alec Stewart, 7.3 ov), 3-59 (Graeme Hick, 18.6 ov). 4-69 (Graham Gooch, 20.5 ov). 5-141 (Allan Lamb, 34.5 ov), 6-141 (Chris Lewis, 34.6 ov). 7-180 (Neil Fairbrother, 42.5 ov), 8-183 (Dermot Reeve. 43.6 ov). 9-208 (Phil DeFreitas, 47.1 ov), 10-227 (Richard Illingworth, 49.2 ov) O BOWLING M R W ECON WD NB Wasim Akram 10 0 4.90 6 4 Aaqib Javed 10 2 2 v 2.70 3 Mushtaq Ahmed 10 1 3 v 4.10 1 Ijaz Ahmed 3 O 0 4.33 Imran Khan. 6.2 0 43 1V 6.78 Aamer Sohail 10 0 49 0 4.90 1 0 ● When match is finished, user gets an option to show a short summary of the match, show first innings, show second innings, save match data on file, load a previous match data. [Use files to write and read match data, switch statement to display this menu] Result ● ● Bowler taking highest wickets will be declared bowler of the match. Batsman scoring highest runs will be declared batsman of the match. Team winning will be shown as winner. ● ✓c Aaqib Javed b Mushtaq Ahmed vc+Moin Khan b Wasim Akram vc+Moin Khan b Aagib Javed ✓lbw b Mushtaq Ahmed ✓c+Moin Khan b Aaqib Javed ✓b Wasim Akram ✓b Wasim Akram ✓c Ramiz Raja b Mushtaq Ahmed not out run out (Saleem Malik/+Moin Khan) cRamiz Raja b Imran Khan R 29 0 7 17 49 27 41 13 B 66 6 16 36 70 41 1 M 93 12 22 49 97 54 6 38 29 4s 1 0 1 1 3 2 0 0 1 6s 0 0 0 0 0 0 0 0 0 2 0 1 0 0 1
Rubrik Task Using arrays (1D, 2D, ..) to make teams. Calculating correct probability of scoring or getting out for the batsmen and bowlers. 10 Function to draw live scoreboard repeatedly (clear screen, redraw with new values) 10 Sub-function to draw live score card -> calculate total score Sub-function to draw live score card -> fall of wickets 10 Sub-function to draw live score card -> overs bowled Sub-function to draw live score card -> run rate Sub-function to draw live score card -> batting board Sub-function to draw live score card -> bowling board. 10 10 Jump to desired over of the innings directly 10 10 Final result (bowler and batsman of the match, winning team, match summary) Game configuration file to define number of overs. 10 Write match data and later read it from file 10 10 Error free program (even if it is not fulfilling all requirements -50% functions must be implemented) Using dynamically created pointers correctly instead of normal static array at least in 10 case. Properly formatted scorecard as shown in the images 10 Properly formatted/indented and commented program code 10 Total marks 170 Marks 888888 10 10 10 10
write the code for thiss (C++) ONLY c++. and plz follow the guidelines..
You have to make a simulator of cricket match. Make two teams of 11 players each. Each player will have his name, runs scored, balls faced, balls bowled, runs given, wickets taken. [use 1D/2D/3D arrays]. Your match simulation will be performed using excessive use of random function. The execution of the simulation will be in the following order ● Match will be simulated for N number of overs. Value of N will be read from the configuration.txt file. [use filing] Toss will be done and any team can win the toss and bat first. [random function] ● Player 1 and Player 2 of the batting team will appear on the score card. Player 1 will face the first ball. Later on, the batsman facing the ball will be decided as follows: [setw()] O Score 1,3,5 will mean other end batsman will face next ball. O Over completed means other end batsman will face next ball. ● Bowler 1 will be the last player of Team B. Bowler 2 will be the second last player of team B and so on. Last fiver players of Team B will be bowlers. Each bowler can bowl a maximum of total_overs/5 overs (e.g. for a 20 over match, maximum overs bowled by a bowler would be 4). Ball will be bowled by pressing ENTER key. Each ball bowled will get a hit which will get some score randomly (-1-6). If -1 comes, batsman is declared OUT. [Scoreboard changes will be done by clearing the screen and then drawing again with new values. You can use system("clear") function to clear the console and should have your own function to draw() scoreboard again with new values which should be passed to the function.] ● All batsmen don't have same probability of getting out, that is, a bowler (player number 6 to 11) will have 50% chance of getting out on each ball and 50% of getting any score from 0-6. Similarly, a batsman (player number 1 to 5) will have 10% chance of getting out and 90% chance of getting score 0-6 on each ball.
APAKISTAN INNINGS (50 overs maximum) BATTING M SR Aamer Sohail vc+Stewart b Pringle 20 21.05 Ramiz Raja ✓lbw b Pringle 36 30.76 Imran Khan (c) vclllingworth b Botham 72 159 5 65.45 Javed Miandad 125 ✓c Botham b Illingworth 58 4 0 59.18 ✓b Pringle 42 46 Inzamam-ul-Haq 4 0 120.00 Wasim Akram run out (†Stewart) 33 4 21 0 183.33 Saleem Malik not out 0 1 2 0 0 0.00 TOTAL 50 Ov (RR: 4.98) 249/6 Did not bat: Ijaz Ahmed, Moin Khan †. Mushtaq Ahmed, Aaqib Javed Fall of wickets: 1-20 (Aamer Sohail, 4.6 ov), 2-24 (Ramiz Raja, 8.2 ov), 3-163 (Javed Miandad, 39.3 ov). 4-197 (Imran Khan, 43.3 ov), 5-249 (Inzamam-ul-Haq 49.5 ov), 6-249 (Wasim Akram, 49.6 ov) BOWLING O M R W ECON WD NB 10 Derek Pringle 22 3 v 2.20 3 5 Chris Lewis 10 52 0 5.20 1 2 lan Botham 7 42 1 v 6.00 1 0 Phil DeFreitas 10 42 0 4.20 0 0 Richard Illingworth 10 0 50 1 v 5.00 0 0 Dermot Reeve 3 0 22 0 7.33 1 0 There should be a function to find total score to be displayed on the scorecard which is also displayed by a function. Total score is actually sum of scores of all players who batted. Similarly, total dismissed is sum of all players who got out. If a batsman is DISMISSED/OUT, his score card will be displayed until ENTER is pressed again. After that, main score card is displayed again. [You can stop output until a key is pressed by using cin.get() function. And then clear the screen and then redraw Scoreboard] Javed Miandad vc Botham b Illingworth 58 98 125 4 0 59.18 ● The innings of the team playing first will end if all overs are bowled or all players are dismissed. In any case, full scorecard should be displayed showing full innings summary. There should be a special key to press during the program which will prompt user to enter the over number to directly jump to; so that we can skip ENTER key for each ball and possibility to jump to a particular over or the end of innings directly. To make more interesting, you can introduce an optional short delay after each ball bowled so that you can see how match is proceeding. Seconds innings will be executed same as before except that the target, remaining score, remaining overs, required run rate is also included in the score card. You don't need to display first innings scoreboard when second innings is being played. 2 2 0 1 R 4 8 B 19 26 110 98 35 18 4s 0 1 6s 0 0 1
A ENGLAND INNINGS (Target: 250 runs from 50 overs) BATTING SR Graham Gooch (c) 43.93 lan Botham 0.00 Alec Stewart + 43.75 Graeme Hick 47.22 Neil Fairbrother 62 88.57 Allan Lamb. 31 75.60 Chris Lewis 0 0.00 Dermot Reeve 15 32 46.87 Derek Pringle 18 16 112.50 Phil DeFreitas 10 8 13 O 0 125.00 Richard Illingworth 14 10 9 2 0 140.00 TOTAL 49.2 Ov (RR: 4.60) 227 Fall of wickets: 1-6 (lan Botham, 2.5 ov), 2-21 (Alec Stewart, 7.3 ov), 3-59 (Graeme Hick, 18.6 ov). 4-69 (Graham Gooch, 20.5 ov). 5-141 (Allan Lamb, 34.5 ov), 6-141 (Chris Lewis, 34.6 ov). 7-180 (Neil Fairbrother, 42.5 ov), 8-183 (Dermot Reeve. 43.6 ov). 9-208 (Phil DeFreitas, 47.1 ov), 10-227 (Richard Illingworth, 49.2 ov) O BOWLING M R W ECON WD NB Wasim Akram 10 0 4.90 6 4 Aaqib Javed 10 2 2 v 2.70 3 Mushtaq Ahmed 10 1 3 v 4.10 1 Ijaz Ahmed 3 O 0 4.33 Imran Khan. 6.2 0 43 1V 6.78 Aamer Sohail 10 0 49 0 4.90 1 0 ● When match is finished, user gets an option to show a short summary of the match, show first innings, show second innings, save match data on file, load a previous match data. [Use files to write and read match data, switch statement to display this menu] Result ● ● Bowler taking highest wickets will be declared bowler of the match. Batsman scoring highest runs will be declared batsman of the match. Team winning will be shown as winner. ● ✓c Aaqib Javed b Mushtaq Ahmed vc+Moin Khan b Wasim Akram vc+Moin Khan b Aagib Javed ✓lbw b Mushtaq Ahmed ✓c+Moin Khan b Aaqib Javed ✓b Wasim Akram ✓b Wasim Akram ✓c Ramiz Raja b Mushtaq Ahmed not out run out (Saleem Malik/+Moin Khan) cRamiz Raja b Imran Khan R 29 0 7 17 49 27 41 13 B 66 6 16 36 70 41 1 M 93 12 22 49 97 54 6 38 29 4s 1 0 1 1 3 2 0 0 1 6s 0 0 0 0 0 0 0 0 0 2 0 1 0 0 1
Rubrik Task Using arrays (1D, 2D, ..) to make teams. Calculating correct probability of scoring or getting out for the batsmen and bowlers. 10 Function to draw live scoreboard repeatedly (clear screen, redraw with new values) 10 Sub-function to draw live score card -> calculate total score Sub-function to draw live score card -> fall of wickets 10 Sub-function to draw live score card -> overs bowled Sub-function to draw live score card -> run rate Sub-function to draw live score card -> batting board Sub-function to draw live score card -> bowling board. 10 10 Jump to desired over of the innings directly 10 10 Final result (bowler and batsman of the match, winning team, match summary) Game configuration file to define number of overs. 10 Write match data and later read it from file 10 10 Error free program (even if it is not fulfilling all requirements -50% functions must be implemented) Using dynamically created pointers correctly instead of normal static array at least in 10 case. Properly formatted scorecard as shown in the images 10 Properly formatted/indented and commented program code 10 Total marks 170 Marks 888888 10 10 10 10