jonnyjack
Council Member
Well this code doesn't quite do it... because it assumes that if Player1 does not score, Player2 gets possession. And "MakeItTakeIt" isn't quite played under those rules. For example if Player 1 "takes it in"...and player 2 steals the ball at the top of the key before the shot, Player 1 has to take it back to midcourt, but if Player 2 steals it back in the process, Player 2 still gets to drive for the basket.
You are making a bunch of simplifying assumptions. - which is OK, but understand how they are simpliflying.
What you really want underlying this statisitcally is A Markov Chain probability - IE where the Next State is dependent on the previous state http://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/Chapter11.pdf A Markov Chain is driven by a "Transition Matrix" between the states.
Player A takes in Next Player B Takes in NExt Player A takes in (51%) 51% 49% Loserly Player takes in (49%) 49% 51%
You then iterate on this matrix.
I believe the Arkady simulation is an example of a Markov process. If the state is "possession of ball" then who has the ball next depends on who currently has the ball. The Markov matrix is built into the 5.1/4.9 factors of the simulation.
I re-did the simulation using field goal percentage as the skill parameter. Say stats have been kept over time and Player 1 makes 51% of his shots when he has possession, and player 2 makes 49%. Note: there's no reason the 2 numbers need to add to 100. Also, the first player to 20 points wins, so no ties. When I carried out the simulation I got these results:
Game object: first player to 20 wins.
Possession rule: make-it-take-it
Player 1 skill: 51.0% field goal percent (based on stats over time)
Player 2 skill: 49.0% field goal percent (based on stats over time)
RESULTS:
Player 1: 56951 (%56.95) wins, Player 2: 43049 (%43.05) wins
If you change skill levels to 52% and 48%:
Game object: first player to 20 wins.
Possession rule: make-it-take-it
Player 1 skill: 52.0% field goal percent (based on stats over time)
Player 2 skill: 48.0% field goal percent (based on stats over time)
RESULTS:
Player 1: 64046 (64.05%) wins, Player 2: 35954 (35.95%) wins

