Skip to content
Snippets Groups Projects
Commit 1a226715 authored by Rojikku98's avatar Rojikku98
Browse files

Added score and reward to the lib

parent 1b8e573c
No related branches found
No related tags found
No related merge requests found
...@@ -85,7 +85,7 @@ PYBIND11_MODULE(library, m) ...@@ -85,7 +85,7 @@ PYBIND11_MODULE(library, m)
.def("on_step", &IDABot::OnStep) .def("on_step", &IDABot::OnStep)
.def("send_chat", &IDABot::SendChat, "Sends the string 'message' to the game chat", "message"_a) .def("send_chat", &IDABot::SendChat, "Sends the string 'message' to the game chat", "message"_a)
.def("get_all_units", &IDABot::GetAllUnits, "Returns a list of all visible units, including minerals and geysers") .def("get_all_units", &IDABot::GetAllUnits, "Returns a list of all visible units, including minerals and geysers")
.def("get_my_units", &IDABot::GetMyUnits, "Returns a list of all your units") .def("get_my_units", &IDABot::GetMyUnits, "Returns a list of all your units")
.def("get_player_race", &IDABot::GetPlayerRace, "Returns the players race, useful if you play Race.Random") .def("get_player_race", &IDABot::GetPlayerRace, "Returns the players race, useful if you play Race.Random")
.def("debug_create_unit", &IDABot::DebugCreateUnit, "This method creates the nr (INT) of units on the position :class:`library.Point2D`, the unit belongs to the Player Constant", "unit_type"_a, "p"_a, "player_id"_a = 0, "count"_a = 1) .def("debug_create_unit", &IDABot::DebugCreateUnit, "This method creates the nr (INT) of units on the position :class:`library.Point2D`, the unit belongs to the Player Constant", "unit_type"_a, "p"_a, "player_id"_a = 0, "count"_a = 1)
.def("debug_kill_unit", &IDABot::DebugKillUnit, "Kill the unit from debug mode") .def("debug_kill_unit", &IDABot::DebugKillUnit, "Kill the unit from debug mode")
...@@ -123,8 +123,10 @@ PYBIND11_MODULE(library, m) ...@@ -123,8 +123,10 @@ PYBIND11_MODULE(library, m)
.def_property_readonly("current_supply", &IDABot::GetCurrentSupply, "How much supply we are currently using") .def_property_readonly("current_supply", &IDABot::GetCurrentSupply, "How much supply we are currently using")
.def_property_readonly("max_supply", &IDABot::GetMaxSupply, "How much supply we can currently use") .def_property_readonly("max_supply", &IDABot::GetMaxSupply, "How much supply we can currently use")
.def_property_readonly("gas", &IDABot::GetGas, "How much gas we currently have") .def_property_readonly("gas", &IDABot::GetGas, "How much gas we currently have")
.def_property_readonly("current_frame", &IDABot::GetCurrentFrame, "Which frame we are currently on"); .def_property_readonly("current_frame", &IDABot::GetCurrentFrame, "Which frame we are currently on")
.def_property_readonly("score", &IDABot::GetScore, "The score")
.def_property_readonly("player_result", &IDABot::GetPlayerResults, "The resut for player")
;
......
#include "IDABot.h" #include "IDABot.h"
#include "Util.h" #include "Util.h"
#include "sc2api/sc2_score.h"
IDABot::IDABot() IDABot::IDABot()
...@@ -381,6 +382,21 @@ float IDABot::UpgradeResearchTime(sc2::UpgradeID upgrade_id) const ...@@ -381,6 +382,21 @@ float IDABot::UpgradeResearchTime(sc2::UpgradeID upgrade_id) const
} }
float IDABot::RadiusEffect(sc2::EffectID effect_id) const float IDABot::RadiusEffect(sc2::EffectID effect_id) const
{ {
return Observation()->GetEffectData()[effect_id].radius; return Observation()->GetEffectData()[effect_id].radius;
}
float IDABot::GetScore() const
{
return Observation()->GetScore().score;
}
const sc2::GameResult IDABot::GetPlayerResults() const {
for each (auto var in (Observation()->GetResults()))
{
if (var.player_id == Observation()->GetPlayerID()) return var.result;
}
std::cout << "The player can not be found" << std::endl;
return sc2::GameResult::Undecided;
} }
\ No newline at end of file
...@@ -93,6 +93,10 @@ public: ...@@ -93,6 +93,10 @@ public:
float UpgradeResearchTime(sc2::UpgradeID upgrade_id) const; float UpgradeResearchTime(sc2::UpgradeID upgrade_id) const;
float RadiusEffect(sc2::EffectID effect_id) const; float RadiusEffect(sc2::EffectID effect_id) const;
float GetScore() const;
const sc2::GameResult GetPlayerResults() const;
// Not needed, just convenience functions // Not needed, just convenience functions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment