summaryrefslogtreecommitdiff
path: root/src/nerdhack.cc
blob: 13630968fc43818cf6be3234ef17d94f03c0e73e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}