0% found this document useful (0 votes)
22 views

Python

This document describes an assignment to create a Python program to simulate a cricket tournament. The tournament will have two groups (A and B) with 4 teams each that are randomly assigned. Matches will also be randomly selected between teams in the selected group. The toss will be random to determine whether the team bats or bowls first. The match will then be simulated with random outputs for runs, wickets, dismissals. Points will be awarded to the winning team. Test cases are provided to test the toss prediction and first batting/bowling team. Screenshots of the test cases and code are included.

Uploaded by

Oshen Geenath
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Python

This document describes an assignment to create a Python program to simulate a cricket tournament. The tournament will have two groups (A and B) with 4 teams each that are randomly assigned. Matches will also be randomly selected between teams in the selected group. The toss will be random to determine whether the team bats or bowls first. The match will then be simulated with random outputs for runs, wickets, dismissals. Points will be awarded to the winning team. Test cases are provided to test the toss prediction and first batting/bowling team. Screenshots of the test cases and code are included.

Uploaded by

Oshen Geenath
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Course: Artificial intelligence and data science

CM1601-programming fundamentals
Assignment Type: Individual

Student Name: A.J.Oshen Geenath


IIT ID-20210434
RGU ID-2119944
Problem description

It is required to develop a python program to play cricket tournament which consist


of a major round there are two groups know as GROUP A and GROUP B. At the
start of the tournament user should divide the two groups and should name the
teams which is going to participate the tournament.
GROUP A has 4 teams and GROUP B has 4 teams. The group selection will be
happen randomly it will chose that the match is going to play by which group.
Then it will again randomly select in the selected group among which teams the
match is going to be played then the toss also will be random. The team which win
the toss have the ability to choose that are they going to bat first or are they going
to ball first. Then the match will also played randomly that mean the baller, runs,
wickets, way of dismissal etc… In the first inning when the wickets are 10 or the
overs are 20 then it should move to the second inning. Then the above mentioned
process will be continue again .Then when the both innings finish they will inform
the winners and they add two points to the winning team
2) Flow Chart

 Getting a input form user asking what to do


 If user input “a” (Entering all the details or loading existing data)
 Entering player details
 If user enter “2” as the input then to rename a player
 Random match selection
Test cases
Test Inputs Expected Output Actual output Remarks
case

1 Match 1 Toss to Sri lanka and Toss to Sri lanka and Test case Pass
bowl first bowl first

2 Match 2 Toss to Sri lanka and Toss to Sri lanka and bat Test case Pass
bat first first

3 Match 3 Toss to south africa Toss to south africa and Test case Pass
and bat first bat first

4 Match 4 Toss to south africa Toss to south africa and Test case Pass
and ball first ball first
Screen shots of the test cases used to test the programs and the results.
1)

2)

3)

4)
Some other screen shots of the code
Match summary
Team Changing after 1st innings

You might also like