#pragma once #include <pybind11/pybind11.h> #include <sc2api/sc2_api.h> #include "../src/IDABot.h" #include <iostream> #include <pybind11/stl.h> /* Automatic conversion from std::vector to Python lists */ #include <pybind11/operators.h> /* Convenient operator support */ // Lets us use "x"_a instead of py::arg("x"), great. using namespace pybind11::literals; // Wrapper class since the initialization uses pure argc/argv and these cannot be wrapped into Python correctly class Coordinator : public sc2::Coordinator { public: // TODO: We might not always want default value when we run on Linux Coordinator() : sc2::Coordinator() { char *argv[] = { "executable", NULL}; int argc = sizeof(argv) / sizeof(char*) - 1; LoadSettings(argc, argv); } }; class PyIDABot : public IDABot { public: using IDABot::IDABot; void OnGameStart() override { PYBIND11_OVERLOAD( void, IDABot, OnGameStart ); } void OnStep() override { PYBIND11_OVERLOAD( void, IDABot, OnStep ); } void OnStep_UpdateIDABot() override { PYBIND11_OVERLOAD( void, IDABot, OnStep_UpdateIDABot ); } }; // The functions below are all defined in different .cpp files, in order // to keep compilation snappy void define_typeenums(pybind11::module & m); void define_unit(pybind11::module & m); void define_unittype(pybind11::module &m); void define_util(pybind11::module &m); void define_point(pybind11::module &m); void define_base_location(pybind11::module & m); void define_tech_tree(pybind11::module & m); void define_map_tools(pybind11::module & m); void define_building_placer(pybind11::module & m);