diff options
Diffstat (limited to 'src/spacebot.cpp')
-rw-r--r-- | src/spacebot.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/spacebot.cpp b/src/spacebot.cpp index f2fb95a..b297eb3 100644 --- a/src/spacebot.cpp +++ b/src/spacebot.cpp @@ -1,12 +1,12 @@ #include "spacebot.h" #include <random> +#include <fstream> #include <string> -Spacebot::Spacebot(const std::string& outputPath) - : mapStream(outputPath+"/map.txt", std::ifstream::in) - , resultStream(outputPath+"/move.txt", std::ofstream::out) +Spacebot::Spacebot(std::string outputPath) + : outputPath(std::move(outputPath)), + gameState(std::ifstream(outputPath+"/map.txt", std::ifstream::in)) { - std::srand(time(0)); } void Spacebot::writeNextMove() @@ -27,6 +27,7 @@ Move Spacebot::chooseMove() void Spacebot::writeMove(const Move& move) { + std::ofstream resultStream(outputPath+"/move.txt"); switch (move) { case Move::NOTHING: |