01: package examples.gp.tictactoe;
02:
03: import org.jgap.gp.*;
04: import org.jgap.gp.impl.*;
05: import junit.framework.*;
06:
07: public class TicTacToeTest extends GPTestCase {
08: /** String containing the CVS revision. Read out via reflection!*/
09: private final static String CVS_REVISION = "$Revision: 1.1 $";
10:
11: public static Test suite() {
12: TestSuite suite = new TestSuite(TicTacToeTest.class);
13: return suite;
14: }
15:
16: public void setUp() {
17: super .setUp();
18: }
19:
20: /**
21: * @throws Exception
22: *
23: * @author Klaus Meffert
24: * @since 3.2
25: */
26: public void testConstruct_0() throws Exception {
27: // Player 1
28: GPConfiguration config = new GPConfiguration();
29: config.setGPFitnessEvaluator(new DeltaGPFitnessEvaluator());
30: config.setMaxInitDepth(8);
31: config.setPopulationSize(40);
32: config.setStrictProgramCreation(false);
33: config.setProgramCreationMaxTries(5);
34: config.setMaxCrossoverDepth(12);
35: // INodeValidator validator = new GameNodeValidator();
36: TicTacToeMain game1 = new TicTacToeMain(config);
37: GPGenotype player1 = game1.create(config, 1, null, 2);
38: // Player 2
39: GPConfiguration config2 = new GPConfiguration();
40: config2.setGPFitnessEvaluator(new DeltaGPFitnessEvaluator());
41: config2.setMaxInitDepth(8);
42: config2.setPopulationSize(40);
43: config2.setStrictProgramCreation(false);
44: config2.setProgramCreationMaxTries(5);
45: config2.setMaxCrossoverDepth(12);
46: TicTacToeMain game2 = new TicTacToeMain(config2);
47: GPGenotype player2 = game2.create(config2, 2, null, 1);
48: // Preset program of player 1
49: }
50: }
51: /**
52: * for(int x=0;x<2;x++) {
53: * mem0 = 0;
54: * for(int y=0;y<2;y++) {
55: * IfColor(2) {
56: * mem0+1;
57: * }
58: * mem0 = ReadBoard(x,y);
59: *
60: * }
61: * }
62: */
|