SlideShare a Scribd company logo
1 of 3
Download to read offline
Soccer Tournament Simulator (soccer_tournament.py) Your friend is a member of the UVM
Women's Soccer Team and they have a tournament coming up. Since you are currently enrolled
in a computer programming course, you decided to come up with a game that simulates the
outcome of the tournament. As such, you designed a two player game that prompts each user to
pick a team, the program then iterates over rounds of the six-team tournament and selects a
winner based on an algorithm you designed, then stops once the computer-selected winning team
matches the team picked by one of the two players. That player is declared the winner and the
program then prompts the user to see if they want to play again - if yes, the fun continues! Note:
Assignment # 7 will build on this prognam! In an effort to make your program reasonably
reflect the abilities of the various teams in the tournament, you investigated their season statistics
(see Vermoht Women's Soccer Statistics) and developed the following rank and weight system
(Figure 1) to be used in your team-picking algorithm. In other words, instead of your program
sclecting a winning team completely at random, you increased the probability that a higher-
ranked team would be picked to win based on the criteria you determined from your research. To
apply your findings to your program, your code will mandomly (technically pseudorandomly)
generate an integer between 0 and 1000 (inclusive). Based on the weights, each team has been
assigned a range of values, indicated in the table as Low (inclusive) and High (exclusive). If the
randomly generated integer falls within the range for a team, that team is determined to be the
pick (winner) of that round. For example, le's say the mandom integer generated was 572 . Since
the range for UVM is 490-730, UVM would be the winner for that round. Another example; if
the value generated was 314 , Dartmouth wins Figure 1: Tournament Tams and Rank Data Some
general considerutions + Input validation must be used to ensure the users only enter teams in the
tournament (Figure 1) + Player two cannot choose the same team as player one (use input
validation to display message and allow another selection) + The player that selects the team that
wins in the fewest rounds is declared the winner + At the end of the game, prompt the user to
play again and cither plyy another game (if ' 'entered) or quit the game (for ' n ' or character other
than ' y ') + Functions must follow the requirements listed below, including passing arguments
into functions and returning value(s) from functions Refer to the sample runs below for exact
formatting and text Your program must have the following functions (names and functional
requirements): 1. main: Begins program execution: calls display title function to display the
program title. Then calls get_teams function, which returns the two team names [strings] selected
by Player 1 and Player 2 (see get_teams function requirements below). Once the user team picks
are obtained, display the table headers (Round, Winner, Pick Value) to show the data generated
in each round of play. Call the play_round function to obtain a winning team name [string] and
random value [integer] for the round and display that data as a row in the table. Check the
computer generated winning team name against both players team picks. If neither player picked
the winning team, play another round. If either player picked correctly, that marks the last round.
Display the winner of the game and the number of rounds it took. Prompt the user to play again
and either play another game (if ' y ' entered) or quit the game (for ' n ' or characteq other than ' y
'). Panameters: none | Returns: none 2. get_teams: Displays list of teams in the tournament.
Prompts Player 1 to enter team pick, validates that text entered is a valid team (i.e., that team is
part of the tournament). Prompts Player 2 for team pick, validates that text entered is a valid
team (i.e, that team is part of the tournament) AND that it is not the same team picked by Player
1. Prompt user for another pick if input validation fails and do not allow the game to progress
until valid input is obtained. Pammeters: none I Returns: player one's team pick [string], player
two's team pick [string] 3. play_round: Calls get_random_value to obtain a random integer.
Using the ranges defined in Figure 1 (between Low and High values), determine the team range
that the random integer falls within (e.g, if random integer is 132, team is Stony Brook). Return
the team name and the random integer back to main (the function that called play_round).
Parameters: none | Returns: winning team name [string], random value [integer] 4. display title:
displays program title, "Soccer Tournament Simulator" with a top and bottom border created
with "=". See sample runs. Parameters: none | Returns: none 5. get_random_yalue: Generates a
random integer within the range of 0-1000 (inclusive) to facilitate randomization of computer
winning team pick during game play. Parameters: none I Returns: single random integer between
0 and 1000 (inclusive) [integer]. Your program format should match the provided sample runs
below (Note: your actual data will vary based on the random nature of the simulations): Soccer
Tournament Simulator TEAMS *** Princeton I UVM I Dartmouth I Stony Brook I Albany I
Merrimack Player one enter team name: UVM Player two enter team name: Dartmouth Player 1
wins! UvM won in 1 round of the simulation Would you like to play again? ( y / n ) n Thanks for
playing! Soccer Tournament Simulator TEAMS ** Princeton I UVM I Dartmouth I Stony Brook
I Albany I Merrimack Player one enter team name: P> UVM Player two enter team name: uvM
Player 1 already chose that team. Please select another team that is in the tournament Player two
enter team name: Albany 3 Player 1 wings uvM won in 2 rounds of the simulation Would you
like to play again? ( y / n ) 3 Soccer Tournament Simulator TEAMS Princeton I UVM I
Dartmouth I Stony Brook I Albany I Merrimack Player one enter team name: UVM Player two
enter team name: > Albany Player 1 wins! UVM won in 4 rounds of the simulation Would you
like to play again? ( y / n ) > Soccer Tournament Simulator TEAMS * Princeton I UVM I
Dartmouth I Stony Brook I Albany I Merrimack Player one enter team name: UMass Please
select a team that is in the tournament Player one enter team name: Merrimack Player two enter
team name: > UVM Player 2 wins? UVM won in 4 rounds of the simulation Would you like to
play again? (y/n) Soccer Tournament Simulator *A TEAMS Princeton I UVM I Dartmouth I
Stony Brook I Albany I Merrimack Player one enter team name: Dartmouth Player two enter
team name: abc Please select a team that is in the tournament Player two enter team name:
Dartmouth Player 1 already chose that team. Please select another team that is in the tournament
Player two enter team name: Princeton Player 2 wins! Princeton won in 1 round of the simulation
Requirements (not following will result in point deductions) - Use constants as needed! No
magic numbers (except where explicitly approved)! No global variables (global constants OK )!
- Refer to the PEP 8 Syle Gaide for Python Code PDF posted in Module 2 for style standards. - It
is expected that you will complete the same process of development outlined in the textbook and
videos. When you reach the point of having an algonithm (pseudocode), this will become the
comments of your program and should become the starting point for writing code. Comment
first, then write codel - Be sure to include a docstring at the top of the program that includes your
name, class and a short description of the program. - Be sure all output is formatted. Unless
otherwise specified, display float values with two digits after the decimal point (i.e, 2.43). - After
Module 3, when input validation is specified, you must use a loop (not an if statement). - A
reasonable amount of exception handling is expected on all assignments (cg, ValueError,
FileNotFoundError, cte.) where appropriate (once introduced in Module 7). - Your program
output must exactly match what is provided in examples in this document for full credit (no
modifications to output accepted). - Only programming concepts introduced thus far in this
course are accepted. While there may be more efficient/clegant solutions to a given problem, the
expectation is that you practice the concepts presented. Once a concept is covered, you may use
it for the remainder of the course. - In CS 021 , the use of break statements is not permitted. -
Create a separate script. (Python file) for each program, with the file name as identified above.
Submit all files to the appropriate Blackboard dropbos (you must attach all files before clicking
'submit'). - All programs should have a main function as well as additional user-defined
function(s) as called for in the assignment specification. - All functions must be well-
documented with a docstring being the first line within the function (refer to the style guide).
Include an explanation stating the task that the function will perform, what pammeters it takes (if
any), and what values it returns (if any). drigeed and wed for ake Measure Of Softuvare
Similanig (MOSS).

More Related Content

Similar to Soccer Tournament Simulator (soccer_tournament-py) Your friend is a me.pdf

Project Title Enterprise Database DesignTable of ContentsII.docx
Project Title Enterprise Database DesignTable of ContentsII.docxProject Title Enterprise Database DesignTable of ContentsII.docx
Project Title Enterprise Database DesignTable of ContentsII.docxwkyra78
Β 
Java Helpa4.pdfASSIGNMENT 4 A game and an email system.docx
Java Helpa4.pdfASSIGNMENT 4  A game and an email system.docxJava Helpa4.pdfASSIGNMENT 4  A game and an email system.docx
Java Helpa4.pdfASSIGNMENT 4 A game and an email system.docxpriestmanmable
Β 
C++ projct
C++ projctC++ projct
C++ projctJ M
Β 
NBA playoff prediction Model.pptx
NBA playoff prediction Model.pptxNBA playoff prediction Model.pptx
NBA playoff prediction Model.pptxrishikeshravi30
Β 
Inheritance - Creating a Multilevel Hierarchy In this lab- you will s.pdf
Inheritance - Creating a Multilevel Hierarchy  In this lab- you will s.pdfInheritance - Creating a Multilevel Hierarchy  In this lab- you will s.pdf
Inheritance - Creating a Multilevel Hierarchy In this lab- you will s.pdfEvanpZjSandersony
Β 
Football connect screens
Football connect screensFootball connect screens
Football connect screensJackson Stephens
Β 
NIT1201 Introduction to Database System Assignment by USA Experts
NIT1201 Introduction to Database System Assignment by USA ExpertsNIT1201 Introduction to Database System Assignment by USA Experts
NIT1201 Introduction to Database System Assignment by USA ExpertsJohnsmith5188
Β 
Inheritance - Creating a Multilevel Hierarchy In this lab- you will s.pdf
Inheritance - Creating a Multilevel Hierarchy  In this lab- you will s.pdfInheritance - Creating a Multilevel Hierarchy  In this lab- you will s.pdf
Inheritance - Creating a Multilevel Hierarchy In this lab- you will s.pdfvishalateen
Β 

Similar to Soccer Tournament Simulator (soccer_tournament-py) Your friend is a me.pdf (11)

Project Title Enterprise Database DesignTable of ContentsII.docx
Project Title Enterprise Database DesignTable of ContentsII.docxProject Title Enterprise Database DesignTable of ContentsII.docx
Project Title Enterprise Database DesignTable of ContentsII.docx
Β 
Java Helpa4.pdfASSIGNMENT 4 A game and an email system.docx
Java Helpa4.pdfASSIGNMENT 4  A game and an email system.docxJava Helpa4.pdfASSIGNMENT 4  A game and an email system.docx
Java Helpa4.pdfASSIGNMENT 4 A game and an email system.docx
Β 
C++ projct
C++ projctC++ projct
C++ projct
Β 
NBA playoff prediction Model.pptx
NBA playoff prediction Model.pptxNBA playoff prediction Model.pptx
NBA playoff prediction Model.pptx
Β 
OR 14 15-unit_4
OR 14 15-unit_4OR 14 15-unit_4
OR 14 15-unit_4
Β 
Inheritance - Creating a Multilevel Hierarchy In this lab- you will s.pdf
Inheritance - Creating a Multilevel Hierarchy  In this lab- you will s.pdfInheritance - Creating a Multilevel Hierarchy  In this lab- you will s.pdf
Inheritance - Creating a Multilevel Hierarchy In this lab- you will s.pdf
Β 
Football connect screens
Football connect screensFootball connect screens
Football connect screens
Β 
IRJET-V8I11270.pdf
IRJET-V8I11270.pdfIRJET-V8I11270.pdf
IRJET-V8I11270.pdf
Β 
NIT1201 Introduction to Database System Assignment by USA Experts
NIT1201 Introduction to Database System Assignment by USA ExpertsNIT1201 Introduction to Database System Assignment by USA Experts
NIT1201 Introduction to Database System Assignment by USA Experts
Β 
Inheritance - Creating a Multilevel Hierarchy In this lab- you will s.pdf
Inheritance - Creating a Multilevel Hierarchy  In this lab- you will s.pdfInheritance - Creating a Multilevel Hierarchy  In this lab- you will s.pdf
Inheritance - Creating a Multilevel Hierarchy In this lab- you will s.pdf
Β 
Cs229 final report
Cs229 final reportCs229 final report
Cs229 final report
Β 

More from john344

Some microbes can tolerate oxygen while others cannot- What do organis.pdf
Some microbes can tolerate oxygen while others cannot- What do organis.pdfSome microbes can tolerate oxygen while others cannot- What do organis.pdf
Some microbes can tolerate oxygen while others cannot- What do organis.pdfjohn344
Β 
st-Lab Assesment 8B Question 2.pdf
st-Lab Assesment 8B Question 2.pdfst-Lab Assesment 8B Question 2.pdf
st-Lab Assesment 8B Question 2.pdfjohn344
Β 
SQL is sometimes referred to as the most popular programming language.pdf
SQL is sometimes referred to as the most popular programming language.pdfSQL is sometimes referred to as the most popular programming language.pdf
SQL is sometimes referred to as the most popular programming language.pdfjohn344
Β 
Sorting with Linked-List Write a c++ program to read a series of integ.pdf
Sorting with Linked-List Write a c++ program to read a series of integ.pdfSorting with Linked-List Write a c++ program to read a series of integ.pdf
Sorting with Linked-List Write a c++ program to read a series of integ.pdfjohn344
Β 
SRG 119 HW 6- MICROBIAL GROWTH Complete the cross word by hand- scan i.pdf
SRG 119 HW 6- MICROBIAL GROWTH Complete the cross word by hand- scan i.pdfSRG 119 HW 6- MICROBIAL GROWTH Complete the cross word by hand- scan i.pdf
SRG 119 HW 6- MICROBIAL GROWTH Complete the cross word by hand- scan i.pdfjohn344
Β 
SQL A bookstore wants to stock mystery stories from particular publish.pdf
SQL A bookstore wants to stock mystery stories from particular publish.pdfSQL A bookstore wants to stock mystery stories from particular publish.pdf
SQL A bookstore wants to stock mystery stories from particular publish.pdfjohn344
Β 
Spud really likes potatoes- At best any other goods are worth less tha.pdf
Spud really likes potatoes- At best any other goods are worth less tha.pdfSpud really likes potatoes- At best any other goods are worth less tha.pdf
Spud really likes potatoes- At best any other goods are worth less tha.pdfjohn344
Β 
split(self) (3 points) Divides the original list in half- returning tw.pdf
split(self) (3 points) Divides the original list in half- returning tw.pdfsplit(self) (3 points) Divides the original list in half- returning tw.pdf
split(self) (3 points) Divides the original list in half- returning tw.pdfjohn344
Β 
Spell out the abbreviation then discuss purpose- use- and structure of.pdf
Spell out the abbreviation then discuss purpose- use- and structure of.pdfSpell out the abbreviation then discuss purpose- use- and structure of.pdf
Spell out the abbreviation then discuss purpose- use- and structure of.pdfjohn344
Β 
Spinal nerves and pathways of information- Define-describe the terms b.pdf
Spinal nerves and pathways of information- Define-describe the terms b.pdfSpinal nerves and pathways of information- Define-describe the terms b.pdf
Spinal nerves and pathways of information- Define-describe the terms b.pdfjohn344
Β 
Sphinxes are usually red- A rare purple color is recessive in both Asi.pdf
Sphinxes are usually red- A rare purple color is recessive in both Asi.pdfSphinxes are usually red- A rare purple color is recessive in both Asi.pdf
Sphinxes are usually red- A rare purple color is recessive in both Asi.pdfjohn344
Β 
Space --- the final frontier- So- as I am sure everyone knows- the Nat.pdf
Space --- the final frontier- So- as I am sure everyone knows- the Nat.pdfSpace --- the final frontier- So- as I am sure everyone knows- the Nat.pdf
Space --- the final frontier- So- as I am sure everyone knows- the Nat.pdfjohn344
Β 
Solve the problem and show the working Use the ones complement to fin.pdf
Solve the problem and show the working  Use the ones complement to fin.pdfSolve the problem and show the working  Use the ones complement to fin.pdf
Solve the problem and show the working Use the ones complement to fin.pdfjohn344
Β 
Southeastern Oklahoma State University's business program has the faci.pdf
Southeastern Oklahoma State University's business program has the faci.pdfSoutheastern Oklahoma State University's business program has the faci.pdf
Southeastern Oklahoma State University's business program has the faci.pdfjohn344
Β 
Sophia and Dorcas are sisters who share the same room- The room can ea.pdf
Sophia and Dorcas are sisters who share the same room- The room can ea.pdfSophia and Dorcas are sisters who share the same room- The room can ea.pdf
Sophia and Dorcas are sisters who share the same room- The room can ea.pdfjohn344
Β 
sorry for the spacing on the second half 6- Larke volvmers of nucleoti.pdf
sorry for the spacing on the second half 6- Larke volvmers of nucleoti.pdfsorry for the spacing on the second half 6- Larke volvmers of nucleoti.pdf
sorry for the spacing on the second half 6- Larke volvmers of nucleoti.pdfjohn344
Β 
Song saa private island- Cambodia has madesignificant progress in-sust (1).pdf
Song saa private island- Cambodia has madesignificant progress in-sust (1).pdfSong saa private island- Cambodia has madesignificant progress in-sust (1).pdf
Song saa private island- Cambodia has madesignificant progress in-sust (1).pdfjohn344
Β 
Someone who is an Select one- a- entrepreneurial manager b- immoral ma.pdf
Someone who is an Select one- a- entrepreneurial manager b- immoral ma.pdfSomeone who is an Select one- a- entrepreneurial manager b- immoral ma.pdf
Someone who is an Select one- a- entrepreneurial manager b- immoral ma.pdfjohn344
Β 
some ways in which our economies are dependent on environmental servic.pdf
some ways in which our economies are dependent on environmental servic.pdfsome ways in which our economies are dependent on environmental servic.pdf
some ways in which our economies are dependent on environmental servic.pdfjohn344
Β 
Some strains of the bacteria Escherichia coli readily cause bacteria U.pdf
Some strains of the bacteria Escherichia coli readily cause bacteria U.pdfSome strains of the bacteria Escherichia coli readily cause bacteria U.pdf
Some strains of the bacteria Escherichia coli readily cause bacteria U.pdfjohn344
Β 

More from john344 (20)

Some microbes can tolerate oxygen while others cannot- What do organis.pdf
Some microbes can tolerate oxygen while others cannot- What do organis.pdfSome microbes can tolerate oxygen while others cannot- What do organis.pdf
Some microbes can tolerate oxygen while others cannot- What do organis.pdf
Β 
st-Lab Assesment 8B Question 2.pdf
st-Lab Assesment 8B Question 2.pdfst-Lab Assesment 8B Question 2.pdf
st-Lab Assesment 8B Question 2.pdf
Β 
SQL is sometimes referred to as the most popular programming language.pdf
SQL is sometimes referred to as the most popular programming language.pdfSQL is sometimes referred to as the most popular programming language.pdf
SQL is sometimes referred to as the most popular programming language.pdf
Β 
Sorting with Linked-List Write a c++ program to read a series of integ.pdf
Sorting with Linked-List Write a c++ program to read a series of integ.pdfSorting with Linked-List Write a c++ program to read a series of integ.pdf
Sorting with Linked-List Write a c++ program to read a series of integ.pdf
Β 
SRG 119 HW 6- MICROBIAL GROWTH Complete the cross word by hand- scan i.pdf
SRG 119 HW 6- MICROBIAL GROWTH Complete the cross word by hand- scan i.pdfSRG 119 HW 6- MICROBIAL GROWTH Complete the cross word by hand- scan i.pdf
SRG 119 HW 6- MICROBIAL GROWTH Complete the cross word by hand- scan i.pdf
Β 
SQL A bookstore wants to stock mystery stories from particular publish.pdf
SQL A bookstore wants to stock mystery stories from particular publish.pdfSQL A bookstore wants to stock mystery stories from particular publish.pdf
SQL A bookstore wants to stock mystery stories from particular publish.pdf
Β 
Spud really likes potatoes- At best any other goods are worth less tha.pdf
Spud really likes potatoes- At best any other goods are worth less tha.pdfSpud really likes potatoes- At best any other goods are worth less tha.pdf
Spud really likes potatoes- At best any other goods are worth less tha.pdf
Β 
split(self) (3 points) Divides the original list in half- returning tw.pdf
split(self) (3 points) Divides the original list in half- returning tw.pdfsplit(self) (3 points) Divides the original list in half- returning tw.pdf
split(self) (3 points) Divides the original list in half- returning tw.pdf
Β 
Spell out the abbreviation then discuss purpose- use- and structure of.pdf
Spell out the abbreviation then discuss purpose- use- and structure of.pdfSpell out the abbreviation then discuss purpose- use- and structure of.pdf
Spell out the abbreviation then discuss purpose- use- and structure of.pdf
Β 
Spinal nerves and pathways of information- Define-describe the terms b.pdf
Spinal nerves and pathways of information- Define-describe the terms b.pdfSpinal nerves and pathways of information- Define-describe the terms b.pdf
Spinal nerves and pathways of information- Define-describe the terms b.pdf
Β 
Sphinxes are usually red- A rare purple color is recessive in both Asi.pdf
Sphinxes are usually red- A rare purple color is recessive in both Asi.pdfSphinxes are usually red- A rare purple color is recessive in both Asi.pdf
Sphinxes are usually red- A rare purple color is recessive in both Asi.pdf
Β 
Space --- the final frontier- So- as I am sure everyone knows- the Nat.pdf
Space --- the final frontier- So- as I am sure everyone knows- the Nat.pdfSpace --- the final frontier- So- as I am sure everyone knows- the Nat.pdf
Space --- the final frontier- So- as I am sure everyone knows- the Nat.pdf
Β 
Solve the problem and show the working Use the ones complement to fin.pdf
Solve the problem and show the working  Use the ones complement to fin.pdfSolve the problem and show the working  Use the ones complement to fin.pdf
Solve the problem and show the working Use the ones complement to fin.pdf
Β 
Southeastern Oklahoma State University's business program has the faci.pdf
Southeastern Oklahoma State University's business program has the faci.pdfSoutheastern Oklahoma State University's business program has the faci.pdf
Southeastern Oklahoma State University's business program has the faci.pdf
Β 
Sophia and Dorcas are sisters who share the same room- The room can ea.pdf
Sophia and Dorcas are sisters who share the same room- The room can ea.pdfSophia and Dorcas are sisters who share the same room- The room can ea.pdf
Sophia and Dorcas are sisters who share the same room- The room can ea.pdf
Β 
sorry for the spacing on the second half 6- Larke volvmers of nucleoti.pdf
sorry for the spacing on the second half 6- Larke volvmers of nucleoti.pdfsorry for the spacing on the second half 6- Larke volvmers of nucleoti.pdf
sorry for the spacing on the second half 6- Larke volvmers of nucleoti.pdf
Β 
Song saa private island- Cambodia has madesignificant progress in-sust (1).pdf
Song saa private island- Cambodia has madesignificant progress in-sust (1).pdfSong saa private island- Cambodia has madesignificant progress in-sust (1).pdf
Song saa private island- Cambodia has madesignificant progress in-sust (1).pdf
Β 
Someone who is an Select one- a- entrepreneurial manager b- immoral ma.pdf
Someone who is an Select one- a- entrepreneurial manager b- immoral ma.pdfSomeone who is an Select one- a- entrepreneurial manager b- immoral ma.pdf
Someone who is an Select one- a- entrepreneurial manager b- immoral ma.pdf
Β 
some ways in which our economies are dependent on environmental servic.pdf
some ways in which our economies are dependent on environmental servic.pdfsome ways in which our economies are dependent on environmental servic.pdf
some ways in which our economies are dependent on environmental servic.pdf
Β 
Some strains of the bacteria Escherichia coli readily cause bacteria U.pdf
Some strains of the bacteria Escherichia coli readily cause bacteria U.pdfSome strains of the bacteria Escherichia coli readily cause bacteria U.pdf
Some strains of the bacteria Escherichia coli readily cause bacteria U.pdf
Β 

Recently uploaded

Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
Β 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
Β 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
Β 
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈcall girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ9953056974 Low Rate Call Girls In Saket, Delhi NCR
Β 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
Β 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
Β 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
Β 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
Β 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
Β 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
Β 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
Β 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
Β 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
Β 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
Β 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
Β 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
Β 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
Β 

Recently uploaded (20)

Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Β 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
Β 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
Β 
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈcall girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
Β 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
Β 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
Β 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
Β 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Β 
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Β 
Model Call Girl in Tilak Nagar Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Tilak Nagar Delhi reach out to us at πŸ”9953056974πŸ”Model Call Girl in Tilak Nagar Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Tilak Nagar Delhi reach out to us at πŸ”9953056974πŸ”
Β 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
Β 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
Β 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
Β 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
Β 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
Β 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
Β 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
Β 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
Β 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
Β 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
Β 

Soccer Tournament Simulator (soccer_tournament-py) Your friend is a me.pdf

  • 1. Soccer Tournament Simulator (soccer_tournament.py) Your friend is a member of the UVM Women's Soccer Team and they have a tournament coming up. Since you are currently enrolled in a computer programming course, you decided to come up with a game that simulates the outcome of the tournament. As such, you designed a two player game that prompts each user to pick a team, the program then iterates over rounds of the six-team tournament and selects a winner based on an algorithm you designed, then stops once the computer-selected winning team matches the team picked by one of the two players. That player is declared the winner and the program then prompts the user to see if they want to play again - if yes, the fun continues! Note: Assignment # 7 will build on this prognam! In an effort to make your program reasonably reflect the abilities of the various teams in the tournament, you investigated their season statistics (see Vermoht Women's Soccer Statistics) and developed the following rank and weight system (Figure 1) to be used in your team-picking algorithm. In other words, instead of your program sclecting a winning team completely at random, you increased the probability that a higher- ranked team would be picked to win based on the criteria you determined from your research. To apply your findings to your program, your code will mandomly (technically pseudorandomly) generate an integer between 0 and 1000 (inclusive). Based on the weights, each team has been assigned a range of values, indicated in the table as Low (inclusive) and High (exclusive). If the randomly generated integer falls within the range for a team, that team is determined to be the pick (winner) of that round. For example, le's say the mandom integer generated was 572 . Since the range for UVM is 490-730, UVM would be the winner for that round. Another example; if the value generated was 314 , Dartmouth wins Figure 1: Tournament Tams and Rank Data Some general considerutions + Input validation must be used to ensure the users only enter teams in the tournament (Figure 1) + Player two cannot choose the same team as player one (use input validation to display message and allow another selection) + The player that selects the team that wins in the fewest rounds is declared the winner + At the end of the game, prompt the user to play again and cither plyy another game (if ' 'entered) or quit the game (for ' n ' or character other than ' y ') + Functions must follow the requirements listed below, including passing arguments into functions and returning value(s) from functions Refer to the sample runs below for exact formatting and text Your program must have the following functions (names and functional requirements): 1. main: Begins program execution: calls display title function to display the program title. Then calls get_teams function, which returns the two team names [strings] selected by Player 1 and Player 2 (see get_teams function requirements below). Once the user team picks are obtained, display the table headers (Round, Winner, Pick Value) to show the data generated in each round of play. Call the play_round function to obtain a winning team name [string] and random value [integer] for the round and display that data as a row in the table. Check the computer generated winning team name against both players team picks. If neither player picked the winning team, play another round. If either player picked correctly, that marks the last round. Display the winner of the game and the number of rounds it took. Prompt the user to play again and either play another game (if ' y ' entered) or quit the game (for ' n ' or characteq other than ' y '). Panameters: none | Returns: none 2. get_teams: Displays list of teams in the tournament. Prompts Player 1 to enter team pick, validates that text entered is a valid team (i.e., that team is part of the tournament). Prompts Player 2 for team pick, validates that text entered is a valid team (i.e, that team is part of the tournament) AND that it is not the same team picked by Player 1. Prompt user for another pick if input validation fails and do not allow the game to progress until valid input is obtained. Pammeters: none I Returns: player one's team pick [string], player two's team pick [string] 3. play_round: Calls get_random_value to obtain a random integer.
  • 2. Using the ranges defined in Figure 1 (between Low and High values), determine the team range that the random integer falls within (e.g, if random integer is 132, team is Stony Brook). Return the team name and the random integer back to main (the function that called play_round). Parameters: none | Returns: winning team name [string], random value [integer] 4. display title: displays program title, "Soccer Tournament Simulator" with a top and bottom border created with "=". See sample runs. Parameters: none | Returns: none 5. get_random_yalue: Generates a random integer within the range of 0-1000 (inclusive) to facilitate randomization of computer winning team pick during game play. Parameters: none I Returns: single random integer between 0 and 1000 (inclusive) [integer]. Your program format should match the provided sample runs below (Note: your actual data will vary based on the random nature of the simulations): Soccer Tournament Simulator TEAMS *** Princeton I UVM I Dartmouth I Stony Brook I Albany I Merrimack Player one enter team name: UVM Player two enter team name: Dartmouth Player 1 wins! UvM won in 1 round of the simulation Would you like to play again? ( y / n ) n Thanks for playing! Soccer Tournament Simulator TEAMS ** Princeton I UVM I Dartmouth I Stony Brook I Albany I Merrimack Player one enter team name: P> UVM Player two enter team name: uvM Player 1 already chose that team. Please select another team that is in the tournament Player two enter team name: Albany 3 Player 1 wings uvM won in 2 rounds of the simulation Would you like to play again? ( y / n ) 3 Soccer Tournament Simulator TEAMS Princeton I UVM I Dartmouth I Stony Brook I Albany I Merrimack Player one enter team name: UVM Player two enter team name: > Albany Player 1 wins! UVM won in 4 rounds of the simulation Would you like to play again? ( y / n ) > Soccer Tournament Simulator TEAMS * Princeton I UVM I Dartmouth I Stony Brook I Albany I Merrimack Player one enter team name: UMass Please select a team that is in the tournament Player one enter team name: Merrimack Player two enter team name: > UVM Player 2 wins? UVM won in 4 rounds of the simulation Would you like to play again? (y/n) Soccer Tournament Simulator *A TEAMS Princeton I UVM I Dartmouth I Stony Brook I Albany I Merrimack Player one enter team name: Dartmouth Player two enter team name: abc Please select a team that is in the tournament Player two enter team name: Dartmouth Player 1 already chose that team. Please select another team that is in the tournament Player two enter team name: Princeton Player 2 wins! Princeton won in 1 round of the simulation Requirements (not following will result in point deductions) - Use constants as needed! No magic numbers (except where explicitly approved)! No global variables (global constants OK )! - Refer to the PEP 8 Syle Gaide for Python Code PDF posted in Module 2 for style standards. - It is expected that you will complete the same process of development outlined in the textbook and videos. When you reach the point of having an algonithm (pseudocode), this will become the comments of your program and should become the starting point for writing code. Comment first, then write codel - Be sure to include a docstring at the top of the program that includes your name, class and a short description of the program. - Be sure all output is formatted. Unless otherwise specified, display float values with two digits after the decimal point (i.e, 2.43). - After Module 3, when input validation is specified, you must use a loop (not an if statement). - A reasonable amount of exception handling is expected on all assignments (cg, ValueError, FileNotFoundError, cte.) where appropriate (once introduced in Module 7). - Your program output must exactly match what is provided in examples in this document for full credit (no modifications to output accepted). - Only programming concepts introduced thus far in this course are accepted. While there may be more efficient/clegant solutions to a given problem, the expectation is that you practice the concepts presented. Once a concept is covered, you may use it for the remainder of the course. - In CS 021 , the use of break statements is not permitted. -
  • 3. Create a separate script. (Python file) for each program, with the file name as identified above. Submit all files to the appropriate Blackboard dropbos (you must attach all files before clicking 'submit'). - All programs should have a main function as well as additional user-defined function(s) as called for in the assignment specification. - All functions must be well- documented with a docstring being the first line within the function (refer to the style guide). Include an explanation stating the task that the function will perform, what pammeters it takes (if any), and what values it returns (if any). drigeed and wed for ake Measure Of Softuvare Similanig (MOSS).