#include "spacebot.h" #include "move_string_mapper.h" #include "brain/neural_network.h" #include Spacebot::Spacebot(std::string outputPath) : _outputFilename(outputPath+"/move.txt"), _networkConfigFilename("brain.nn"), _gameState(std::ifstream(outputPath+"/map.txt")) { } void Spacebot::writeNextMove() { Move move = chooseMove(); writeMove(move); } Move Spacebot::chooseMove() { auto sensorInputs = _gameState.toBitArray(); NeuralNetwork network(std::ifstream(_networkConfigFilename), sensorInputs.size(), static_cast(Move::BUILD_SHIELD)); for (int i=0; i(moveInt); } void Spacebot::writeMove(const Move& move) { std::ofstream resultStream(_outputFilename); resultStream << MoveStringMapper().toString(move) << std::endl; return; }