remove unnecessary Release folder files, clean up Mmilitary.cpp more
This commit is contained in:
parent
8a261dcb0f
commit
71f26b01ee
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,20 +0,0 @@
|
|||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\korabottest.pch
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\vc142.pdb
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\pch.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\utiltest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\squadtest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\scoutingtest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\queueentrytest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\playerassessmenttest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\miningtest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\militarytest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\macrotest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\cunittest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\checkitemtest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\cbasetest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\buildingplacementtest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\analysistest.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\gtest_main.obj
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\korabottest.tlog\cl.command.1.tlog
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\korabottest.tlog\cl.read.1.tlog
|
||||
d:\_programs\starcraft-old\bwapi-4_4\kora-bot\korabottest\release\korabottest.tlog\cl.write.1.tlog
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\Release\KoraBotTest.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
<SatelliteDlls />
|
||||
<NonRecipeFileRefs>
|
||||
<NonRecipeFileRef>
|
||||
<FullPath>D:\_programs\Starcraft-old\BWAPI-4_4\BWAPILIB\BWAPILIB.vcxproj</FullPath>
|
||||
</NonRecipeFileRef>
|
||||
<NonRecipeFileRef>
|
||||
<FullPath>D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\KoraBot.vcxproj</FullPath>
|
||||
</NonRecipeFileRef>
|
||||
</NonRecipeFileRefs>
|
||||
</Project>
|
|
@ -1,7 +0,0 @@
|
|||
Analysis.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
|
||||
Creating library D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\Release\KoraBotTest.lib and object D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\Release\KoraBotTest.exp
|
||||
BuildingPlacement.obj : error LNK2001: unresolved external symbol "public: static class BWEM::Map & __cdecl BWEM::Map::Instance(void)" (?Instance@Map@BWEM@@SAAAV12@XZ)
|
||||
MacroTest.obj : error LNK2001: unresolved external symbol "public: static class BWEM::Map & __cdecl BWEM::Map::Instance(void)" (?Instance@Map@BWEM@@SAAAV12@XZ)
|
||||
examples.obj : error LNK2001: unresolved external symbol "bool __cdecl BWEM::utils::seaSide(class BWAPI::Point<int,8>,class BWEM::Map const *)" (?seaSide@utils@BWEM@@YA_NV?$Point@H$07@BWAPI@@PBVMap@2@@Z)
|
||||
Util.obj : error LNK2001: unresolved external symbol "public: static class BWAPI::Point<int,32> __cdecl Util::getAreaAverage(class BWEM::Area const *)" (?getAreaAverage@Util@@SA?AV?$Point@H$0CA@@BWAPI@@PBVArea@BWEM@@@Z)
|
||||
D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\Release\KoraBotTest.exe : fatal error LNK1120: 3 unresolved externals
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,2 +0,0 @@
|
|||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=8.1:
|
||||
Release|Win32|D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\|
|
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -271,7 +271,7 @@ void CBase::setDefenseLocation()
|
|||
bool foundNeighbor = neighbor.second;
|
||||
if (foundNeighbor)
|
||||
{
|
||||
TilePosition average = Military::getChokepointCenter(area, neighborArea);
|
||||
TilePosition average = CMap::getChokepointCenter(area, neighborArea);
|
||||
|
||||
// this caused an out-of-range exception in scouting.cpp:
|
||||
// std::vector<double> direction = BuildingPlacement::getDirection(Macro::players.at(Macro::selfID).bases.at(1).tilePosition);
|
||||
|
|
|
@ -17,6 +17,20 @@ TilePosition CMap::getAreaAverage(const BWEM::Area area)
|
|||
return TilePosition(xAverage, yAverage);
|
||||
}
|
||||
|
||||
TilePosition CMap::getChokepointCenter(const BWEM::Area* area, const BWEM::Area* neighborArea)
|
||||
{
|
||||
TilePosition average = TilePosition(0, 0);
|
||||
for (auto a : area->ChokePointsByArea())
|
||||
{
|
||||
if (a.first->Id() == neighborArea->Id())
|
||||
{
|
||||
average = TilePosition(a.second->front().Center());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return average;
|
||||
}
|
||||
|
||||
// gets a walking path from one Area to another
|
||||
// this is just the a* pathfinding algorithm
|
||||
std::vector<const BWEM::Area*> CMap::getPath(const BWEM::Area* a1, const BWEM::Area* a2)
|
||||
|
|
|
@ -15,6 +15,7 @@ class CMap
|
|||
public:
|
||||
static TilePosition getAreaAverage(const BWEM::Area* area);
|
||||
static TilePosition getAreaAverage(const BWEM::Area area);
|
||||
static TilePosition getChokepointCenter(const BWEM::Area* area, const BWEM::Area* neighborArea);
|
||||
static std::vector<const BWEM::Area*> getPath(const BWEM::Area* a1, const BWEM::Area* a2);
|
||||
static std::vector<const BWEM::Area*> reconstructPath(std::map<const BWEM::Area*, const BWEM::Area*> cameFrom, const BWEM::Area* current);
|
||||
};
|
|
@ -18,7 +18,54 @@ void Military::addSquadlessUnits(int squadIndex)
|
|||
}
|
||||
}
|
||||
|
||||
//TODO clean this up
|
||||
// attacks the enemy with everything except one squad for defense
|
||||
void Military::attackMaxed()
|
||||
{
|
||||
int squadIndex = getAttackSquadsIndex();
|
||||
|
||||
addSquadlessUnits(squadIndex);
|
||||
|
||||
Position attackLocation = Position(getAttackLocation().first);
|
||||
for (size_t i = 0; i < Macro::squads.size(); i++)
|
||||
{
|
||||
if (Macro::squads.at(i).action == "attack")
|
||||
{
|
||||
for (auto u : Macro::squads.at(i).units)
|
||||
{
|
||||
u.unit->attack(attackLocation);
|
||||
if (u.unit->getType() == UnitTypes::Zerg_Overlord)
|
||||
{
|
||||
u.unit->move(attackLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// attacks the enemy with one squad
|
||||
void Military::attackNonMaxed()
|
||||
{
|
||||
// things to consider:
|
||||
// how strong the most vulnerable enemy base is
|
||||
// how strong the attack squads are
|
||||
std::pair<TilePosition, int> baseToAttack = getAttackLocation();
|
||||
int damagePadding = 120;
|
||||
int squadIndex = getIdleSquad();
|
||||
|
||||
// find which squad to send to attack
|
||||
if (squadIndex > -1)
|
||||
{
|
||||
addSquadlessUnits(squadIndex);
|
||||
Macro::squads.at(squadIndex).updateDamage();
|
||||
|
||||
if (Macro::squads.at(squadIndex).groundDamage > baseToAttack.second + damagePadding)
|
||||
{
|
||||
Macro::squads.at(squadIndex).attack(baseToAttack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// determine whether to attack
|
||||
void Military::checkAttack()
|
||||
{
|
||||
// things to consider:
|
||||
|
@ -27,70 +74,9 @@ void Military::checkAttack()
|
|||
// if the enemy is at a disadvantage (do some damage and/or go for the win)
|
||||
|
||||
if (Broodwar->self()->supplyUsed() > 380)
|
||||
{
|
||||
// get every squad except one for defense and go attack somewhere
|
||||
int skippedSquads = 0;
|
||||
int squadIndex = -1;
|
||||
|
||||
for (size_t i = 0; i < Macro::squads.size(); i++)
|
||||
{
|
||||
if (Macro::squads.at(i).action == "defend" && skippedSquads == 0)
|
||||
{
|
||||
skippedSquads++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Macro::squads.at(i).action = "attack";
|
||||
squadIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (squadIndex == -1)
|
||||
{
|
||||
Macro::squads.push_back(Squad());
|
||||
squadIndex = Macro::squads.size() - 1;
|
||||
}
|
||||
|
||||
addSquadlessUnits(squadIndex);
|
||||
|
||||
Position attackLocation = Position(getAttackLocation().first);
|
||||
for (size_t i = 0; i < Macro::squads.size(); i++)
|
||||
{
|
||||
if (Macro::squads.at(i).action == "attack")
|
||||
{
|
||||
for (auto u : Macro::squads.at(i).units)
|
||||
{
|
||||
u.unit->attack(attackLocation);
|
||||
if (u.unit->getType() == UnitTypes::Zerg_Overlord)
|
||||
{
|
||||
u.unit->move(attackLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(shouldAttackNonMaxed())
|
||||
{
|
||||
// things to consider:
|
||||
// how strong the most vulnerable enemy base is
|
||||
// how strong the attack squads are
|
||||
std::pair<TilePosition, int> baseToAttack = getAttackLocation();
|
||||
int damagePadding = 120;
|
||||
|
||||
int squadIndex = getIdleSquad();
|
||||
|
||||
// find which squad to send to attack
|
||||
if (squadIndex > -1)
|
||||
{
|
||||
addSquadlessUnits(squadIndex);
|
||||
Macro::squads.at(squadIndex).updateDamage();
|
||||
|
||||
if (Macro::squads.at(squadIndex).groundDamage > baseToAttack.second + damagePadding)
|
||||
{
|
||||
Macro::squads.at(squadIndex).attack(baseToAttack);
|
||||
}
|
||||
}
|
||||
}
|
||||
attackMaxed();
|
||||
else if (shouldAttackNonMaxed())
|
||||
attackNonMaxed();
|
||||
}
|
||||
|
||||
// determine where is being attacked and send units to defend
|
||||
|
@ -244,6 +230,32 @@ std::pair<TilePosition, int> Military::getAttackLocation()
|
|||
return returnPair;
|
||||
}
|
||||
|
||||
int Military::getAttackSquadsIndex()
|
||||
{
|
||||
int skippedSquads = 0;
|
||||
int squadIndex = -1;
|
||||
for (size_t i = 0; i < Macro::squads.size(); i++)
|
||||
{
|
||||
if (Macro::squads.at(i).action == "defend" && skippedSquads == 0)
|
||||
{
|
||||
skippedSquads++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Macro::squads.at(i).action = "attack";
|
||||
squadIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (squadIndex == -1)
|
||||
{
|
||||
Macro::squads.push_back(Squad());
|
||||
squadIndex = Macro::squads.size() - 1;
|
||||
}
|
||||
|
||||
return squadIndex;
|
||||
}
|
||||
|
||||
double Military::getBaseDefense(CBase base, std::string type, int playerID)
|
||||
{
|
||||
double score = 0;
|
||||
|
@ -273,20 +285,6 @@ double Military::getBaseDefense(CBase base, std::string type, int playerID)
|
|||
}
|
||||
}
|
||||
|
||||
TilePosition Military::getChokepointCenter(const BWEM::Area* area, const BWEM::Area* neighborArea)
|
||||
{
|
||||
TilePosition average = TilePosition(0, 0);
|
||||
for (auto a : area->ChokePointsByArea())
|
||||
{
|
||||
if (a.first->Id() == neighborArea->Id())
|
||||
{
|
||||
average = TilePosition(a.second->front().Center());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return average;
|
||||
}
|
||||
|
||||
int Military::getClosestSquad(TilePosition tp)
|
||||
{
|
||||
int index = -1;
|
||||
|
|
|
@ -10,14 +10,16 @@ using namespace BWAPI;
|
|||
class Military
|
||||
{
|
||||
public:
|
||||
static void attackMaxed();
|
||||
static void attackNonMaxed();
|
||||
static void addSquadlessUnits(int squadIndex);
|
||||
static void checkAttack();
|
||||
static void checkDefense();
|
||||
static double checkEnemiesAt(CBase base);
|
||||
static void checkSquads();
|
||||
static std::pair<TilePosition, int> getAttackLocation();
|
||||
static int getAttackSquadsIndex();
|
||||
static double getBaseDefense(CBase b, std::string type, int playerID);
|
||||
static TilePosition getChokepointCenter(const BWEM::Area* area, const BWEM::Area* neighborArea);
|
||||
static int getClosestSquad(TilePosition tp);
|
||||
static int getIdleSquad();
|
||||
static std::pair<int, int> getMostVulnerableBase(int playerID);
|
||||
|
|
Loading…
Reference in a new issue