Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The loops for incrementing the thresholds and testing them all work, but how would I go about calculating the minimum and maximum scores for each

The loops for incrementing the thresholds and testing them all work, but how would I go about calculating the minimum and maximum scores for each combination of threshold values? How would I keep just the currentMax and currentMin? The final answer only needs to be which t1 and which t2 gives an advantage to a player, and what that advantage is.

IN JAVA --- prompt in question

Consider the following game between two players: Both players simultaneously declare "one" or "two". Player 1 wins if the sum of the two declared numbers is odd and Player 2 wins if the sum is even. In either case the loser is obliged to pay the winner (in tokens) the sum of the two declared numbers. So Player 1 may have to pay 2 or 4 tokens or may win 3 tokens. You can imagine a single session between two players involving many games. At the end of a session, one player may have won many tokens from the other.

Write a new test class called Simulation that allows you to run some simulations (play many games of computer versus computer) using various combinations of the threshold variable t for each player. A single simulated game need not print or return anything. Check to see how much each player loses or wins for each combination of thresholds after many games. Is it better to be the odd player? The even player? Does it matter? Better here means that if enough games are played there is a strategy (threshold) that one player can use that guarantees positive average outcome regardless of the other player's strategy. We call it a fair game if there is no such strategy for either player. By using the computer vs. computer option in your program set up some extended sessions of computer vs. computer to test different combinations of Player 1's t and Player 2's t (Hint: use a nested for loop structure to vary each player's threshold). Determine if either player has an advantage and if so which player it is and determine a threshold value t* that demonstrates the advantage.

Write a new test class called Simulation that allows you to run some simulations (play many games of computer versus computer) using various combinations of the threshold variable t for each player. A single simulated game need not print or return anything. Check to see how much each player loses or wins for each combination of thresholds after many games. Is it better to be the odd player? The even player? Does it matter? Better here means that if enough games are played there is a strategy (threshold) that one player can use that guarantees positive average outcome regardless of the other player's strategy. We call it a fair game if there is no such strategy for either player. By using the computer vs. computer option in your program set up some extended sessions of computer vs. computer to test different combinations of Player 1's t and Player 2's t (Hint: use a nested for loop structure to vary each player's threshold). Determine if either player has an advantage and if so which player it is and determine a threshold value t* that demonstrates the advantage.

No need to use arrays. Remember you don't need to keep track of the average winnings for every combination. Just the max-min. That is, you just need to know which strategy guarantees the maximum minimum return. What do I mean by maximum minimum return? Suppose Player 1 chooses a strategy (t=.6, for example). Player 2 will now want to choose a strategy that minimizes Player 1's average winnings over many games (ie: maximizes Player 2's average winnings). Maybe that's strategy t=.5, maybe it's t=.65, whatever it is, that's Player 2's optimal strategy given Player 1 playing with strategy t=.6 and that's the minimum return Player 1 can expect in the long run when playing with strategy t=.6 for many games. If that minimum is a positive number it means the game is not fair because it means that if Player 1 plays with strategy t=.6, no matter what Player 2 does, Player 1 will win tokens in the long run. So Player 1 wants to find a strategy (a value for t), among all possible strategies, that has a minimum return that's positive. More generally Player 1 wants to maximize their minimum return. Of course Player 2 wants to do the same. If either player can find a strategy with a positive valued max-min return, then the game is not fair.

You only have a ComputerPlayer class, Game class, the main method SimTest class (this class just makes sure that two computers can play against each other for specified amount of games) and the main method Simulation class (this class should run simulations to determine whether or not the Odd-Even game is fair and if not who has the advantage and what is a strategy that will realize that advantage).

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago