For this assignment you will write a Java program that plays a finite iterative game between two Moore machines. To keep the implementation simple, we assume that each of the two machines has only two strategies: C and D.
Your program will read the description of a machine from a file. The first line of the file contains a positive integer number n equal to the number of states of the machine. The second line will contain n symbols separated by spaces. Each symbol is either C or D. If i-th symbol is C, then machine plays strategy C in i-th state; if it's D, then the machine plays strategy D. The third line will contain n integer numbers, separated by spaces, showing the new states into which the machine goes if the opponent plays strategy C. For example if 2nd number on this line is 3, then the machine transition from state 2 to state 3 when the opponent plays C. The fourth line will contain n integer numbers, separated by spaces, showing the new states into which the machine transitions if the opponent plays strategy D. For example if 2nd number in this line is 4, then the machine transition from state 2 to state 4 when the opponent plays D. Initial state of the machine is state 1.
For example, the following file describes Grim Trigger Moore machine:
2 C D 1 2 2 2
Your program must read from the command line three arguments. The first two arguments will specify two files with descriptions of Moore machines. The third argument is a nonnegative integer number specifying number of iterations of the finite iterative game. Your program must output strategies used by each player in each of the iterations. For example:
java HW8hopper grim_trigger.game grim_trigger.game 5 CC CC CC CC CC
Use the same submission instruction as before. Good luck!