For this assignment that you need to write a Java program that reads pay-off table of a two-player strategic game and prints out all Nash equilibria and all strict Nash equilibria of this game. Keep in mind that each strict Nash equilibrium is also just a Nash equilibrium.
Input Format. Your program should read from a file. The first line of the input file will contain two positive integers representing the number of strategies of the first and second player accordingly. The rest of the file will contain pay-off matrix one row per line with spaces used as separators. For example, the input file for prisoner's dilemma look like this:
2 2 -2.0 -2.0 0.0 -3.0 -3.0 0.0 -1.0 -1.0
An input file for Rock-Paper-Scissors game looks like this
3 3 0.0 0.0 -1.0 1.0 1.0 -1.0 1.0 -1.0 0.0 0.0 -1.0 1.0 -1.0 1.0 1.0 -1.0 0.0 0.0
Algorithm. Implement the most straightforward algorithm that uses several nested loops to test each strategy profile.
Execution. Your program must run from the command line. The name of the file with the description of the game will be passed as the argument. The name of the Java class and the name of the file in which you write the code should have form HW2hopper and HW2hopper.java, where "hopper" should be your last name. Here is an example of the command line that will be used on a hypothetical assignment submitted by Grace Hopper:
> java HW2hopper prisoners.game
Output. Your program must output in the terminal window the list of all equilibria and, separately, the list of all strict equilibria. The format of a single equilibrium is (r,c), where positive integer r is the row number and positive integer c is the column number of the cell in which the equilibrium is achieved. If the game has no equilibria of the given type, output ``none". For example, in case of prisoner's dilemma, the output is
> java HW2hopper prisoners.game The list of Nash equilibria: (1,1), The list of strict Nash equilibria: (1,1),
In case of Rock-Paper-Scissors:
> java HW2hopper rps.game The list of Nash equilibria: none The list of strict Nash equilibria: none
In case of defined in class Battle-of-Sexes game:
> java HW2hopper bos.game The list of Nash equilibria: (1,1), (2,2), The list of strict Nash equilibria: (1,1), (2,2),
Submission. Follow this link to submit your code using password "game". Grace Hopper would submit a single java file HW2hopper.java. Do not submit .class file. If you re-submit the same file several times, I will only grade the most recent version. In addition, print out your code on paper and submit this printout in class.