Controlling the win rate of a game
Task Introduction
The game being created for this task is a simple dice game. Given two dice the HUman and Computer AI both must roll the two dice each round. The computer AI must have an average win rate of 70%. At the end of the round the winner is decided based on the following win conditions:
- Whoever gets a double (or the highest double)
- If no doubles are rolled highest total wins
- If both totals are the same, round results in a tie
My Method
Intially I wasn't sure on how to tackle the requirement of a 70% win rate for the computer. I searched online and found different solutions. I ultimately decided on creating two dice rolls, one for the player and one for the computer. The computer dice roll had increased odds, being 70% change to roll a 4 and above for each dice resulting in better win rates. Testing this method out after about 100 games on average the computer would win anywhere from 60-80% of the time.
Better Method
After some in class discussion, another classmate revealed a better way to ensure an average win rate of 70%. The way they achieved this was to keep track of the computer's win rate. By keeping track of the win rate, adjustments could be made such as rerolling the computer's dice until it's current dice total was greater than the player's current dice total. Using this method compared to my method it allowed the computer to maintain an average 70% win rate by the player quits playing.