diff --git a/KoraBotTest/Release/AnalysisTest.obj b/KoraBotTest/Release/AnalysisTest.obj
deleted file mode 100644
index 936f3c7..0000000
Binary files a/KoraBotTest/Release/AnalysisTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/BuildingPlacementTest.obj b/KoraBotTest/Release/BuildingPlacementTest.obj
deleted file mode 100644
index 9b7ebb2..0000000
Binary files a/KoraBotTest/Release/BuildingPlacementTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/CBaseTest.obj b/KoraBotTest/Release/CBaseTest.obj
deleted file mode 100644
index d05b12a..0000000
Binary files a/KoraBotTest/Release/CBaseTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/CUnitTest.obj b/KoraBotTest/Release/CUnitTest.obj
deleted file mode 100644
index ccf00bf..0000000
Binary files a/KoraBotTest/Release/CUnitTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/CheckItemTest.obj b/KoraBotTest/Release/CheckItemTest.obj
deleted file mode 100644
index a5c5105..0000000
Binary files a/KoraBotTest/Release/CheckItemTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/KoraBotTest.Build.CppClean.log b/KoraBotTest/Release/KoraBotTest.Build.CppClean.log
deleted file mode 100644
index 83d077e..0000000
--- a/KoraBotTest/Release/KoraBotTest.Build.CppClean.log
+++ /dev/null
@@ -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
diff --git a/KoraBotTest/Release/KoraBotTest.exe.recipe b/KoraBotTest/Release/KoraBotTest.exe.recipe
deleted file mode 100644
index 5f3667b..0000000
--- a/KoraBotTest/Release/KoraBotTest.exe.recipe
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\Release\KoraBotTest.exe
-
-
-
-
-
-
- D:\_programs\Starcraft-old\BWAPI-4_4\BWAPILIB\BWAPILIB.vcxproj
-
-
- D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\KoraBot.vcxproj
-
-
-
\ No newline at end of file
diff --git a/KoraBotTest/Release/KoraBotTest.log b/KoraBotTest/Release/KoraBotTest.log
deleted file mode 100644
index 6da6d0f..0000000
--- a/KoraBotTest/Release/KoraBotTest.log
+++ /dev/null
@@ -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,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 __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
diff --git a/KoraBotTest/Release/KoraBotTest.pch b/KoraBotTest/Release/KoraBotTest.pch
deleted file mode 100644
index a4039a1..0000000
Binary files a/KoraBotTest/Release/KoraBotTest.pch and /dev/null differ
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/CL.command.1.tlog b/KoraBotTest/Release/KoraBotTest.tlog/CL.command.1.tlog
deleted file mode 100644
index 962e4db..0000000
Binary files a/KoraBotTest/Release/KoraBotTest.tlog/CL.command.1.tlog and /dev/null differ
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/CL.read.1.tlog b/KoraBotTest/Release/KoraBotTest.tlog/CL.read.1.tlog
deleted file mode 100644
index e4f5b49..0000000
Binary files a/KoraBotTest/Release/KoraBotTest.tlog/CL.read.1.tlog and /dev/null differ
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/CL.write.1.tlog b/KoraBotTest/Release/KoraBotTest.tlog/CL.write.1.tlog
deleted file mode 100644
index 14e8473..0000000
Binary files a/KoraBotTest/Release/KoraBotTest.tlog/CL.write.1.tlog and /dev/null differ
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/KoraBotTest.lastbuildstate b/KoraBotTest/Release/KoraBotTest.tlog/KoraBotTest.lastbuildstate
deleted file mode 100644
index 3660ff2..0000000
--- a/KoraBotTest/Release/KoraBotTest.tlog/KoraBotTest.lastbuildstate
+++ /dev/null
@@ -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\|
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/KoraBotTest.write.1u.tlog b/KoraBotTest/Release/KoraBotTest.tlog/KoraBotTest.write.1u.tlog
deleted file mode 100644
index 641d922..0000000
Binary files a/KoraBotTest/Release/KoraBotTest.tlog/KoraBotTest.write.1u.tlog and /dev/null differ
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/link.18488.read.1.tlog b/KoraBotTest/Release/KoraBotTest.tlog/link.18488.read.1.tlog
deleted file mode 100644
index 46b134b..0000000
--- a/KoraBotTest/Release/KoraBotTest.tlog/link.18488.read.1.tlog
+++ /dev/null
@@ -1 +0,0 @@
-ÿþ
\ No newline at end of file
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/link.18488.write.1.tlog b/KoraBotTest/Release/KoraBotTest.tlog/link.18488.write.1.tlog
deleted file mode 100644
index 46b134b..0000000
--- a/KoraBotTest/Release/KoraBotTest.tlog/link.18488.write.1.tlog
+++ /dev/null
@@ -1 +0,0 @@
-ÿþ
\ No newline at end of file
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/link.command.1.tlog b/KoraBotTest/Release/KoraBotTest.tlog/link.command.1.tlog
deleted file mode 100644
index 46b134b..0000000
--- a/KoraBotTest/Release/KoraBotTest.tlog/link.command.1.tlog
+++ /dev/null
@@ -1 +0,0 @@
-ÿþ
\ No newline at end of file
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/link.read.1.tlog b/KoraBotTest/Release/KoraBotTest.tlog/link.read.1.tlog
deleted file mode 100644
index 46b134b..0000000
--- a/KoraBotTest/Release/KoraBotTest.tlog/link.read.1.tlog
+++ /dev/null
@@ -1 +0,0 @@
-ÿþ
\ No newline at end of file
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/link.write.1.tlog b/KoraBotTest/Release/KoraBotTest.tlog/link.write.1.tlog
deleted file mode 100644
index 46b134b..0000000
--- a/KoraBotTest/Release/KoraBotTest.tlog/link.write.1.tlog
+++ /dev/null
@@ -1 +0,0 @@
-ÿþ
\ No newline at end of file
diff --git a/KoraBotTest/Release/KoraBotTest.tlog/unsuccessfulbuild b/KoraBotTest/Release/KoraBotTest.tlog/unsuccessfulbuild
deleted file mode 100644
index e69de29..0000000
diff --git a/KoraBotTest/Release/KoraBotTest.vcxproj.FileListAbsolute.txt b/KoraBotTest/Release/KoraBotTest.vcxproj.FileListAbsolute.txt
deleted file mode 100644
index e69de29..0000000
diff --git a/KoraBotTest/Release/MacroTest.obj b/KoraBotTest/Release/MacroTest.obj
deleted file mode 100644
index d58a3e1..0000000
Binary files a/KoraBotTest/Release/MacroTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/MilitaryTest.obj b/KoraBotTest/Release/MilitaryTest.obj
deleted file mode 100644
index 294a40a..0000000
Binary files a/KoraBotTest/Release/MilitaryTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/MiningTest.obj b/KoraBotTest/Release/MiningTest.obj
deleted file mode 100644
index 4770117..0000000
Binary files a/KoraBotTest/Release/MiningTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/PlayerAssessmentTest.obj b/KoraBotTest/Release/PlayerAssessmentTest.obj
deleted file mode 100644
index e378448..0000000
Binary files a/KoraBotTest/Release/PlayerAssessmentTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/QueueEntryTest.obj b/KoraBotTest/Release/QueueEntryTest.obj
deleted file mode 100644
index ab6dad5..0000000
Binary files a/KoraBotTest/Release/QueueEntryTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/ScoutingTest.obj b/KoraBotTest/Release/ScoutingTest.obj
deleted file mode 100644
index 766307a..0000000
Binary files a/KoraBotTest/Release/ScoutingTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/SquadTest.obj b/KoraBotTest/Release/SquadTest.obj
deleted file mode 100644
index e2e1420..0000000
Binary files a/KoraBotTest/Release/SquadTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/UtilTest.obj b/KoraBotTest/Release/UtilTest.obj
deleted file mode 100644
index c621ea3..0000000
Binary files a/KoraBotTest/Release/UtilTest.obj and /dev/null differ
diff --git a/KoraBotTest/Release/gmock-all.obj b/KoraBotTest/Release/gmock-all.obj
deleted file mode 100644
index 0adf77b..0000000
Binary files a/KoraBotTest/Release/gmock-all.obj and /dev/null differ
diff --git a/KoraBotTest/Release/gtest-all.obj b/KoraBotTest/Release/gtest-all.obj
deleted file mode 100644
index 5d5b528..0000000
Binary files a/KoraBotTest/Release/gtest-all.obj and /dev/null differ
diff --git a/KoraBotTest/Release/gtest_main.obj b/KoraBotTest/Release/gtest_main.obj
deleted file mode 100644
index 0db9911..0000000
Binary files a/KoraBotTest/Release/gtest_main.obj and /dev/null differ
diff --git a/KoraBotTest/Release/pch.obj b/KoraBotTest/Release/pch.obj
deleted file mode 100644
index 27d9232..0000000
Binary files a/KoraBotTest/Release/pch.obj and /dev/null differ
diff --git a/KoraBotTest/Release/vc142.pdb b/KoraBotTest/Release/vc142.pdb
deleted file mode 100644
index b0f8002..0000000
Binary files a/KoraBotTest/Release/vc142.pdb and /dev/null differ
diff --git a/Source/CBase.cpp b/Source/CBase.cpp
index 32f246e..256c2de 100644
--- a/Source/CBase.cpp
+++ b/Source/CBase.cpp
@@ -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 direction = BuildingPlacement::getDirection(Macro::players.at(Macro::selfID).bases.at(1).tilePosition);
diff --git a/Source/CMap.cpp b/Source/CMap.cpp
index be85a77..5faf5be 100644
--- a/Source/CMap.cpp
+++ b/Source/CMap.cpp
@@ -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 CMap::getPath(const BWEM::Area* a1, const BWEM::Area* a2)
diff --git a/Source/CMap.h b/Source/CMap.h
index 7f59ae4..dd83aea 100644
--- a/Source/CMap.h
+++ b/Source/CMap.h
@@ -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 getPath(const BWEM::Area* a1, const BWEM::Area* a2);
static std::vector reconstructPath(std::map cameFrom, const BWEM::Area* current);
};
\ No newline at end of file
diff --git a/Source/Military.cpp b/Source/Military.cpp
index f225f19..dbeda34 100644
--- a/Source/Military.cpp
+++ b/Source/Military.cpp
@@ -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 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 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 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;
diff --git a/Source/Military.h b/Source/Military.h
index 728f063..28b105e 100644
--- a/Source/Military.h
+++ b/Source/Military.h
@@ -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 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 getMostVulnerableBase(int playerID);