summary refs log tree commit diff stats
path: root/main.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-11-08 15:11:12 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-11-08 15:11:12 -0500
commitbd806c551d3819eda88d046f067b5ecd6f53a464 (patch)
tree4f2d6fecec2cd148bca2475e7907a59fd115b6f3 /main.cpp
parent7802b1e8cce56989c2588f2c852aab7a3620203a (diff)
downloadfefisms-bd806c551d3819eda88d046f067b5ecd6f53a464.tar.gz
fefisms-bd806c551d3819eda88d046f067b5ecd6f53a464.tar.bz2
fefisms-bd806c551d3819eda88d046f067b5ecd6f53a464.zip
Modernized bot structure
This improves readability, and also will display a nicer error message
for things such as the verbly datafile being invalid.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..8aa9677 --- /dev/null +++ b/main.cpp
@@ -0,0 +1,31 @@
1#include "fefisms.h"
2
3int main(int argc, char** argv)
4{
5 std::random_device randomDevice;
6 std::mt19937 rng(randomDevice());
7
8 if (argc != 2)
9 {
10 std::cout << "usage: fefisms [configfile]" << std::endl;
11 return -1;
12 }
13
14 std::string configfile(argv[1]);
15
16 try
17 {
18 fefisms bot(configfile, rng);
19
20 try
21 {
22 bot.run();
23 } catch (const std::exception& ex)
24 {
25 std::cout << "Error running bot: " << ex.what() << std::endl;
26 }
27 } catch (const std::exception& ex)
28 {
29 std::cout << "Error initializing bot: " << ex.what() << std::endl;
30 }
31}