Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment: This coursework asks you to compare different scoring methods for the sport of squash by simulating matches between players of different ability. Rules of

Assignment: This coursework asks you to compare different scoring methods for the sport of squash by simulating matches between players of different ability.

Rules of squash: This coursework uses a simplified summary of the rules of squash. Squash is a racquet game played by two players, and consists of a number of rallies. In each rally, the player who starts is the server, and the receiving player is the returner. A player wins a rally if the other player is unable to make a legal shot. Matches are usually played over a number of games, with each the winner being the player who reaches a certain score first. Professional matches are played over 5 games, with the winner being the first player to win 3.

There are two scoring systems commonly used in squash:

Point-a-rally scoring (PARS)

The winner of each rally always receives a point (regardless of whether they were the server or re- turner).

The first player to reach at least 11 points and be ahead by at least 2 points wins the game.

If the server wins a rally, they continue as server.

If the returner wins a rally, they become the server.

English scoring

Only the server is awarded a point if they win a rally.

If the server wins a rally, they receive a point and continue as server.

If the returner wins a rally, they become the server but dont receive a point.

The first player to reach 9 points wins the game unless the score has reached 8-8.

If the score reaches 8-8, the player who reached 8 first decides whether to play to 9 or to 10.

Modelling playing ability

  • Assume a player As ability is represented by an integer value rA such that 0
  • In a game between player A and player B, the probability that A wins any given point is:

P (A wins) = rA / rA + rB

I am now looking for question c answer. Please may you also include the software you use to program as I am looking for better softwares.

image text in transcribed

(b) Define a function winProbability(ra, rb, n) that simulates n games in order to estimate the Questions probability that a player with ability ra will win a game against a player of ability r. 1. Provide code to answer the questions below. You should also provide a transcript of a Python inter- Given sufficient simulations, calling the function with abilities 78 and 30 should give the active session that shows the result of executing the test case given for each question. answer 8.98 when printed to 2 decimal places. All parts of this question use the Point-a-rally scoring (PARS) system. (a) Define a function gamel ra, rb) that implements the algorithm below to simulate a single game of squash between players with abilities to and . The function should return the final score (c) Assume players abilities are given in a csv file with the format: as a tuple player a ability, player b ability, a 60, 20, Increase as 100, 55, 50, 40, 20, 70, 95, 85, Start Gerente random number rbcoween and 1 Israp? Yes SCOT No Calculate probably that a wire a point No Increase b's soore Write a function that reads in a csv file of this format and returns a list of tuples containing each pair of abilities. Reading in the data above should return: [(60, 20), (100, 55), (50, 40), (20, 70), (95, 85)]). Initialise Westo Game stere scores Returns Stop (d) Write a function that takes a list of the format returned by your answer to lc as an argument, and uses matplotlib to produce a plot (with labelled axes) showing the probability that player a beats player b (in a game) against ra/r, for each pair. Show the figure produced for data (68, 20), (188, 55), (58, 40), 120, 70), (95, 85)] If the random seed is set to 57, then calling the function with arguments 70 and 30 should return (11, 5). (e) Suppose player a has ability 60 and player b has ability 40, and they play a match where the win- ner is the first player to win n games. What is the smallest value of n such that the probability that a wins the match is at least 0.9? You may answer using simulation, theory, or a combination of both

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_2

Step: 3

blur-text-image_3

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

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions