November 20th, 2013, 03:52 PM

Project for school help please!!
using the problem of points, your task is to write a python script that will estimate the probabilities of of each player winning, given their scored at the time the game was abandoned. it should do this by running the game to its conclusion 1000 times and seeing which proportion are won by A and B
Your programme should take as input the specified winning total, T, and the scores, x and y of the two players at the point the game was abandoned the output should be how much money each player will receive ( they each put $5 dollars in so total $10)
PLEASE PLEASE help me with this, i haven't a clue where even to start, anyone got any advice on what i should do and what commands i should use.
also if anyone is willing to write the script for me i will offer payment.
Thanks in advance
Alex
November 20th, 2013, 05:49 PM

Please describe the problem of points.
[code]
Code tags[/code] are essential for python code and Makefiles!
November 20th, 2013, 05:56 PM

the problem of points
the problem of points, is where two players A and B each put £5 in to a pot as prize money for the game. A fair coin will be tossed repeatedly , when it lands on head A gets a point, when it lands on tails B gets a point. the winner is the first person to to get to T points (the case i am using is where T=10)
at a point in the game, where A has 8 points and B 7, the game is abandoned, and they need a fair way to distribute the pot between them, they decide the amount each player receives is proportional to the probability of the player winning if the game continued.
now the task is to write a python script simulating the end of the game, running it 1000 times and working out the proportion won by A and B. the program shoud take the input of the specified winning total T and scores of A and B of the two players when the game was abandoned and the output should be how much money each player should recieve
November 20th, 2013, 06:02 PM

the problem of points, is where two players A and B each put £5 in to a pot as prize money for the game. A fair coin will be tossed repeatedly , when it lands on head A gets a point, when it lands on tails B gets a point. the winner is the first person to to get to T points (the case i am using is where T=10)
at a point in the game, where A has 8 points and B 7, the game is abandoned, and they need a fair way to distribute the pot between them, they decide the amount each player receives is proportional to the probability of the player winning if the game continued.
now the task is to write a python script simulating the end of the game, running it 1000 times and working out the proportion won by A and B. the program shoud take the input of the specified winning total T and scores of A and B of the two players when the game was abandoned and the output should be how much money each player should recieve
November 20th, 2013, 10:28 PM

function names should be verbs, not nouns.
OK. Upon abandonment,
a player needs T(their current points) additional points.
We can toss a coin like this:
Code:
import random
random.choice(['head', 'tail'])
How could we then increment the correct counter?
And let's say we get this history for 3 trials instead of 1000 trials.
Code:
Let's name the players H and T
score
H T status, Trial 1
8 7 abandoned!
9 7 heads
9 8 tails
9 9 tails
10 9 heads
H T status, Trial 2
8 7 abandoned!
9 7 heads
10 7 heads
H T status, Trial 2
8 7 abandoned!
9 7 heads
9 8 tails
9 9 tails
9 10 tails
What is the probability of player H winning?
Last edited by b49P23TIvg; November 20th, 2013 at 10:30 PM.
Reason: fixed random.choice I'll never learn the name of this function.
[code]
Code tags[/code] are essential for python code and Makefiles!
November 21st, 2013, 05:44 PM

i have a code, theres seems to be a problem with it, will you look at it for me please? i think its with a while and if loop?
November 21st, 2013, 06:14 PM

No substance. Not even ethereal.
From the looks of it, the program is too short!
[code]
Code tags[/code] are essential for python code and Makefiles!