diff options
author | Justin Worthe <justin.worthe@gmail.com> | 2015-06-03 07:50:05 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@gmail.com> | 2015-06-03 07:50:05 +0200 |
commit | 618501b6fae62fa2d5db922ec8abf94120e5e99c (patch) | |
tree | 26cd18ceef12003d4d7b84b40bf9b77f7465093c /src/spacebot.cpp | |
parent | 4f75af9646b03ce4101820c10152944c780e7c0a (diff) |
Added gamestate object
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 24a5d1e..716f7cb 100644 --- a/src/spacebot.cpp +++ b/src/spacebot.cpp @@ -1,11 +1,11 @@ #include "spacebot.h" #include <random> +#include <fstream> -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() @@ -26,6 +26,7 @@ Move Spacebot::chooseMove() void Spacebot::writeMove(const Move& move) { + std::ofstream resultStream(outputPath+"/move.txt"); switch (move) { case Move::NOTHING: |