import java.util.*; public class PlayerGeneticLearningFuzzy extends Player { public int[][][] iDecisionMatrix; public int[] iValidCalls; public int iValidCallCount; public PlayerGeneticLearningFuzzy() { sName = "Genetic Learning - Fuzzy"; sShortType = "GLF"; iDecisionMatrix = GenerateFuzzyDecisionMatrix("Random"); } public PlayerGeneticLearningFuzzy(int iGen) { sName = "Genetic Learning - Fuzzy, Generation "+iGen+" (Mutation)"; sShortType = "GLF"; iDecisionMatrix = GenerateFuzzyDecisionMatrix("Random"); } public PlayerGeneticLearningFuzzy(String sInitType) { sName = "Genetic Learning - Fuzzy"; sShortType = "GLF"; iDecisionMatrix = GenerateFuzzyDecisionMatrix(sInitType); } public PlayerGeneticLearningFuzzy(int iGen, PlayerGeneticLearningFuzzy Parent1, PlayerGeneticLearningFuzzy Parent2) { sName = "Genetic Learning - Fuzzy, Generation "+iGen+" (Bred)"; sShortType = "GLF"; iDecisionMatrix = FuzzyBreed(Parent1, Parent2); } public int[][][] FuzzyBreed(PlayerGeneticLearningFuzzy Parent1, PlayerGeneticLearningFuzzy Parent2) { int[][][] ReturnedMatrix = new int[17][10][5]; Random generator = new Random(); int iDonor; for (int i = 0; i < 17; i++) { for (int j = 0; j < 10; j++) { iDonor = generator.nextInt(2); if (iDonor == 0) { for (int k = 0; k < 5; k++) { ReturnedMatrix[i][j][k] = Parent1.iDecisionMatrix[i][j][k]; } } else { for (int k = 0; k < 5; k++) { ReturnedMatrix[i][j][k] = Parent2.iDecisionMatrix[i][j][k]; } } } } return ReturnedMatrix; } public int[][][] GenerateFuzzyDecisionMatrix(String sInitType) { int[][][] ReturnedMatrix = new int[17][10][5]; if (sInitType.equals("S17")) { int[][][] DecMatrix = { {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 4 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 5 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 6 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 7 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 8 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 9 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 10 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 11 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 12 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 13 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 14 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 15 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 16 {{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 17 {{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 18 {{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 19 {{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 20 }; ReturnedMatrix = DecMatrix; } else if (sInitType.equals("H17")) { int[][][] DecMatrix = { {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 4 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 5 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 6 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 7 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 8 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 9 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 10 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 11 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 12 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 13 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 14 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 15 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 16 {{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 17 {{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 18 {{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 19 {{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 20 }; ReturnedMatrix = DecMatrix; } else if (sInitType.equals("WoO")) { int[][][] DecMatrix = { {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 4 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 5 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 6 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 7 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,0,100,0},{0,0,0,100,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 8 {{0,0,100,0,0},{0,0,100,0,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0}, {0,0,0,100,0},{0,0,0,100,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 9 {{0,0,100,0,0},{0,0,100,0,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0}, {0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0}}, //Score = 10 {{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0}, {0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0}}, //Score = 11 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 12 {{0,0,100,0,0},{0,0,100,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 13 {{0,0,100,0,0},{0,0,100,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 14 {{0,0,100,0,0},{0,0,100,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 15 {{100,0,0,0,0},{100,0,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 16 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 17 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 18 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 19 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 20 }; ReturnedMatrix = DecMatrix; } else if (sInitType.equals("BB")) { int[][][] DecMatrix = { {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 4 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 5 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 6 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 7 {{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 8 {{0,0,100,0,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 9 {{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0}, {0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 10 {{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0}, {0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,0,100,0},{0,0,100,0,0}}, //Score = 11 {{0,0,100,0,0},{0,0,100,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 12 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 13 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0}}, //Score = 14 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,0,100,0,0},{0,0,100,0,0},{0,0,100,0,0},{100,0,0,0,0},{0,0,100,0,0}}, //Score = 15 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,0,100,0,0},{0,0,100,0,0},{100,0,0,0,0},{100,0,0,0,0},{100,0,0,0,0}}, //Score = 16 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 17 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 18 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 19 {{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}, {0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0},{0,100,0,0,0}}, //Score = 20 }; ReturnedMatrix = DecMatrix; } else { Random generator = new Random(); for (int i = 0; i < 17; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 5; k++) { ReturnedMatrix[i][j][k] = generator.nextInt(100); } } } } return ReturnedMatrix; } public String getShortType() { return sShortType; } public int call(int iPlayerNum, int iPlayers, Hand[] hPlayers) { int iPlayer = hPlayers[iPlayerNum].getScore()-4; int iDealer = hPlayers[0].faceCard()-2; if (iPlayer == 17) return 1; if (iPlayer < 0 || iPlayer > 17 || iDealer < 0 || iDealer > 9) return 0; Random generator = new Random(); int iSeed; iValidCalls = new int[5]; iValidCallCount = 0; for (int k = 0; k < 5; k++) { iSeed = generator.nextInt(100); if (iSeed < iDecisionMatrix[iPlayer][iDealer][k]) { iValidCalls[iValidCallCount] = k; iValidCallCount++; } } if (iValidCallCount == 0) return 1; iSeed = generator.nextInt(iValidCallCount); return iValidCalls[iSeed]; } public String getName() { return sName; } public int getRunningScore() { if (iRunningScore==0) return 0; return (int) 100 * iRunningScore/iRunningGameCount; } public int getWins() { return iWins; } public int getScore() { if (iScore==0) return 0; return (int) 100 * iScore/iGameCount; } public void updateScore(int iProfit) { iScore = iScore + iProfit; iRunningScore = iRunningScore + iProfit; iGameCount++; iRunningGameCount++; if (iProfit > 0) iWins++; } public void reset() { iRunningScore = 0; iRunningGameCount = 0; } public String toString() { String sOutput = sName+":\n"; for (int i = 0; i < 17; i++) { sOutput+="["; for (int j = 0; j < 10; j++) { sOutput+=" "+iDecisionMatrix[i][j]; } sOutput+=" ] Score = "+(i+4)+"\n"; } sOutput+="\n"; return sOutput; } public int compareTo(Object obj) { Player comp = (Player) obj; if (this.getScore() < comp.getScore()) return 1; if (this.getScore() > comp.getScore()) return -1; return 0; } public void run(int iIterations) { Player[] pPlayers = new Player[2]; pPlayers[0]= new Player("S17"); pPlayers[1]= this; pPlayers[1].reset(); Table cTable = new Table(pPlayers); for (int i = 0; i < iIterations; i++) { cTable.play(); } cTable.print(); cTable.record(pPlayers[1].getShortType()+ "-Primary.txt"); cTable.recordSimple(pPlayers[1].getShortType()+"-Simple.txt"); pPlayers[1].reset(); } public void run2(int iIterations) { Player[] pPlayers = new Player[2]; pPlayers[0]= new Player("S17"); pPlayers[1]= this; pPlayers[1].reset(); Table cTable = new Table(pPlayers); for (int i = 0; i < iIterations; i++) { cTable.play(); } cTable.print(); cTable.record2(pPlayers[1].getShortType()+ "-Primary.txt"); cTable.recordSimple2(pPlayers[1].getShortType()+"-Simple.txt"); pPlayers[1].reset(); } public static void main (String[] args) { int iIterations; int iGenerations; int iTrainingRuns; if (args.length>0) iGenerations = Integer.parseInt(args[0]); else iGenerations = 25; if (args.length>1) iIterations = Integer.parseInt(args[1]); else iIterations = 1000; if (args.length>2) iTrainingRuns = Integer.parseInt(args[2]); else iTrainingRuns = 100000; Player pOne = new PlayerGeneticLearning(); Player pTwo = new PlayerGeneticLearning(); System.out.println("Type: "+pOne.getName()+"; Iterations: "+iIterations+"; Generations: "+iGenerations+"; Trainings Runs: "+iTrainingRuns); System.out.println(pOne.toString()); System.out.println(pTwo.toString()); for (int i = 0; i < iGenerations; i++) { System.out.println("Beginning Generation #"+(i+1)); pOne.run(iIterations); pTwo.run2(iIterations); } } }