diff options
author | Justin Worthe <justin.worthe@gmail.com> | 2015-10-17 17:02:24 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@gmail.com> | 2015-10-17 17:02:24 +0200 |
commit | 550caeee11086bd56db69176b3149ddfa160ee30 (patch) | |
tree | c935b819a4ad165fbef567db67ad9ddcca62df04 /src/spacebot.cpp | |
parent | 31a82b0359515ae579514024b22873fb708c3f53 (diff) |
Reverted to a simple decision tree
Turns out it's much easier to write a bot by hand with if statements.
Diffstat (limited to 'src/spacebot.cpp')
-rw-r--r-- | src/spacebot.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/spacebot.cpp b/src/spacebot.cpp index 15f2221..17d20b5 100644 --- a/src/spacebot.cpp +++ b/src/spacebot.cpp @@ -20,12 +20,23 @@ void Spacebot::writeNextMove() Move Spacebot::chooseMove() { auto sensorInputs = _gameState.toBitArray(); - - NeuralNetwork network(std::ifstream(_brainFilename), - sensorInputs, - 7); - return static_cast<Move>(network.findMaxOutputIndex()); + if (!sensorInputs.at(51) || !sensorInputs.at(53)) + { + return Move::BUILD_SHIELD; + } + else if (sensorInputs.at(55)) + { + return Move::SHOOT; + } + else if (sensorInputs.at(60) && !sensorInputs.at(59)) + { + return Move::BUILD_MISSILE_CONTROLLER; + } + else + { + return Move::NOTHING; + } } void Spacebot::writeMove(const Move& move) |