forked from MaxRobinson/Alt-AIResearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomAgent.java
More file actions
129 lines (109 loc) · 4.14 KB
/
RandomAgent.java
File metadata and controls
129 lines (109 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package randomPackage;
import java.util.*;
public class RandomAgent extends Agent {
/**
* RandomAgent Constructor.
*/
public RandomAgent() {
super();
}
/**
* RandomAgent Ctor
*/
public RandomAgent(StateMachineEnvironment environment) {
super(environment);
}
/**
* main
*
* @param args
*/
public static void main(String[] args) {
/*
* RandomAgent test = new RandomAgent(); test.findRandomPath();
* test.env.printStateMachine(); test.printPath();
*
* StateMachineEnvironment testEnv = new StateMachineEnvironment(5,2);
* RandomAgent test2 = new RandomAgent(testEnv); test2.findRandomPath();
* test2.env.printStateMachine(); test2.printPath();
*/
/*
* //TEST 1 smartAgent tester = new smartAgent();
*
* //this is going to be used to test the path matching algorithm
* ArrayList<Episode> testMem = new ArrayList<Episode>();
* testMem.add(new Episode('b', 0, 1)); testMem.add(new Episode('a', 1,
* 2)); testMem.add(new Episode('b', 1, 3)); testMem.add(new
* Episode('b', 2, 4));
*
* ArrayList<Episode> testCurrent = new ArrayList<Episode>();
* testCurrent.add(new Episode('a', 1, 9));
*
* tester.episodicMemory = testMem; tester.currentPath = testCurrent;
*
* if(tester.analyzeMove().getReturnValue()){
* System.out.println("SUCCESS!!!!"); }
*
*
* //TEST 2
*
* StateMachineEnvironment testEnv5 = new StateMachineEnvironment(5,4);
* smartAgent tester2 = new smartAgent(testEnv5);
*
* ArrayList<Episode> testMem2 = new ArrayList<Episode>();
* testMem2.add(new Episode(' ', 0, 1)); testMem2.add(new Episode('b',
* 0, 2)); testMem2.add(new Episode('c', 0, 3)); testMem2.add(new
* Episode('b', 0, 4)); testMem2.add(new Episode('c', 0, 5));
* testMem2.add(new Episode('d', 2, 6));
*
* ArrayList<Episode> testCurrent2 = new ArrayList<Episode>();
* testCurrent2.add(new Episode('a', 0, 100)); testCurrent2.add(new
* Episode('b', 0, 200)); testCurrent2.add(new Episode('c', 0, 300));
*
* tester2.episodicMemory = testMem2; tester2.currentPath =
* testCurrent2;
*
* if(tester2.analyzeMove().getReturnValue()){
* System.out.println("SUCCESS!!!!"); }
*
* tester2.initTransTable();
*
* tester2.printTransTable();
*/
// ********************************************************
StateMachineEnvironment easy = new StateMachineEnvironment(2,2);
easy.transition[0][0] = 0;
easy.transition[0][1] = 1;
easy.transition[1][0] = 1;
easy.transition[1][1] = 1;
easy.findShortestPaths();
easy.printStateMachine();
smartAgent easyTest = new smartAgent(easy);
easyTest.run();
//------------------------------------------------------
/*
StateMachineEnvironment testEnv9000 = new StateMachineEnvironment(5, 3);
// testEnv9000.printStateMachine();
StateMachineEnvironment testEnvStatic = new StateMachineEnvironment(5,
3);
testEnvStatic.transition[0][0] = 0;
testEnvStatic.transition[0][1] = 2;
testEnvStatic.transition[0][2] = 0;
testEnvStatic.transition[1][0] = 1;
testEnvStatic.transition[1][1] = 0;
testEnvStatic.transition[1][2] = 1;
testEnvStatic.transition[2][0] = 4;
testEnvStatic.transition[2][1] = 2;
testEnvStatic.transition[2][2] = 2;
testEnvStatic.transition[3][0] = 3;
testEnvStatic.transition[3][1] = 4;
testEnvStatic.transition[3][2] = 3;
testEnvStatic.transition[4][0] = 2;
testEnvStatic.transition[4][1] = 4;
testEnvStatic.transition[4][2] = 4;
testEnvStatic.findShortestPaths();
testEnvStatic.printStateMachine();
smartAgent realTest = new smartAgent(testEnvStatic);
realTest.run();*/
}
}