summaryrefslogtreecommitdiff
path: root/src/nerdhack.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2024-03-28 16:18:36 -0400
committerYour Name <you@example.com>2024-03-28 16:18:36 -0400
commitc644379e79262a7478a7fb9ea8001f315fdb6eaf (patch)
treed71b15e396ebca28b76f0b5fd1971dd352877e4e /src/nerdhack.cc
downloadnerdhack-c644379e79262a7478a7fb9ea8001f315fdb6eaf.tar.gz
nerdhack-c644379e79262a7478a7fb9ea8001f315fdb6eaf.tar.bz2
nerdhack-c644379e79262a7478a7fb9ea8001f315fdb6eaf.zip
Initial commitHEADmaster
Diffstat (limited to 'src/nerdhack.cc')
-rw-r--r--src/nerdhack.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nerdhack.cc b/src/nerdhack.cc
new file mode 100644
index 0000000..1363096
--- /dev/null
+++ b/src/nerdhack.cc
@@ -0,0 +1,20 @@
+#include <iostream>
+#include <fstream>
+#include "ui.h"
+#include "vm.h"
+
+int main(int argc, char* argv[]) {
+ if (argc != 2) {
+ std::cerr << "Requires path to config as an argument\n";
+ return 1;
+ }
+ vm::clearAllVMs();
+ auto vm = vm::VM();
+ auto ui = ui::UI();
+ // Read config
+ std::ifstream ifs(argv[1]);
+ std::string config((std::istreambuf_iterator<char>(ifs)),(std::istreambuf_iterator<char>()));
+ vm.start(config);
+ ui.registerCallbacks(vm);
+ return 0;
+}