-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
32 lines (27 loc) · 979 Bytes
/
index.php
File metadata and controls
32 lines (27 loc) · 979 Bytes
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
<?php
if (getenv('ENABLE_C4L_AUTOLOAD')) {
// add some autoloading so that we can use the AI together with the brutaltester
require_once 'helper/debug.php';
require_once('helper/AutoLoader.php');
$autoLoader = new AutoLoader();
$autoLoader->registerDir(__DIR__);
$autoLoader->registerDir(__DIR__ . '/actions/');
$autoLoader->registerDir(__DIR__ . '/entities/');
$autoLoader->registerDir(__DIR__ . '/helper/');
$autoLoader->registerDir(__DIR__ . '/modules/');
}
$inputReader = new InputReader();
$initialConfig = $inputReader->readInitialConfig();
$entityFactory = new StateFactory();
$actionHandler = new ActionHandler();
try {
while (true) {
$config = $inputReader->readTurnConfig();
$state = $entityFactory->convertConfig($initialConfig, $config);
$action = $actionHandler->getAction($state);
$action->execute();
}
} catch (\Exception $e) {
debug('Error:');
debug($e->getMessage());
}