From bd806c551d3819eda88d046f067b5ecd6f53a464 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 8 Nov 2017 15:11:12 -0500 Subject: Modernized bot structure This improves readability, and also will display a nicer error message for things such as the verbly datafile being invalid. --- main.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 main.cpp (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..8aa9677 --- /dev/null +++ b/main.cpp @@ -0,0 +1,31 @@ +#include "fefisms.h" + +int main(int argc, char** argv) +{ + std::random_device randomDevice; + std::mt19937 rng(randomDevice()); + + if (argc != 2) + { + std::cout << "usage: fefisms [configfile]" << std::endl; + return -1; + } + + std::string configfile(argv[1]); + + try + { + fefisms bot(configfile, rng); + + try + { + bot.run(); + } catch (const std::exception& ex) + { + std::cout << "Error running bot: " << ex.what() << std::endl; + } + } catch (const std::exception& ex) + { + std::cout << "Error initializing bot: " << ex.what() << std::endl; + } +} -- cgit 1.4.1