#include "gamestate.hpp" #include #include #include #include void Help(void) { std::cout << "Usage: snakeplusplus [OPTIONS]" << std::endl; std::cout << "Options:" << std::endl; std::cout << "\t--server\tRun snake in server mode (also sets --bot)" << std::endl; std::cout << "\t--auto\t\tControl snake using a bot or AI" << std::endl; std::cout << "\t-h, --help\tPrint this help message and exit" << std::endl; std::cout << std::endl; std::cout << "Autoplay options (requires --auto):" << std::endl; std::cout << "\t--dumb\t\tPlays using basic search algorithms BFS and DFS" << std::endl; std::cout << "\t--smart\t\tTrains an algorithm using unsupervised learning" << std::endl; std::cout << std::endl; } int main(int argc, char* argv[]) { std::vector args(argv, argv + argc); g_pEngine = std::make_unique(); for (int i = 1; i < args.size(); ++i) { if (args[i].compare("--server") == 0) { g_pEngine->state.m_bNoDisplay = true; g_pEngine->state.m_bIsBotControlled = true; std::cout << "[LOG - Main] Disabling display" << std::endl; } else if (args[i].compare("--auto") == 0) { g_pEngine->state.m_bIsBotControlled = true; std::cout << "[LOG - Main] Bot control enabled" << std::endl; } else if (args[i].compare("-h") == 0 || args[i].compare("--help") == 0) { Help(); return 0; } else { std::cout << "[LOG - Main] Argument `" << args[i] << "` unrecognized, printing help and exiting..."<< std::endl; Help(); return 1; } } g_pEngine->Start(); return 0; }