-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path10_modularRobot.js
46 lines (43 loc) · 1.11 KB
/
10_modularRobot.js
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
const roads = [
"Alice's House-Bob's House",
"Alice's House-Cabin",
"Alice's House-Post Office",
"Bob's House-Town Hall",
"Daria's House-Ernie's House",
"Daria's House-Town Hall",
"Ernie's House-Grete's House",
"Grete's House-Farm",
"Grete's House-Shop",
'Marketplace-Farm',
'Marketplace-Post Office',
'Marketplace-Shop',
'Marketplace-Town Hall',
'Shop-Town Hall'
];
const mailRoute = [
"Alice's House",
'Cabin',
"Alice's House",
"Bob's House",
'Town Hall',
"Daria's House",
"Ernie's House",
"Grete's House",
'Shop',
"Grete's House",
'Farm',
'Marketplace',
'Post Office'
];
const buildGraph = require('./buildGraph');
const roadGraph = buildGraph(roads);
const VillageState = require('./10_VillageState')(roadGraph);
const runRobot = require('./runRobot');
const { randomRobot, routeRobot, goalOrientedRobot, improvedRobot, lazyRobot, myLazyRobot } = require('./robotTypes.js')({
roadGraph,
mailRoute
});
const initialState = VillageState.random();
runRobot(initialState, randomRobot);
runRobot(initialState, routeRobot, []);
runRobot(initialState, goalOrientedRobot, []);