Question: write this in java he foundation of the Elo system is the probability of a given player beating another. This probability then serves as a

write this in java he foundation of the Elo system is the probability of a given player beating another. This probability then serves as a weight to determine the impact of a win or loss on that players Elo.
First, we must calculate the R values from both players Elo:
R(Player1)=10^{(\frac{Player1Elo}{400})} Note : this is 10^(Player1Elo /400)
R(Player2)=10^{(\frac{Player2Elo}{400})}
If Player1's Elo was 1200 and Player2's Elo was 1000, their R values would be 1000 and 316.227766 respectively.
The R value is then used to calculate the probability that that player would win, this is called the expected score.
E(Player1)=\frac{R(Player1)}{[R(Player1)+R(Player(2)]}=\frac{1000}{1000+316.227766}\approx~0.76
E(Player2)=\frac{R(Player2)}{[R(Player1)+R(Player(2)]}=\frac{316.227766}{1000+316.227766}\approx~0.24
As you can see the expected scores will always sum to 1.
Using these probabilities, we can then calculate the updated Elo from the result of using the following equations.
New Elo of Winning Player =PlayerElo+K*[1-E(Player)]
New Elo of Losing Player =PlayerElo+K*[0-E(Player)]
Note K is a constant, a K-factor, that is used to control how much change will happen to a players Elo after a match. Low values of K result in Elo ratings that do not move much after a match while higher K values result in major swings in Elo ratings after a match. For this assignment we will be using a constant K value of 25.
Assuming Player1 wins the updated Elo for each player would be:
Player1NewElo =P1Elo+K*[1-E(P1)]=1200+25*(1-.76)=1206
Player2NewElo =P2Elo+K*[0-E(P2)]=1000+25*(0-.24)=993
Both players Elo should have changed by and equal amount, but because of Integer truncation the values are not rounded so Player2 lost 7 Elo while Player1 gained 6. Now what happens if the lower rated player wins?
Player1NewElo =P1Elo+K*[0-E(P1)]=1200+25*(0-.76)=1181
Player2NewElo =P2Elo+K*[1-E(P2)]=1000+25*(1-.24)=1018
Player 1 lost 19 points of Elo while Player2 gained 18. Player 2 is rewarded more for winning since they were at a statistical disadvantage.
Due to the complexity of calculating draws, we will assume that every game has a winner.
The above equations use rounded E values for simplicity only. Keep in mind to not round during calculations and to only truncate the value at the end.
Instructions
For this project you will be implementing an interactive menu using the provided Strings in the starter code. Failure to use the provided Strings may result in a loss of points. For this assignment you may not use Lists, ArrayLists, or String.split(). Specific Implementation requirements include:
The program will greet the user with a one time WELCOME_MESSAGE before printing the MAIN_MENU.
The user will then select 1 of 4 options.
Your program must handle invalid inputs on the MENU by printing INVALID_INPUT and reprinting the MAIN_MENU.
Option 1- Single Match:
Prompt the user with the SINGLE_MATCH prompt.
The user will input a single match in the format of [Play1Elo]-[W/L][Player2Elo] Examples 1: 1200-W1000(1200 wins vs 1000). Example2: 1350-L1224(1350 loses to 1224)
The program should print the MATCH_OUTCOME prompt followed by the new Elo for the players in the order entered separated by a hyphen '-'. Example Output1: "The Result of the Single Match is 1206-993". Example Output2: "The Result of the Single Match is 1333-1240"
The program should then return to the MAIN_MENU.
You can assume the user will enter a valid parsable input.
Option 2- Tournament Results:
Prompt the user with the TOURNAMENT_RESULTS prompt.
The user will input a single line in the format of [CompetitorElo]-Result[OpponentElo]-Result2[Opponent2Elo]-... ResultN[OpponentNElo]. Example Input: 1350-L1500-W1200-L1480-W1415-L1520
Note that the length of the string is not set, your program should handle all result strings of 1 or greater.
Note: A players Elo changes after EVERY match played. Which will impact the next match's calculation.
The program should print the TOURNAMENT_OUTCOME prompt followed by competitor Elo then each of the opponents' Elo. Example Output: "The Final Tournament Results are 1348-1507-1192-1487-1399-1527".1348 is the final Elo for the competitor, and the following Elo values are the updated Elo of the opponents after their match.
The program should then return to the MAIN_MENU.
You can assume the user will enter a valid parsabl

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 Databases Questions!