Question: how to simulate a single point squash game using r? can you help us with the following problem? A game of squash is played by

how to simulate a single point squash game using r? can you help us with the following problem?

A game of squash is played by two people: player 1 and player 2. The game

consists of a sequence of points . If player i serves and wins the point, then

his/her score increases by 1 and he/she retains the serve (for i = 1 or 2). If

player i serves and loses the point, then the serve is transferred to the other

player and the scores stay the same.

The winner is the first person to get 9 points, unless the score reaches 8 all

first. If the score reaches 8 all then play continues until one player is 2 points

ahead of the other, in which case he/she is the winner.

The object of this assignment is to simulate a game of squash and estimate

the probability that player 1 wins. Define

a = P ( player 1 wins a point | player 1 serves )

b = P ( player 1 wins a point | player 2 serves )

x = number of points won by player 1

y = number of points won by player 2

z =

1 if player 1 has the serve

2 if player 2 has the serve

We will assume that player 1 serves first.

Simulating a game (main question in which I need help)

The vector state = (x, y, z) describes the current state of the game. How do you write

function play_point that takes inputs state, a and b, simulates the play of a

single point, then returns an updated vector state representing the new state

of the game.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!