initial commit
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/Debug
|
||||
/KoraBotTests
|
||||
/Release
|
||||
/.vs
|
57
KoraBot.sln
Normal file
|
@ -0,0 +1,57 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30503.244
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KoraBot", "KoraBot.vcxproj", "{2E63AE74-758A-4607-9DE4-D28E814A6E13}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BWAPILIB", "..\BWAPILIB\BWAPILIB.vcxproj", "{843656FD-9BFD-47BF-8460-7BFE9710EA2C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KoraBotTests", "KoraBotTests\KoraBotTests.vcxproj", "{472D636A-6F55-49D1-856F-92C527D58ECC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KoraBotTest", "KoraBotTest\KoraBotTest.vcxproj", "{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2E63AE74-758A-4607-9DE4-D28E814A6E13}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{2E63AE74-758A-4607-9DE4-D28E814A6E13}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{2E63AE74-758A-4607-9DE4-D28E814A6E13}.Debug|x86.Build.0 = Debug|Win32
|
||||
{2E63AE74-758A-4607-9DE4-D28E814A6E13}.Release|x64.ActiveCfg = Release|Win32
|
||||
{2E63AE74-758A-4607-9DE4-D28E814A6E13}.Release|x86.ActiveCfg = Release|Win32
|
||||
{2E63AE74-758A-4607-9DE4-D28E814A6E13}.Release|x86.Build.0 = Release|Win32
|
||||
{843656FD-9BFD-47BF-8460-7BFE9710EA2C}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{843656FD-9BFD-47BF-8460-7BFE9710EA2C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{843656FD-9BFD-47BF-8460-7BFE9710EA2C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{843656FD-9BFD-47BF-8460-7BFE9710EA2C}.Release|x64.ActiveCfg = Release|Win32
|
||||
{843656FD-9BFD-47BF-8460-7BFE9710EA2C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{843656FD-9BFD-47BF-8460-7BFE9710EA2C}.Release|x86.Build.0 = Release|Win32
|
||||
{472D636A-6F55-49D1-856F-92C527D58ECC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{472D636A-6F55-49D1-856F-92C527D58ECC}.Debug|x64.Build.0 = Debug|x64
|
||||
{472D636A-6F55-49D1-856F-92C527D58ECC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{472D636A-6F55-49D1-856F-92C527D58ECC}.Debug|x86.Build.0 = Debug|Win32
|
||||
{472D636A-6F55-49D1-856F-92C527D58ECC}.Release|x64.ActiveCfg = Release|x64
|
||||
{472D636A-6F55-49D1-856F-92C527D58ECC}.Release|x64.Build.0 = Release|x64
|
||||
{472D636A-6F55-49D1-856F-92C527D58ECC}.Release|x86.ActiveCfg = Release|Win32
|
||||
{472D636A-6F55-49D1-856F-92C527D58ECC}.Release|x86.Build.0 = Release|Win32
|
||||
{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}.Debug|x64.Build.0 = Debug|x64
|
||||
{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}.Release|x64.ActiveCfg = Release|x64
|
||||
{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}.Release|x64.Build.0 = Release|x64
|
||||
{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E2B33FB7-A23E-4C7A-9A9D-02CCD70CFC56}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {71D7DBBD-1E53-43D6-B962-298144D4435C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
180
KoraBot.vcxproj
Normal file
|
@ -0,0 +1,180 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2E63AE74-758A-4607-9DE4-D28E814A6E13}</ProjectGuid>
|
||||
<RootNamespace>KoraBot</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(PlatformToolset)'=='v141_xp'">
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NOMINMAX;WIN32;_WIN32_WINNT=0x0501;NTDDI_VERSION=0x05010300;_DEBUG;_WINDOWS;_USRDLL;KORABOT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<PreLinkEvent />
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NOMINMAX;WIN32;_WIN32_WINNT=0x0501;NTDDI_VERSION=0x05010300;NDEBUG;_WINDOWS;_USRDLL;KORABOT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<PreLinkEvent />
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source\Analysis.cpp" />
|
||||
<ClCompile Include="Source\BuildingPlacement.cpp" />
|
||||
<ClCompile Include="Source\BWEM\EasyBMP_1.06\EasyBMP.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\area.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\base.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\bwapiExt.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\bwem.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\cp.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\examples.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\exampleWall.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\graph.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\gridMap.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\map.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\mapDrawer.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\mapImpl.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\mapPrinter.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\neutral.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\tiles.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\utils.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\winutils.cpp" />
|
||||
<ClCompile Include="Source\CBase.cpp" />
|
||||
<ClCompile Include="Source\CheckItem.cpp" />
|
||||
<ClCompile Include="Source\CPlayer.cpp" />
|
||||
<ClCompile Include="Source\CUnit.cpp" />
|
||||
<ClCompile Include="Source\Dll.cpp" />
|
||||
<ClCompile Include="Source\KoraBot.cpp" />
|
||||
<ClCompile Include="Source\Location.cpp" />
|
||||
<ClCompile Include="Source\Macro.cpp" />
|
||||
<ClCompile Include="Source\CMap.cpp" />
|
||||
<ClCompile Include="Source\Military.cpp" />
|
||||
<ClCompile Include="Source\Mining.cpp" />
|
||||
<ClCompile Include="Source\PlayerAssessment.cpp" />
|
||||
<ClCompile Include="Source\QueueEntry.cpp" />
|
||||
<ClCompile Include="Source\Scouting.cpp" />
|
||||
<ClCompile Include="Source\Squad.cpp" />
|
||||
<ClCompile Include="Source\Util.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Source\Analysis.h" />
|
||||
<ClInclude Include="Source\BuildingPlacement.h" />
|
||||
<ClInclude Include="Source\BWEM\EasyBMP_1.06\EasyBMP.h" />
|
||||
<ClInclude Include="Source\BWEM\src\area.h" />
|
||||
<ClInclude Include="Source\BWEM\src\base.h" />
|
||||
<ClInclude Include="Source\BWEM\src\bwapiExt.h" />
|
||||
<ClInclude Include="Source\BWEM\src\bwem.h" />
|
||||
<ClInclude Include="Source\BWEM\src\cp.h" />
|
||||
<ClInclude Include="Source\BWEM\src\defs.h" />
|
||||
<ClInclude Include="Source\BWEM\src\examples.h" />
|
||||
<ClInclude Include="Source\BWEM\src\exampleWall.h" />
|
||||
<ClInclude Include="Source\BWEM\src\graph.h" />
|
||||
<ClInclude Include="Source\BWEM\src\gridMap.h" />
|
||||
<ClInclude Include="Source\BWEM\src\map.h" />
|
||||
<ClInclude Include="Source\BWEM\src\mapDrawer.h" />
|
||||
<ClInclude Include="Source\BWEM\src\mapImpl.h" />
|
||||
<ClInclude Include="Source\BWEM\src\mapPrinter.h" />
|
||||
<ClInclude Include="Source\BWEM\src\neutral.h" />
|
||||
<ClInclude Include="Source\BWEM\src\tiles.h" />
|
||||
<ClInclude Include="Source\BWEM\src\utils.h" />
|
||||
<ClInclude Include="Source\BWEM\src\winutils.h" />
|
||||
<ClInclude Include="Source\CBase.h" />
|
||||
<ClInclude Include="Source\CheckItem.h" />
|
||||
<ClInclude Include="Source\CPlayer.h" />
|
||||
<ClInclude Include="Source\CUnit.h" />
|
||||
<ClInclude Include="Source\KoraBot.h" />
|
||||
<ClInclude Include="Source\Location.h" />
|
||||
<ClInclude Include="Source\Macro.h" />
|
||||
<ClInclude Include="Source\CMap.h" />
|
||||
<ClInclude Include="Source\Military.h" />
|
||||
<ClInclude Include="Source\Mining.h" />
|
||||
<ClInclude Include="Source\PlayerAssessment.h" />
|
||||
<ClInclude Include="Source\QueueEntry.h" />
|
||||
<ClInclude Include="Source\Scouting.h" />
|
||||
<ClInclude Include="Source\Squad.h" />
|
||||
<ClInclude Include="Source\Util.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BWAPILIB\BWAPILIB.vcxproj">
|
||||
<Project>{843656fd-9bfd-47bf-8460-7bfe9710ea2c}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
158
KoraBot.vcxproj.filters
Normal file
|
@ -0,0 +1,158 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Source\Dll.cpp" />
|
||||
<ClCompile Include="Source\KoraBot.cpp" />
|
||||
<ClCompile Include="Source\BWEM\src\area.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\base.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\bwapiExt.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\bwem.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\cp.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\examples.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\exampleWall.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\graph.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\gridMap.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\map.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\mapDrawer.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\mapImpl.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\mapPrinter.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\neutral.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\utils.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\winutils.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\src\tiles.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\BWEM\EasyBMP_1.06\EasyBMP.cpp">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Source\Analysis.cpp" />
|
||||
<ClCompile Include="Source\BuildingPlacement.cpp" />
|
||||
<ClCompile Include="Source\CBase.cpp" />
|
||||
<ClCompile Include="Source\CheckItem.cpp" />
|
||||
<ClCompile Include="Source\CPlayer.cpp" />
|
||||
<ClCompile Include="Source\CUnit.cpp" />
|
||||
<ClCompile Include="Source\Location.cpp" />
|
||||
<ClCompile Include="Source\Macro.cpp" />
|
||||
<ClCompile Include="Source\Military.cpp" />
|
||||
<ClCompile Include="Source\Mining.cpp" />
|
||||
<ClCompile Include="Source\QueueEntry.cpp" />
|
||||
<ClCompile Include="Source\Scouting.cpp" />
|
||||
<ClCompile Include="Source\Squad.cpp" />
|
||||
<ClCompile Include="Source\Util.cpp" />
|
||||
<ClCompile Include="Source\PlayerAssessment.cpp" />
|
||||
<ClCompile Include="Source\CMap.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Source\KoraBot.h" />
|
||||
<ClInclude Include="Source\BWEM\src\area.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\base.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\bwem.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\bwapiExt.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\cp.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\defs.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\examples.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\exampleWall.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\graph.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\gridMap.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\map.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\mapDrawer.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\mapImpl.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\mapPrinter.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\neutral.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\winutils.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\utils.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\src\tiles.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\BWEM\EasyBMP_1.06\EasyBMP.h">
|
||||
<Filter>BWEM</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Source\Analysis.h" />
|
||||
<ClInclude Include="Source\BuildingPlacement.h" />
|
||||
<ClInclude Include="Source\CBase.h" />
|
||||
<ClInclude Include="Source\CheckItem.h" />
|
||||
<ClInclude Include="Source\CPlayer.h" />
|
||||
<ClInclude Include="Source\CUnit.h" />
|
||||
<ClInclude Include="Source\Location.h" />
|
||||
<ClInclude Include="Source\Macro.h" />
|
||||
<ClInclude Include="Source\Military.h" />
|
||||
<ClInclude Include="Source\Mining.h" />
|
||||
<ClInclude Include="Source\QueueEntry.h" />
|
||||
<ClInclude Include="Source\Scouting.h" />
|
||||
<ClInclude Include="Source\Squad.h" />
|
||||
<ClInclude Include="Source\Util.h" />
|
||||
<ClInclude Include="Source\PlayerAssessment.h" />
|
||||
<ClInclude Include="Source\CMap.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="BWEM">
|
||||
<UniqueIdentifier>{dd2a7d56-7d9f-49ea-86d2-178e8c60dd0b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
4
KoraBot.vcxproj.user
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
150
KoraBotTest/AnalysisTest.cpp
Normal file
|
@ -0,0 +1,150 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Analysis.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace AnalysisTest
|
||||
{
|
||||
BWAPI::UnitType drone = BWAPI::UnitTypes::Zerg_Drone;
|
||||
BWAPI::TechType tech = BWAPI::TechTypes::Burrowing;
|
||||
BWAPI::UpgradeType upgrade = BWAPI::UpgradeTypes::Zerg_Missile_Attacks;
|
||||
TEST(AnalysisTest, analyzeTech)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyze(tech), 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeUnit)
|
||||
{
|
||||
EXPECT_GE(Analysis::analyze(drone), 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeUpgrade)
|
||||
{
|
||||
EXPECT_GE(Analysis::analyze(upgrade), 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeDrone)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeEvoChamber)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeGas)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeGas(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeGroundArmor)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeGroundArmor(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeHatchery)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeHive)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeHive(), 0.8);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeHydraDen)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeHydralisk)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeHydraRange)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeHydraRange(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeHydraSpeed)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeHydraSpeed(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeLair)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeLair(), 0.8);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeLingSpeed)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeLingSpeed(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeMissile)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeMissile(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeMutalisk)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeOverlord)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeOverlordSpeed)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeOverlordSpeed(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeQueensNest)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeQueensNest(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeSpawningPool)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeSpire)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeSpire(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeSpore)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeSpore(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeSunken)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeSunken(), 1.3);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, analyzeUltraCavern)
|
||||
{
|
||||
EXPECT_EQ(Analysis::analyzeUltraCavern(), 1);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeUltralisk)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(AnalysisTest, DISABLED_analyzeZergling)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
32
KoraBotTest/BuildingPlacementTest.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Util.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace BuildingPlacementTest
|
||||
{
|
||||
TEST(BuildingPlacementTest, DISABLED_build)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(BuildingPlacementTest, DISABLED_checkBounds)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(BuildingPlacementTest, DISABLED_getDirection)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(BuildingPlacementTest, DISABLED_getPosition)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
88
KoraBotTest/CBaseTest.cpp
Normal file
|
@ -0,0 +1,88 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Util.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace CBaseTest
|
||||
{
|
||||
TEST(CBaseTest, DISABLED_addWorker)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_desiredSporeCount)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_desiredSunkenCount)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_extractorsBuilt)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_getDefense)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_getResources)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_initialize)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_initializeResources)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_isExposedToCenter)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_isSaturated)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_isStartLocation)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_setDefenseLocation)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_subtractWorker)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CBaseTest, DISABLED_techCount)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
class MockCBase : public CBase
|
||||
{
|
||||
public:
|
||||
|
||||
};
|
46
KoraBotTest/CUnitTest.cpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#include "pch.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h"
|
||||
#include "../kora-bot/Source/CUnit.h"
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace CUnitTest
|
||||
{
|
||||
TEST(CUnitTest, initializeBlank)
|
||||
{
|
||||
CUnit unit = CUnit();
|
||||
EXPECT_EQ(unit.action, "");
|
||||
EXPECT_EQ(unit.lastSeen, TilePosition(0,0));
|
||||
EXPECT_EQ(unit.miningBase, -1);
|
||||
EXPECT_EQ(unit.target, TilePosition(-1, -1));
|
||||
}
|
||||
|
||||
TEST(CUnitTest, DISABLED_initializeExistingUnit)
|
||||
{
|
||||
//MockBWAPIUnit BWAPIUnit;
|
||||
//CUnit unit = CUnit(BWAPIUnit);
|
||||
}
|
||||
|
||||
TEST(CUnitTest, DISABLED_isIdle)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CUnitTest, DISABLED_isInSquad)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
class MockBWAPIUnit : public UnitInterface
|
||||
{
|
||||
public:
|
||||
// in the same order they are in the BWAPI::UnitInterface definition
|
||||
MOCK_METHOD(int, getID, (), (const, override));
|
||||
MOCK_METHOD(bool, exists, (), (const, override));
|
||||
};
|
142
KoraBotTest/CheckItemTest.cpp
Normal file
|
@ -0,0 +1,142 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Util.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace CheckItemTest
|
||||
{
|
||||
TEST(CheckItemTest, DISABLED_checkBases)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkEvoChamber)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkGas)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkHive)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkHydraDen)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkHydralisk)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkMacroHatch)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkMutalisk)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkNewBase)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkQueensNest)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkSpawningPool)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkSpire)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkSpore)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkSunken)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkSupply)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkWorkers)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkUltraCavern)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkUltralisk)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkZergling)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkHydraRange)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkHydraSpeed)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkLair)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkLingSpeed)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkOverlordSpeed)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkGroundArmor)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(CheckItemTest, DISABLED_checkMissile)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
156
KoraBotTest/KoraBotTest.vcxproj
Normal file
|
@ -0,0 +1,156 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{e2b33fb7-a23e-4c7a-9a9d-02ccd70cfc56}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="Shared" />
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\packages\gmock.1.11.0\lib\native\src\gtest\src\gtest_main.cc" />
|
||||
<ClCompile Include="AnalysisTest.cpp" />
|
||||
<ClCompile Include="BuildingPlacementTest.cpp" />
|
||||
<ClCompile Include="CBaseTest.cpp" />
|
||||
<ClCompile Include="CheckItemTest.cpp" />
|
||||
<ClCompile Include="CUnitTest.cpp" />
|
||||
<ClCompile Include="MacroTest.cpp" />
|
||||
<ClCompile Include="MilitaryTest.cpp" />
|
||||
<ClCompile Include="MiningTest.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PlayerAssessmentTest.cpp" />
|
||||
<ClCompile Include="QueueEntryTest.cpp" />
|
||||
<ClCompile Include="ScoutingTest.cpp" />
|
||||
<ClCompile Include="SquadTest.cpp" />
|
||||
<ClCompile Include="UtilTest.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\BWAPILIB\BWAPILIB.vcxproj">
|
||||
<Project>{843656fd-9bfd-47bf-8460-7bfe9710ea2c}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\KoraBot.vcxproj">
|
||||
<Project>{2e63ae74-758a-4607-9de4-d28e814a6e13}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\packages\gmock.1.11.0\build\native\gmock.targets" Condition="Exists('..\packages\gmock.1.11.0\build\native\gmock.targets')" />
|
||||
</ImportGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>../../include;$(SolutionDir)Release\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)$(IntDir)*.obj;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(SolutionDir)$(IntDir)*.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>X64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>../../include;$(SolutionDir)Release\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)$(IntDir)*.obj;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(SolutionDir)$(IntDir)*.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>../../include;$(SolutionDir)Release\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)$(IntDir)*.obj;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(SolutionDir)$(IntDir)*.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PreprocessorDefinitions>X64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>../../include;$(SolutionDir)Release\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)$(IntDir)*.obj;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(SolutionDir)$(IntDir)*.obj;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\gmock.1.11.0\build\native\gmock.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\gmock.1.11.0\build\native\gmock.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
4
KoraBotTest/KoraBotTest.vcxproj.user
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
228
KoraBotTest/MacroTest.cpp
Normal file
|
@ -0,0 +1,228 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Macro.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
|
||||
namespace MacroTest
|
||||
{
|
||||
namespace { auto& map = BWEM::Map::Instance(); }
|
||||
|
||||
int selfID = 1;
|
||||
|
||||
TilePosition tp1 = TilePosition(1, 1);
|
||||
|
||||
TEST(MacroTest, DISABLED_addBase)
|
||||
{
|
||||
EXPECT_EQ(int(Macro::bases.size()), 0);
|
||||
Macro::addBase(tp1);
|
||||
EXPECT_EQ(int(Macro::bases.size()), 1);
|
||||
}
|
||||
|
||||
TEST(MacroTest, addLocation)
|
||||
{
|
||||
EXPECT_EQ(int(Macro::locations.size()), 0);
|
||||
Macro::addLocation(tp1, false);
|
||||
EXPECT_EQ(int(Macro::locations.size()), 1);
|
||||
}
|
||||
|
||||
TEST(MacroTest, addPlayer)
|
||||
{
|
||||
BWAPI::Player p = BWAPI::Player();
|
||||
|
||||
EXPECT_EQ(int(Macro::players.size()), 0);
|
||||
Macro::addPlayer(p);
|
||||
EXPECT_EQ(int(Macro::players.size()), 1);
|
||||
}
|
||||
|
||||
TEST(MacroTest, addSquad)
|
||||
{
|
||||
EXPECT_EQ(int(Macro::squads.size()), 0);
|
||||
Macro::addSquad();
|
||||
EXPECT_EQ(int(Macro::squads.size()), 1);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_analyzeQueue)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_assignBase)
|
||||
{
|
||||
BWAPI::Player p = BWAPI::Player();
|
||||
|
||||
CBase c = CBase();
|
||||
Macro::addPlayer(p);
|
||||
|
||||
Macro::assignBase(p->getID(), c);
|
||||
|
||||
EXPECT_EQ(int(Macro::players.front().bases.size()), 1);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_findMiningBase)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_freeUnit)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_getTrainingBase)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_morphCreepColonies)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_onUnitComplete)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_onUnitCreate)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_onUnitDestroy)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_onUnitDiscover)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_onUnitMorph)
|
||||
{
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_onUnitShow)
|
||||
{
|
||||
Unit u = Unit();
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
|
||||
TEST(MacroTest, queueCount)
|
||||
{
|
||||
BWAPI::UnitType unit = BWAPI::UnitTypes::Zerg_Drone;
|
||||
EXPECT_EQ(Macro::queueCount(unit), 0);
|
||||
|
||||
Macro::queue.push_back(QueueEntry(unit, false, 0.0));
|
||||
Macro::queue.push_back(QueueEntry(unit, false, 0.0));
|
||||
EXPECT_EQ(Macro::queueCount(unit), 2);
|
||||
}
|
||||
|
||||
TEST(MacroTest, queueHasTech)
|
||||
{
|
||||
BWAPI::TechType tech = BWAPI::TechTypes::Burrowing;
|
||||
EXPECT_FALSE(Macro::queueHas(tech));
|
||||
|
||||
Macro::queue.push_back(QueueEntry(tech, false, 0.0));
|
||||
EXPECT_TRUE(Macro::queueHas(tech));
|
||||
}
|
||||
|
||||
TEST(MacroTest, queueHasUnit)
|
||||
{
|
||||
Macro::queue.clear();
|
||||
BWAPI::UnitType unit = BWAPI::UnitTypes::Zerg_Drone;
|
||||
EXPECT_FALSE(Macro::queueHas(unit));
|
||||
|
||||
Macro::queue.push_back(QueueEntry(unit, false, 0.0));
|
||||
EXPECT_TRUE(Macro::queueHas(unit));
|
||||
}
|
||||
|
||||
TEST(MacroTest, queueHasUpgrade)
|
||||
{
|
||||
BWAPI::UpgradeType upgrade = BWAPI::UpgradeTypes::Adrenal_Glands;
|
||||
EXPECT_FALSE(Macro::queueHas(upgrade));
|
||||
|
||||
Macro::queue.push_back(QueueEntry(upgrade, false, 0.0));
|
||||
EXPECT_TRUE(Macro::queueHas(upgrade));
|
||||
}
|
||||
|
||||
TEST(MacroTest, setEnemyId)
|
||||
{
|
||||
int enemyId = 2;
|
||||
Macro::setEnemyID(enemyId);
|
||||
// check if the enemy id is in the enemyIDs vector
|
||||
EXPECT_TRUE(std::find(Macro::enemyIDs.begin(), Macro::enemyIDs.end(), enemyId) != Macro::enemyIDs.end());
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_setLastAttack)
|
||||
{
|
||||
int lastAttackFrame = 2;
|
||||
Macro::setLastAttack(lastAttackFrame);
|
||||
EXPECT_EQ(Macro::lastAttack, lastAttackFrame);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_setLastBuildLocation)
|
||||
{
|
||||
Macro::setLastBuildLocation(tp1);
|
||||
EXPECT_EQ(Macro::lastBuildLocation.x, tp1.x);
|
||||
EXPECT_EQ(Macro::lastBuildLocation.y, tp1.y);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_setMacroHatch)
|
||||
{
|
||||
Macro::setMacroHatch(false);
|
||||
EXPECT_EQ(Macro::macroHatch, false);
|
||||
|
||||
Macro::setMacroHatch(true);
|
||||
EXPECT_EQ(Macro::macroHatch, true);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_setNewBase)
|
||||
{
|
||||
Macro::setNewBase(false);
|
||||
EXPECT_EQ(Macro::newBase, false);
|
||||
|
||||
Macro::setNewBase(true);
|
||||
EXPECT_EQ(Macro::newBase, true);
|
||||
}
|
||||
|
||||
TEST(MacroTest, DISABLED_setScouts)
|
||||
{
|
||||
EXPECT_EQ(int(Macro::scouts.size()), 0);
|
||||
|
||||
Macro::setSelfID(selfID);
|
||||
CUnit overlord = CUnit();
|
||||
Unit u = Unit();
|
||||
}
|
||||
|
||||
TEST(MacroTest, setSelfID)
|
||||
{
|
||||
Macro::setSelfID(selfID);
|
||||
EXPECT_EQ(Macro::selfID, selfID);
|
||||
}
|
||||
|
||||
TEST(MacroTest, setStopProduction)
|
||||
{
|
||||
Macro::setStopProduction(false);
|
||||
EXPECT_EQ(Macro::stopProduction, false);
|
||||
|
||||
Macro::setStopProduction(true);
|
||||
EXPECT_EQ(Macro::stopProduction, true);
|
||||
}
|
||||
}
|
||||
|
||||
class MacroTestFixture : ::testing::Test
|
||||
{
|
||||
protected:
|
||||
MacroTestFixture()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
87
KoraBotTest/MilitaryTest.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Util.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace MilitaryTest
|
||||
{
|
||||
TEST(MilitaryTest, DISABLED_addSquadlessUnits)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_checkAttack)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_checkDefense)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_checkEnemiesAt)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_checkSquads)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_getAttackLocation)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_getBaseDefense)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_getClosestSquad)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_getIdleSquad)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_getMostVulnerableBase)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_inThreatRange)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_isThreatened)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_likelihoodToAttack)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_sendDefense)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(MilitaryTest, DISABLED_shouldAttackNonMaxed)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
17
KoraBotTest/MiningTest.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Mining.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace MiningTest
|
||||
{
|
||||
TEST(MiningTest, resourceToMine)
|
||||
{
|
||||
EXPECT_TRUE(Mining::resourceToMine());
|
||||
}
|
||||
}
|
32
KoraBotTest/PlayerAssessmentTest.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Util.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace PlayerAssessmentTest
|
||||
{
|
||||
TEST(PlayerAssessmentTest, DISABLED_estimateBaseMinedMinerals)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(PlayerAssessmentTest, DISABLED_estimateTotalGas)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(PlayerAssessmentTest, DISABLED_estimateTotalMinerals)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(PlayerAssessmentTest, DISABLED_estimateUnitCount)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
41
KoraBotTest/QueueEntryTest.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/QueueEntry.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace QueueEntryTest
|
||||
{
|
||||
BWAPI::TechType tech = BWAPI::TechTypes::Burrowing;
|
||||
BWAPI::UnitType unit = BWAPI::UnitTypes::Zerg_Drone;
|
||||
BWAPI::UpgradeType upgrade = BWAPI::UpgradeTypes::Zerg_Missile_Attacks;
|
||||
|
||||
QueueEntry techEntry = QueueEntry(tech, false, 0);
|
||||
QueueEntry unitEntry = QueueEntry(unit, false, 0);
|
||||
QueueEntry upgradeEntry = QueueEntry(upgrade, false, 0);
|
||||
|
||||
TEST(QueueEntryTest, isTech)
|
||||
{
|
||||
EXPECT_TRUE(techEntry.isTech());
|
||||
EXPECT_FALSE(techEntry.isUnit());
|
||||
EXPECT_FALSE(techEntry.isUpgrade());
|
||||
}
|
||||
|
||||
TEST(QueueEntryTest, isUnit)
|
||||
{
|
||||
EXPECT_FALSE(unitEntry.isTech());
|
||||
EXPECT_TRUE(unitEntry.isUnit());
|
||||
EXPECT_FALSE(unitEntry.isUpgrade());
|
||||
}
|
||||
|
||||
TEST(QueueEntryTest, isUpgrade)
|
||||
{
|
||||
EXPECT_FALSE(upgradeEntry.isTech());
|
||||
EXPECT_FALSE(upgradeEntry.isUnit());
|
||||
EXPECT_TRUE(upgradeEntry.isUpgrade());
|
||||
}
|
||||
}
|
BIN
KoraBotTest/Release/AnalysisTest.obj
Normal file
BIN
KoraBotTest/Release/BuildingPlacementTest.obj
Normal file
BIN
KoraBotTest/Release/CBaseTest.obj
Normal file
BIN
KoraBotTest/Release/CUnitTest.obj
Normal file
BIN
KoraBotTest/Release/CheckItemTest.obj
Normal file
20
KoraBotTest/Release/KoraBotTest.Build.CppClean.log
Normal file
|
@ -0,0 +1,20 @@
|
|||
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
|
18
KoraBotTest/Release/KoraBotTest.exe.recipe
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?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>
|
7
KoraBotTest/Release/KoraBotTest.log
Normal file
|
@ -0,0 +1,7 @@
|
|||
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
|
BIN
KoraBotTest/Release/KoraBotTest.pch
Normal file
BIN
KoraBotTest/Release/KoraBotTest.tlog/CL.command.1.tlog
Normal file
BIN
KoraBotTest/Release/KoraBotTest.tlog/CL.read.1.tlog
Normal file
BIN
KoraBotTest/Release/KoraBotTest.tlog/CL.write.1.tlog
Normal file
|
@ -0,0 +1,2 @@
|
|||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=8.1:
|
||||
Release|Win32|D:\_programs\Starcraft-old\BWAPI-4_4\kora-bot\|
|
BIN
KoraBotTest/Release/KoraBotTest.tlog/KoraBotTest.write.1u.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
1
KoraBotTest/Release/KoraBotTest.tlog/link.command.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
KoraBotTest/Release/KoraBotTest.tlog/link.read.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
1
KoraBotTest/Release/KoraBotTest.tlog/link.write.1.tlog
Normal file
|
@ -0,0 +1 @@
|
|||
|
BIN
KoraBotTest/Release/MacroTest.obj
Normal file
BIN
KoraBotTest/Release/MilitaryTest.obj
Normal file
BIN
KoraBotTest/Release/MiningTest.obj
Normal file
BIN
KoraBotTest/Release/PlayerAssessmentTest.obj
Normal file
BIN
KoraBotTest/Release/QueueEntryTest.obj
Normal file
BIN
KoraBotTest/Release/ScoutingTest.obj
Normal file
BIN
KoraBotTest/Release/SquadTest.obj
Normal file
BIN
KoraBotTest/Release/UtilTest.obj
Normal file
BIN
KoraBotTest/Release/gmock-all.obj
Normal file
BIN
KoraBotTest/Release/gtest-all.obj
Normal file
BIN
KoraBotTest/Release/gtest_main.obj
Normal file
BIN
KoraBotTest/Release/pch.obj
Normal file
BIN
KoraBotTest/Release/vc142.pdb
Normal file
32
KoraBotTest/ScoutingTest.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Util.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace ScoutingTest
|
||||
{
|
||||
TEST(ScoutingTest, DISABLED_checkNextBase)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(ScoutingTest, DISABLED_getScoutingLocation)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(ScoutingTest, DISABLED_isScout)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(ScoutingTest, DISABLED_locationScouted)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
42
KoraBotTest/SquadTest.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/Util.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace SquadTest
|
||||
{
|
||||
TEST(SquadTest, DISABLED_addUnit)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(SquadTest, DISABLED_attack)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(SquadTest, DISABLED_checkCenter)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(SquadTest, DISABLED_checkDamage)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(SquadTest, DISABLED_contains)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(SquadTest, DISABLED_containsType)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
155
KoraBotTest/UtilTest.cpp
Normal file
|
@ -0,0 +1,155 @@
|
|||
#include "pch.h"
|
||||
|
||||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
|
||||
#include "../Source/BWEM/src/bwem.h";
|
||||
#include "../Source/CBase.h";
|
||||
#include "../Source/Util.h";
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
namespace UtilTest
|
||||
{
|
||||
TilePosition tp1 = TilePosition(0, 0);
|
||||
TilePosition tp2 = TilePosition(3, 4);
|
||||
|
||||
Location l1 = Location(tp1, false);
|
||||
Location l2 = Location(tp2, false);
|
||||
|
||||
BWAPI::UnitType drone = BWAPI::UnitTypes::Zerg_Drone;
|
||||
BWAPI::UnitType zergling = BWAPI::UnitTypes::Zerg_Zergling;
|
||||
|
||||
TEST(UtilTest, DISABLED_buildWorkerIndex)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_completedBuilding)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_countUnits)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_eggCount)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_findUpgradeBuilding)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getAreaAverage)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getBaseIndex)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getClosestOwnedBase)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, getDistance)
|
||||
{
|
||||
EXPECT_EQ(Util::getDistance(tp1, tp2), 5);
|
||||
}
|
||||
|
||||
TEST(UtilTest, getLocation)
|
||||
{
|
||||
Macro::locations.clear();
|
||||
Macro::locations.push_back(l1);
|
||||
Macro::locations.push_back(l2);
|
||||
EXPECT_EQ(Util::getLocation(tp2), 1);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getNeighborArea)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getNextExpand)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getPath)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, getQueueIndex)
|
||||
{
|
||||
Macro::queue.clear();
|
||||
QueueEntry q1 = QueueEntry(drone, false, 0);
|
||||
QueueEntry q2 = QueueEntry(zergling, false, 0);
|
||||
|
||||
Macro::queue.push_back(q1);
|
||||
Macro::queue.push_back(q2);
|
||||
EXPECT_EQ(Util::getQueueIndex(zergling), 1);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getTargetArea)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getUnitIndex)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_getWalkDistance)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_isAttackingUnit)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_isBasePosition)
|
||||
{
|
||||
Macro::bases.clear();
|
||||
CBase base = CBase(tp1);
|
||||
Macro::bases.push_back(base);
|
||||
EXPECT_TRUE(Util::isBasePosition(tp1));
|
||||
EXPECT_FALSE(Util::isBasePosition(tp2));
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_isOwned)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_ownedBy)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_reconstructPath)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_unitCounted)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
|
||||
TEST(UtilTest, DISABLED_workerBuildingTargetCount)
|
||||
{
|
||||
EXPECT_EQ(0, 0);
|
||||
}
|
||||
}
|
4
KoraBotTest/packages.config
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="gmock" version="1.11.0" targetFramework="native" />
|
||||
</packages>
|
6
KoraBotTest/pch.cpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
//
|
||||
// pch.cpp
|
||||
// Include the standard header and generate the precompiled header.
|
||||
//
|
||||
|
||||
#include "pch.h"
|
7
KoraBotTest/pch.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
//
|
||||
// pch.h
|
||||
// Header for standard system include files.
|
||||
//
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
296
Source/Analysis.cpp
Normal file
|
@ -0,0 +1,296 @@
|
|||
#include "Analysis.h"
|
||||
|
||||
double Analysis::analyze(TechType tech)
|
||||
{
|
||||
double score = 0;
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyze(BWAPI::UnitType unit)
|
||||
{
|
||||
double score = 0;
|
||||
|
||||
switch (unit)
|
||||
{
|
||||
case UnitTypes::Zerg_Drone:
|
||||
score = analyzeDrone();
|
||||
break;
|
||||
case UnitTypes::Zerg_Evolution_Chamber:
|
||||
score = analyzeEvoChamber();
|
||||
break;
|
||||
case UnitTypes::Zerg_Extractor:
|
||||
score = analyzeGas();
|
||||
break;
|
||||
case UnitTypes::Zerg_Hatchery:
|
||||
score = analyzeHatchery();
|
||||
break;
|
||||
case UnitTypes::Zerg_Hive:
|
||||
score = analyzeHive();
|
||||
break;
|
||||
case UnitTypes::Zerg_Hydralisk:
|
||||
score = analyzeHydralisk();
|
||||
break;
|
||||
case UnitTypes::Zerg_Hydralisk_Den:
|
||||
score = analyzeHydraDen();
|
||||
break;
|
||||
case UnitTypes::Zerg_Lair:
|
||||
score = analyzeLair();
|
||||
break;
|
||||
case UnitTypes::Zerg_Mutalisk:
|
||||
score = analyzeMutalisk();
|
||||
break;
|
||||
case UnitTypes::Zerg_Overlord:
|
||||
score = analyzeOverlord();
|
||||
break;
|
||||
case UnitTypes::Zerg_Queens_Nest:
|
||||
score = analyzeQueensNest();
|
||||
break;
|
||||
case UnitTypes::Zerg_Spawning_Pool:
|
||||
score = analyzeSpawningPool();
|
||||
break;
|
||||
case UnitTypes::Zerg_Spire:
|
||||
score = analyzeSpire();
|
||||
break;
|
||||
case UnitTypes::Zerg_Spore_Colony:
|
||||
score = analyzeSpore();
|
||||
break;
|
||||
case UnitTypes::Zerg_Sunken_Colony:
|
||||
score = analyzeSunken();
|
||||
break;
|
||||
case UnitTypes::Zerg_Ultralisk:
|
||||
score = analyzeUltralisk();
|
||||
break;
|
||||
case UnitTypes::Zerg_Ultralisk_Cavern:
|
||||
score = analyzeUltraCavern();
|
||||
break;
|
||||
case UnitTypes::Zerg_Zergling:
|
||||
score = analyzeZergling();
|
||||
break;
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyze(UpgradeType upgrade)
|
||||
{
|
||||
double score = 0;
|
||||
switch (upgrade)
|
||||
{
|
||||
case UpgradeTypes::Grooved_Spines:
|
||||
score = analyzeHydraRange();
|
||||
break;
|
||||
case UpgradeTypes::Metabolic_Boost:
|
||||
score = analyzeLingSpeed();
|
||||
break;
|
||||
case UpgradeTypes::Muscular_Augments:
|
||||
score = analyzeHydraSpeed();
|
||||
break;
|
||||
case UpgradeTypes::Pneumatized_Carapace:
|
||||
score = analyzeOverlordSpeed();
|
||||
break;
|
||||
case UpgradeTypes::Zerg_Carapace:
|
||||
score = analyzeGroundArmor();
|
||||
break;
|
||||
case UpgradeTypes::Zerg_Missile_Attacks:
|
||||
score = analyzeMissile();
|
||||
break;
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyzeDrone()
|
||||
{
|
||||
double score = 0;
|
||||
if (Util::countUnits(Macro::selfID, UnitTypes::Zerg_Drone) < 65)
|
||||
{
|
||||
score = 1;
|
||||
}
|
||||
|
||||
score -= Util::eggCount(UnitTypes::Zerg_Drone) * 0.02;
|
||||
|
||||
if (Military::likelihoodToAttack() > 0.7) score -= 0.4;
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyzeEvoChamber()
|
||||
{
|
||||
double score = 1.0;
|
||||
if (Military::likelihoodToAttack() > 0.7) score -= 0.4;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeGas()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeGroundArmor()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeHatchery()
|
||||
{
|
||||
double score = 0;
|
||||
|
||||
if (Macro::newBase)
|
||||
{
|
||||
score = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
score = 2;
|
||||
}
|
||||
|
||||
return score - Military::likelihoodToAttack();
|
||||
}
|
||||
|
||||
double Analysis::analyzeHive()
|
||||
{
|
||||
return 0.8;
|
||||
}
|
||||
|
||||
double Analysis::analyzeHydraDen()
|
||||
{
|
||||
double score = 0;
|
||||
if (Util::countUnits(Macro::selfID, UnitTypes::Zerg_Hydralisk_Den) == 0)
|
||||
{
|
||||
score += 0.7;
|
||||
if (Broodwar->self()->supplyUsed() >= 38) score += 0.5;
|
||||
}
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyzeHydralisk()
|
||||
{
|
||||
if (Broodwar->self()->supplyUsed() > Broodwar->self()->supplyTotal()) return 0;
|
||||
|
||||
double score = 0.8;
|
||||
score -= Util::eggCount(UnitTypes::Zerg_Hydralisk) * 0.1;
|
||||
//if (Military::likelihoodToAttack() > 0.7) score += 0.3;
|
||||
if (Military::likelihoodToAttack() < 0.2) score -= 0.4;
|
||||
|
||||
if (!Macro::enemyIDs.empty())
|
||||
{
|
||||
score += Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Protoss_Zealot) * 0.02;
|
||||
score += Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Terran_Firebat) * 0.02;
|
||||
}
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyzeHydraRange()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeHydraSpeed()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeLair()
|
||||
{
|
||||
return 0.8;
|
||||
}
|
||||
|
||||
double Analysis::analyzeLingSpeed()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeMissile()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeMutalisk()
|
||||
{
|
||||
double score = 0.7;
|
||||
score -= Util::eggCount(UnitTypes::Zerg_Mutalisk) * 0.1;
|
||||
if (!Macro::enemyIDs.empty())
|
||||
{
|
||||
score -= Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Protoss_Corsair) * 0.05;
|
||||
score -= Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Terran_Valkyrie) * 0.05;
|
||||
}
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyzeOverlord()
|
||||
{
|
||||
double score = 1.5;
|
||||
|
||||
if (Military::likelihoodToAttack() > 0.7) score -= 0.1;
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyzeOverlordSpeed()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeQueensNest()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeSpawningPool()
|
||||
{
|
||||
double score = 0;
|
||||
|
||||
if (Util::countUnits(Macro::selfID, UnitTypes::Zerg_Spawning_Pool) == 0)
|
||||
{
|
||||
score += 0.7;
|
||||
if (Broodwar->self()->supplyUsed() >= 24) score += 0.5;
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyzeSpire()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeSpore()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeSunken()
|
||||
{
|
||||
return 1.3;
|
||||
}
|
||||
|
||||
double Analysis::analyzeUltraCavern()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double Analysis::analyzeUltralisk()
|
||||
{
|
||||
double score = 0.6;
|
||||
score -= Util::eggCount(UnitTypes::Zerg_Ultralisk) * 0.1;
|
||||
return score;
|
||||
}
|
||||
|
||||
double Analysis::analyzeZergling()
|
||||
{
|
||||
double score = 0.6;
|
||||
score -= Util::eggCount(UnitTypes::Zerg_Zergling) * 0.1;
|
||||
if (!Macro::enemyIDs.empty())
|
||||
{
|
||||
score -= Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Protoss_Zealot) * 0.05;
|
||||
score -= Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Terran_Firebat) * 0.05;
|
||||
}
|
||||
else
|
||||
{
|
||||
score += Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Protoss_Dragoon) * 0.05;
|
||||
score += Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Terran_Siege_Tank_Siege_Mode) * 0.05;
|
||||
score += Util::countUnits(Macro::enemyIDs.front(), UnitTypes::Terran_Siege_Tank_Tank_Mode) * 0.05;
|
||||
}
|
||||
return score;
|
||||
}
|
42
Source/Analysis.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include <BWAPI.h>
|
||||
#include "CBase.h"
|
||||
#include "CUnit.h"
|
||||
#include "Macro.h"
|
||||
#include "Util.h"
|
||||
|
||||
using namespace BWAPI;
|
||||
|
||||
class Analysis
|
||||
{
|
||||
public:
|
||||
static double analyze(BWAPI::TechType tech);
|
||||
static double analyze(BWAPI::UnitType unit);
|
||||
static double analyze(BWAPI::UpgradeType upgrade);
|
||||
static double analyzeDrone();
|
||||
static double analyzeEvoChamber();
|
||||
static double analyzeGas();
|
||||
static double analyzeHatchery();
|
||||
static double analyzeHive();
|
||||
static double analyzeHydraDen();
|
||||
static double analyzeHydralisk();
|
||||
static double analyzeLair();
|
||||
static double analyzeMutalisk();
|
||||
static double analyzeOverlord();
|
||||
static double analyzeQueensNest();
|
||||
static double analyzeSpawningPool();
|
||||
static double analyzeSpire();
|
||||
static double analyzeSpore();
|
||||
static double analyzeSunken();
|
||||
static double analyzeUltraCavern();
|
||||
static double analyzeUltralisk();
|
||||
static double analyzeZergling();
|
||||
|
||||
static double analyzeGroundArmor();
|
||||
static double analyzeHydraRange();
|
||||
static double analyzeHydraSpeed();
|
||||
static double analyzeLingSpeed();
|
||||
static double analyzeMissile();
|
||||
static double analyzeOverlordSpeed();
|
||||
};
|
10
Source/BWEM/EasyBMP_1.06/BSD_(revised)_license.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
Copyright (c) 2005, The EasyBMP Project (http://easybmp.sourceforge.net)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1911
Source/BWEM/EasyBMP_1.06/EasyBMP.cpp
Normal file
86
Source/BWEM/EasyBMP_1.06/EasyBMP.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*************************************************
|
||||
* *
|
||||
* EasyBMP Cross-Platform Windows Bitmap Library *
|
||||
* *
|
||||
* Author: Paul Macklin *
|
||||
* email: macklin01@users.sourceforge.net *
|
||||
* support: http://easybmp.sourceforge.net *
|
||||
* *
|
||||
* file: EasyBMP.h *
|
||||
* date added: 01-31-2005 *
|
||||
* date modified: 12-01-2006 *
|
||||
* version: 1.06 *
|
||||
* *
|
||||
* License: BSD (revised/modified) *
|
||||
* Copyright: 2005-6 by the EasyBMP Project *
|
||||
* *
|
||||
* description: Main include file *
|
||||
* *
|
||||
*************************************************/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// MS Visual Studio gives warnings when using
|
||||
// fopen. But fopen_s is not going to work well
|
||||
// with most compilers, and fopen_s uses different
|
||||
// syntax than fopen. (i.e., a macro won't work)
|
||||
// So, we'lll use this:
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
|
||||
#ifndef EasyBMP
|
||||
#define EasyBMP
|
||||
|
||||
#ifdef __BCPLUSPLUS__
|
||||
// The Borland compiler must use this because something
|
||||
// is wrong with their cstdio file.
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include <cstdio>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
// If g++ specific code is ever required, this is
|
||||
// where it goes.
|
||||
#endif
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
// If Intel specific code is ever required, this is
|
||||
// where it goes.
|
||||
#endif
|
||||
|
||||
#ifndef _DefaultXPelsPerMeter_
|
||||
#define _DefaultXPelsPerMeter_
|
||||
#define DefaultXPelsPerMeter 3780
|
||||
// set to a default of 96 dpi
|
||||
#endif
|
||||
|
||||
#ifndef _DefaultYPelsPerMeter_
|
||||
#define _DefaultYPelsPerMeter_
|
||||
#define DefaultYPelsPerMeter 3780
|
||||
// set to a default of 96 dpi
|
||||
#endif
|
||||
|
||||
#include "EasyBMP_DataStructures.h"
|
||||
#include "EasyBMP_BMP.h"
|
||||
#include "EasyBMP_VariousBMPutilities.h"
|
||||
|
||||
#ifndef _EasyBMP_Version_
|
||||
#define _EasyBMP_Version_ 1.06
|
||||
#define _EasyBMP_Version_Integer_ 106
|
||||
#define _EasyBMP_Version_String_ "1.06"
|
||||
#endif
|
||||
|
||||
#ifndef _EasyBMPwarnings_
|
||||
#define _EasyBMPwarnings_
|
||||
#endif
|
||||
|
||||
void SetEasyBMPwarningsOff( void );
|
||||
void SetEasyBMPwarningsOn( void );
|
||||
bool GetEasyBMPwarningState( void );
|
||||
|
||||
#endif
|
86
Source/BWEM/EasyBMP_1.06/EasyBMP_BMP.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*************************************************
|
||||
* *
|
||||
* EasyBMP Cross-Platform Windows Bitmap Library *
|
||||
* *
|
||||
* Author: Paul Macklin *
|
||||
* email: macklin01@users.sourceforge.net *
|
||||
* support: http://easybmp.sourceforge.net *
|
||||
* *
|
||||
* file: EasyBMP_VariousBMPutilities.h *
|
||||
* date added: 05-02-2005 *
|
||||
* date modified: 12-01-2006 *
|
||||
* version: 1.06 *
|
||||
* *
|
||||
* License: BSD (revised/modified) *
|
||||
* Copyright: 2005-6 by the EasyBMP Project *
|
||||
* *
|
||||
* description: Defines BMP class *
|
||||
* *
|
||||
*************************************************/
|
||||
|
||||
#ifndef _EasyBMP_BMP_h_
|
||||
#define _EasyBMP_BMP_h_
|
||||
|
||||
bool SafeFread( char* buffer, int size, int number, FILE* fp );
|
||||
bool EasyBMPcheckDataSize( void );
|
||||
|
||||
class BMP
|
||||
{private:
|
||||
|
||||
int BitDepth;
|
||||
int Width;
|
||||
int Height;
|
||||
RGBApixel** Pixels;
|
||||
RGBApixel* Colors;
|
||||
int XPelsPerMeter;
|
||||
int YPelsPerMeter;
|
||||
|
||||
ebmpBYTE* MetaData1;
|
||||
int SizeOfMetaData1;
|
||||
ebmpBYTE* MetaData2;
|
||||
int SizeOfMetaData2;
|
||||
|
||||
bool Read32bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
bool Read24bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
bool Read8bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
bool Read4bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
bool Read1bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
|
||||
bool Write32bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
bool Write24bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
bool Write8bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
bool Write4bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
bool Write1bitRow( ebmpBYTE* Buffer, int BufferSize, int Row );
|
||||
|
||||
ebmpBYTE FindClosestColor( RGBApixel& input );
|
||||
|
||||
public:
|
||||
|
||||
int TellBitDepth( void );
|
||||
int TellWidth( void );
|
||||
int TellHeight( void );
|
||||
int TellNumberOfColors( void );
|
||||
void SetDPI( int HorizontalDPI, int VerticalDPI );
|
||||
int TellVerticalDPI( void );
|
||||
int TellHorizontalDPI( void );
|
||||
|
||||
BMP();
|
||||
BMP( BMP& Input );
|
||||
~BMP();
|
||||
RGBApixel* operator()(int i,int j);
|
||||
|
||||
RGBApixel GetPixel( int i, int j ) const;
|
||||
bool SetPixel( int i, int j, RGBApixel NewPixel );
|
||||
|
||||
bool CreateStandardColorTable( void );
|
||||
|
||||
bool SetSize( int NewWidth, int NewHeight );
|
||||
bool SetBitDepth( int NewDepth );
|
||||
bool WriteToFile( const char* FileName );
|
||||
bool ReadFromFile( const char* FileName );
|
||||
|
||||
RGBApixel GetColor( int ColorNumber );
|
||||
bool SetColor( int ColorNumber, RGBApixel NewColor );
|
||||
};
|
||||
|
||||
#endif
|
821
Source/BWEM/EasyBMP_1.06/EasyBMP_ChangeLog.txt
Normal file
|
@ -0,0 +1,821 @@
|
|||
EasyBMP Cross-Platform Windows Bitmap Library: Change Log
|
||||
|
||||
Library Author(s): Paul Macklin
|
||||
Library License: BSD (revised). See the BSD_(revised)_license.txt
|
||||
file for further information.
|
||||
Copyright: 2005-6 by the EasyBMP Project
|
||||
Email: macklin01@users.sourceforge.net
|
||||
Support: http://easybmp.sourceforge.net
|
||||
|
||||
All changes by Paul Macklin unless otherwise noted.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.50
|
||||
Date: 1-31-2005
|
||||
|
||||
None! (first release)
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.51
|
||||
Date: 2-14-2005
|
||||
|
||||
Added full 32-bit BMP file support
|
||||
|
||||
Took out annoying "colors: " message from BMP8 initialization
|
||||
from scratch
|
||||
|
||||
Added more license and copyright info to each file
|
||||
|
||||
Added change log to library
|
||||
|
||||
To do next:
|
||||
Should update the error messages for the initializations
|
||||
Should simplify the reading and writing code
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.52
|
||||
Date: 2-19-2005
|
||||
|
||||
Fixed a minor bug in the MakeGreyscalePalette function where the
|
||||
0 color turned out to be (255,255,255), rather than (0,0,0)
|
||||
|
||||
Updated standard colors for 4-bit, 8-bit, and 24-bit
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.53
|
||||
Date: 2-27-2005
|
||||
|
||||
Fixed unsigned / signed problem that VS.net shows
|
||||
|
||||
|
||||
Tried fix of line 186 in EasyBMP_BMP4.h file. If it works,
|
||||
I'll apply it consistently. I think that VS.net wants us
|
||||
to clear char* blah, then char = new blah [size], just
|
||||
like the old days for g++.
|
||||
|
||||
Removed EasyBMP_StandardColors.h from standard package
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.54
|
||||
Date: 2-27-2005
|
||||
|
||||
The fix of line 186 in EasyBMP_BMP4.h file appears to have
|
||||
worked. I applied it through the remainder of the code.
|
||||
Hopefully, this should ensure Visual Studio.Net compati-
|
||||
bility.
|
||||
|
||||
Fixed some typos in the comment lines
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.55
|
||||
Date: 5-2-2005
|
||||
|
||||
Introduced RGBApixel struct.
|
||||
|
||||
Introduced BMFH, BMIH, and BMP classes.
|
||||
|
||||
Deprecated all old code to *_legacy.h.
|
||||
|
||||
Rewrote EasyBMP_VariousBMPutilities.h to use the new
|
||||
BMP class.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.56
|
||||
Date: 5-4-2005
|
||||
|
||||
Made Width, Height, and BitDepth private members and added
|
||||
functions for accessing them.
|
||||
|
||||
Made a new function, SetBitDepth, as the only means to
|
||||
change the bit depth. It will create/resize a palette as
|
||||
necessary. This simplifies the WriteToFile code, as well as
|
||||
any palette altering algorithms. (All algorithms can now
|
||||
assume that a properly-sized palette exists.) This will
|
||||
help improve code stability greatly.
|
||||
|
||||
Made a new function, SetSize, as the only way to change the
|
||||
width and height of the image.
|
||||
|
||||
Eliminated useless HasPalette and NumberOfColors members,
|
||||
and added TellNumberOfColors() function.
|
||||
|
||||
Updated EasyBMP_VariousBMPutilities.h to respect privacy
|
||||
of data members.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.57
|
||||
Date: 5-8-2005
|
||||
|
||||
Removed fclose(fp) lines from EasyBMP_BMP.h and
|
||||
EasyBMP_VariousBMPutilities.h whenever ( !fp ) occurs,
|
||||
to avoid a crash when trying to close a non-existant file.
|
||||
|
||||
|
||||
Added a line to set bmfh.bfType = 0; to getBMFH() routine
|
||||
in the case where ( !fp ) occurs, so that a nonexistant file
|
||||
doesn't falsely show up as a bitmap file.
|
||||
|
||||
Made error messages in BMP::ReadFromFile(char*) more meaningful,
|
||||
since Argh! doesn't help much. :-)
|
||||
|
||||
Made ReadFromFile operations safer: can deal more effectively
|
||||
with corrupted and/or truncated files by adding the new
|
||||
SafeFread() wrapper function.
|
||||
|
||||
Moved all change-log entries to the change log to make the source
|
||||
file tidier.
|
||||
|
||||
Removed all references to Palettes; renamed them to ColorTables.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.58
|
||||
Date: 5-13-2005
|
||||
|
||||
Rewrote ReadFromFile() to fix program crashes on reading 4-bit
|
||||
files. (*grumble* I can't believe there was such a bug in such
|
||||
a late version! */grumble*)
|
||||
|
||||
Added support to ReadFromFile() for reading 1-bit files.
|
||||
|
||||
Rewrote ReadFromFile() to avoid trying to read bitmap files of
|
||||
depths other than 1, 4, 8, 24, and 32 bits.
|
||||
|
||||
Tested reading 4-bit files of width 0,1,2, and 3 (modulo 4),
|
||||
and 1-bit files of width 0,1,2,3,4,5,6, and 7 (modulo 8)
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.59
|
||||
Date: 5-15-2005
|
||||
|
||||
Made ReadFromFile() more robust. Evidently, reading to the
|
||||
same temp variable all the time made it unstable when reading
|
||||
many files. I would never have guessed. I instead declare BMIH
|
||||
and BMFH objects and read directly to their members. This appears
|
||||
to be more stable when dealing with many ReadFromFile() calls.
|
||||
|
||||
On a related note, made sure to not call SetSize( Width,Height),
|
||||
which is a bit recursive, as well as SetBitDepth( BitDepth ).
|
||||
This appears to help stability, since these two functions were
|
||||
create precisely for the purpose of setting those variables
|
||||
values safely.
|
||||
|
||||
Made use of the boolean return value in SafeFread() to detect
|
||||
when files are obviously corrupted. Used this to have an early
|
||||
catch in ReadFromFile() and set it to a 1x1 1-bit image and
|
||||
exit.
|
||||
|
||||
Made ReadFromFile() stricter, in that it only reads recognized
|
||||
bit depths (1,4,8,24,32). Any other bit depth will prompt the
|
||||
routine to terminate and set it to a 1x1 1-bit file.
|
||||
|
||||
Added write support for 1-bit files.
|
||||
|
||||
Rewrote WriteToFile() for 4,8-bit files to match methods used
|
||||
for reading them.
|
||||
|
||||
Revised CreateStandardColorTable() and
|
||||
CreateGreyscaleColorTable() to add support for 1-bit files.
|
||||
|
||||
Rewrote WriteToFile() to be stricter in only writing known bit
|
||||
depths (1,4,8,24,32) and ignoring all others.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.60
|
||||
Date: 5-21-2005
|
||||
|
||||
Deprecated *_legacy.h files.
|
||||
|
||||
Tested library extensivey in linux with good results.
|
||||
|
||||
Made CreateGreyscaleColorTable() stricter, in that it exits
|
||||
if supplied a bit depth other than 1, 4, or 8.
|
||||
|
||||
Made cosmetic changes in EasyBMP_DataStructures.h to
|
||||
improve readability.
|
||||
|
||||
Made SetBitDepth() stricter, in that it will never allow a bitmap
|
||||
to be set to an unsupported bit depth. Only bit depths of 1, 4,
|
||||
8, 24, or 32 are accepted.
|
||||
|
||||
Made SetSize() stricter, in that it will not allow negative
|
||||
widths or heights.
|
||||
|
||||
Made cosmetic changes in EasyBMP_BMP.h to improve readability.
|
||||
|
||||
Added a check in ReadFromFile() to see if the requested width or
|
||||
height is negative, a good sign of file corruption. In such a
|
||||
case, the file is set to a blank 1x1 1-bit file.
|
||||
|
||||
Added code to ReadFromFile() to set size to 1x1 and bit depth to
|
||||
1-bit if the file was not found.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.61
|
||||
Date: 5-22-2005
|
||||
|
||||
Fixed awIndex typo in WriteToFile().
|
||||
|
||||
Replaced double BestDistance comparisons in WriteToFile()
|
||||
with int BestDistances (so as to do integer operations,
|
||||
rather than double operations). This gave a roughly 100%
|
||||
speedup in 8-bit, 4-bit, and 1-bit write operations on
|
||||
unoptimized (no compiler flags) code and a 30% speedup
|
||||
on optimized code.
|
||||
|
||||
Removed checks like if( BestDistance < 1 ){ k=256; } .. from
|
||||
WriteToFile(), as they give more overhead than savings in my
|
||||
testing. For 8-bit files, there was a slight gain by putting
|
||||
it back in with another method:
|
||||
while( k < 256 && BestDistance > 0 ).
|
||||
|
||||
Redefined StepSize in CreateGreyscaleColorTable() to give a
|
||||
better range of greys in 4-bit mode. As it was, white was not
|
||||
in the color table. (Colors were spaced by 256/16 = 16). Now,
|
||||
colors are spaced by (255-1)/(16-1) = 17, which gives the full
|
||||
range.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.62
|
||||
Date: 5-25-2005
|
||||
|
||||
Added endianess check function IsBigEndian() to
|
||||
EasyBMP_DataStructures.h file.
|
||||
|
||||
Added functions to swap bytes in WORD and DWORD multibyte
|
||||
variables to EasyBMP_DataStructures.h file for future big-endian
|
||||
support.
|
||||
|
||||
Added functions to switch endianess to BMFH and BMIH objects
|
||||
to EasyBMP_DataStructures.h file.
|
||||
|
||||
Added endianess checks to ReadFromFile() and WriteToFile()
|
||||
functions in EasyBMP_BMP.h file, along with endianess conversions
|
||||
where necessary.
|
||||
|
||||
Added endianess checks and conversions to GetBMFH() and GetBMIH()
|
||||
functions in EasyBMP_VariousBMPutilities.h file.
|
||||
|
||||
Rewrote GetBitmapInfo() function to use GetBMFH() and GetBMIH()
|
||||
functions instead. (In EasyBMP_VariousBMPutilities.h.) This
|
||||
cuts down on the redundancy in the code.
|
||||
|
||||
Renamed GetBitmapInfo() to DisplayBitmapInfo() in the
|
||||
EasyBMP_VariousBMPutilities.h file.
|
||||
|
||||
With these changes, big-endian architectures should be supported,
|
||||
including IBM PowerPC, Sun Sparc, Motorola 86k, etc., and
|
||||
including Mac OSX.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.63
|
||||
Date: 7-20-2005
|
||||
|
||||
Added IntPow(int,int) function to help compiling with std
|
||||
namespace. Besides, integer operations are faster and more
|
||||
accurate.
|
||||
|
||||
Moved Square(double), IntSquare(int), and IntPow(int,int) to
|
||||
EasyBMP_DataStructures.h
|
||||
|
||||
Simplified and cleaned up code in
|
||||
Create4bitColorTable( RGBApixel**).
|
||||
|
||||
Changed safety check in BMP.ReadFromFile(char*) to set size to
|
||||
1 x 1 if width or height is non-positive, rather than simply
|
||||
negative.
|
||||
|
||||
Added bounds checking to BMP.operator()(int,int) to automatically
|
||||
truncate requested pixel if out of bounds. Also added a warning
|
||||
to cue the user in. :-)
|
||||
|
||||
Made error messages more consistent in format.
|
||||
|
||||
Simplified and cleaned up code in
|
||||
Create4bitColorTable( RGBApixel**).
|
||||
|
||||
Added #include <iostream.h> to EasyBMP.h, since EasyBMP uses
|
||||
cout, etc.
|
||||
|
||||
Simplified and cleaned up code in
|
||||
Create1bitColorTable( RGBApixel**).
|
||||
|
||||
Changed BMP.SetSize(int,int) to disallow non-positive widths and
|
||||
heights, rather than simply negative widths and heights. Such
|
||||
function calls are now ignored.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.64
|
||||
Date: 8-2-2005
|
||||
|
||||
Changed "include <iostream.h>" to "include <iostream>" for
|
||||
ANSI-C++ compliance, as well as for better compatibility with the
|
||||
std namespace and VC++. (Thanks, Tommy Li!)
|
||||
|
||||
Added some #ifndef pragmas to each header so that it should be
|
||||
fine to incluce EasyBMP.h in multiple files in larger projects.
|
||||
|
||||
Added "using namespace std" inside any function that used C++
|
||||
math or I/O operations. I avoided putting "using namespace std"
|
||||
anywhere with global scope for maximum compatibility with C++
|
||||
software in the wild.
|
||||
|
||||
Added includes for <cmath> and <cstdio> to EasyBMP.h
|
||||
|
||||
Removed unused temporary variables (TempWORD and TempDWORD) from
|
||||
EasyBMP_BMP.h for cleaner compiling. If I see any more such
|
||||
unused variables, I'll remove them, too.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.65
|
||||
Date: 8-13-2005
|
||||
|
||||
Moved implementations of BMP::BMP(), BMP::~BMP(), and
|
||||
BMP::operator()(int,int) outside of the class. This should help
|
||||
for eventually moving everything into a separate cpp file.
|
||||
|
||||
Made RGBApixel** Pixels a private data member of the class
|
||||
BMP.
|
||||
|
||||
Added function void BMP::SetColor(int,RGBApixel) to BMP class
|
||||
to allow safe method of changing a color in the color table.
|
||||
|
||||
Added function RGBApixel BMP::GetColor(int) to BMP class
|
||||
to allow safe method of retrieving a color in the color
|
||||
table.
|
||||
|
||||
Cleaned up error messages in EasyBMP_BMP.h
|
||||
|
||||
Cleaned up error messages in EasyBMP_VariousBMPutilities.h
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.66
|
||||
Date: 8-18-2005
|
||||
|
||||
EasyBMP_StandardColorTables.h was removed from the library.
|
||||
|
||||
CreateStandardColorTable(RGBApixel**,int) was changed to
|
||||
CreateStandardColorTable() and made a member function of BMP.
|
||||
All other CreateStandardColorTable functions are now unnecessary
|
||||
and have been removed.
|
||||
|
||||
CreateGreyscaleColorTable(RGBApixel**,int) was changed to
|
||||
CreateStandardColorTable( BMP& ) and moved to
|
||||
EasyBMP_VariousBMPutilities.h.
|
||||
|
||||
RGBApixel* Colors was made a private data member of the BMP
|
||||
class.
|
||||
|
||||
CreateGreyscaleColorTable( BMP& ) was renamed to
|
||||
CreateGrayscaleColorTable( BMP& ).
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.67
|
||||
Date: 9-14-2005
|
||||
|
||||
Made the EasyBMP custom math functions in
|
||||
EasyBMP_DataStructures.h inline. (Square,IntSquare,IntPow).
|
||||
This should make those function calls faster while improving
|
||||
compatibility with compiling DLL's.
|
||||
|
||||
Separated the code from SafeFread() in EasyBMP_BMP.h to
|
||||
improve compatibility with compiling DLL's.
|
||||
|
||||
Removed #define _WINGDI_H from EasyBMP_DataStructures.h to
|
||||
improve compatibility with win32 applications. Instead,
|
||||
there's an extra #ifndef _SELF_DEFINED_BMP_DATA_TYPES
|
||||
conditional added.
|
||||
|
||||
_SELF_DEFINED_BMP_DATA_TYPES renamed to _SELF_DEFINED_WINGDI
|
||||
in EasyBMP_DataStructures.h.
|
||||
|
||||
All bit-flipping functions (IsBigEndian, FlipWORD,
|
||||
FlipDWORD) in EasyBMP_DataStructures.h were made inline
|
||||
to improve execution speed and improve compatibility with
|
||||
compiling DLL's.
|
||||
|
||||
All code was separated from function declarations in
|
||||
EasyBMP_VariousBMPutilities.h to improve compatibility
|
||||
with compiling DLL's.
|
||||
|
||||
Updated and cleaned up layout of EasyBMP_ChangeLog.txt.
|
||||
|
||||
Updated contact and support information in library files.
|
||||
|
||||
Corrected the LGPL license version.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.68
|
||||
Date: 10-9-2005
|
||||
|
||||
Changed references to FILE to std::FILE in the SafeFread function
|
||||
in EasyBMP_BMP.h to improve compatibility with Borland's compiler.
|
||||
|
||||
Removed a few assignments in EasyBMP_BMP.h that weren't used to
|
||||
improve efficiency and reduce Borland warnings.
|
||||
|
||||
Changed calls like NotCorrupted = SafeFread() to
|
||||
NotCorrupted &= SafeFread() in BMP::ReadFromFile() in EasyBMP_BMP.h
|
||||
to improve robustness. Now, if the NotCorrupted bit is ever set
|
||||
to false, it stays false, meaning that the function won't "forget"
|
||||
that it encountered file corruption.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.69
|
||||
Date: 10-19-2005
|
||||
|
||||
Changed BMP::WriteToFile( char* ) to BMP::WriteToFile(const char*)
|
||||
in EasyBMP_BMP.h to respond to a feature request.
|
||||
|
||||
Changed BMP::ReadFromFile( char* ) to BMP::ReadToFile(const char*)
|
||||
in EasyBMP_BMP.h to respond to a feature request.
|
||||
|
||||
Made BMP::ReadFromFile() and BMP::WriteToFile() in EasyBMP_BMP.h
|
||||
return true/false to indicate success/failure in the operations.
|
||||
These functions previously returned void.
|
||||
|
||||
Made BMP::SetSize() and BMP::SetBitDepth() in EasyBMP_BMP.h
|
||||
return true/false to indicate success/failure in the operations.
|
||||
These functions previously returned void.
|
||||
|
||||
Made BMP::SetColor() and BMP::CreateStandardColorTable() in
|
||||
EasyBMP_BMP.h return true/false to indicate success/failure in the
|
||||
operations. These functions previously returned void.
|
||||
|
||||
Made CreateGrayscaleColorTable() in EasyBMP_VariousBMPutilities.h
|
||||
return true/false to indicate success/failure in the operations.
|
||||
This function previously returned void.
|
||||
|
||||
Changed the char* argument GetBMFH( char* ), GetBMIH( char* ),
|
||||
DisplayBitmapInfo( char* ), and GetBitmapColorDepth( char* ) in
|
||||
EasyBMP_VariousBMPutilities.h to const char* for cleaner, safer
|
||||
programming.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.70
|
||||
Date: 10-19-2005
|
||||
|
||||
Found and fixed error in BMP::ReadFromFile() in the check for only
|
||||
reading support bit depths.
|
||||
|
||||
Changed license from LGPL to BSD (revised/modified) to simplify
|
||||
licensing issues and resolve any lingering licensing questions.
|
||||
|
||||
Fixed compiler error when using MSVC++.
|
||||
|
||||
Improved fix to allow compiling with Borland without breaking
|
||||
Borland support.
|
||||
|
||||
Added a few lines to EasyBMP.h to make it easier to tailor code
|
||||
to specific compilers. (For future use as needed.)
|
||||
|
||||
Added a few lines to EasyBMP_BMP.h (in BMP::ReadFromFile(),
|
||||
BMP::WriteToFile(), and BMP::SetBitDepth()) to eventually add
|
||||
support for 16-bit files.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 0.71
|
||||
Date: 11-01-2005
|
||||
|
||||
Cleaned up comments in BMP::ReadFromFile() in EasyBMP_BMP.h
|
||||
|
||||
Added endian-safe read support for 16-bit files that are in the
|
||||
standard 5-5-5 format (not specified in bit fields)
|
||||
|
||||
Added endian-safe read support for 16-bit files that use bit
|
||||
fields, including 5-6-5 files.
|
||||
|
||||
Added endian-safe write support for 16-bit files. Uses the 5-6-5
|
||||
encoding scheme to maximize the utility of the bits used.
|
||||
|
||||
Added a check for compression in BMP::ReadFromFile(). Because
|
||||
file compression is beyond the scope of EasyBMP, such files are
|
||||
not supported, and EasyBMP now properly detects these situations
|
||||
and exits with an error.
|
||||
|
||||
Added a check for files that attempt to use bit fields but are not
|
||||
16-bit files to BMP::ReadFromFile(). Such files are not supported.
|
||||
|
||||
Added a check to BMP::ReadFromFile() for files that use unknown
|
||||
values of bmih.biCompression, such as old OS2 bitmaps. Such files
|
||||
are not supported.
|
||||
|
||||
Removed "switching endianness" messages from EasyBMP_BMP.h
|
||||
|
||||
Added support for indexed (1, 4, and 8-bit) files that don't
|
||||
specify all the colors.
|
||||
|
||||
Added support for reading files that include extra meta data before
|
||||
the pixels. This data is skipped.
|
||||
|
||||
Added enclosing #ifndef EasyBMP ... lines to EasyBMP.h as a
|
||||
further safeguard when EasyBMP is included in multiple cpp
|
||||
files.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 1.00
|
||||
Date: 02-06-2006
|
||||
|
||||
First Production/Stable release.
|
||||
|
||||
Corrected typographical errors in the comment sections of all
|
||||
files.
|
||||
|
||||
Updated copyright on all files.
|
||||
|
||||
Removed extraneous comment in BMIH::BMIH() function in
|
||||
EasyBMP_DataStructures.h file.
|
||||
|
||||
Replaced instances of \n with the more modern endl in
|
||||
EasyBMP_DataStructures.h, EasyBMP_BMP.h, and
|
||||
EasyBMP_VariousBMPutilities.h.
|
||||
|
||||
Added placeholder MetaData1 and MetaData2 data members to the
|
||||
BMP class for potential future use.
|
||||
|
||||
Removed extraneous comments from EasyBMP_BMP.h.
|
||||
|
||||
Removed warning messages for switching endianness from
|
||||
EasyBMP_VariousBMPutilities.h.
|
||||
|
||||
Updated copyright in EasyBMP_ChangeLog.txt file.
|
||||
|
||||
Fixed formatting issues in EasyBMP_ChangeLog.txt file.
|
||||
|
||||
Added DefaultXpelsPerMeter and DefaultYpelsPerMeter in
|
||||
EasyBMP.h. These will default to 96 dpi.
|
||||
|
||||
Changed BMP::WriteToFile() to use DefaultXpelsPerMeter and
|
||||
DefaultYpelsPerMeter when writing the BMIH structure.
|
||||
|
||||
Added XpelsPerMeter and YpelsPerMeter data members to BMP
|
||||
class so that horizontal and vertical resolution are handled
|
||||
properly. Currently, upon reading a file, the stated resolutions
|
||||
are preserved, and upon writing, if no resolutions are given,
|
||||
the defaults (of 96 DPI) are used.
|
||||
|
||||
Added function void BMP::SetDPI(int,int) to set the horizontal
|
||||
and vertical resolutions.
|
||||
|
||||
Removed some unnecessary code from GetBitmapColorDepth() in
|
||||
EasyBMP_VariousBMPutilities.h.
|
||||
|
||||
Fixed a bug in RangedPixelToPixelCopyTransparent() and
|
||||
RangedPixelToPixelCopy() in EasyBMP_VariousBMPutilities.h which
|
||||
caused copies to be truncated by an extra row or column in
|
||||
certain circumstances.
|
||||
|
||||
Fixed a bug in RangedPixelToPixelCopyTransparent() and
|
||||
RangedPixelToPixelCopy() in EasyBMP_VariousBMPutilities.h which
|
||||
checked the wrong variable (FromT instead of FromB) to see if
|
||||
it was out of range.
|
||||
|
||||
Added extra checks to RangedPixelToPixelCopyTransparent() and
|
||||
RangedPixelToPixelCopy() in EasyBMP_VariousBMPutilities.h to
|
||||
prevent attempted access of out-of-range pixels.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 1.01
|
||||
Date: 03-31-2006
|
||||
|
||||
Made only the short functions Square, IntSquare, IsBigEndian,
|
||||
FlipWORD, and FlipDWORD inline functions in
|
||||
EasyBMP_DataStructures.h.
|
||||
|
||||
Moved all code (other than inline functions) to EasyBMP.cpp.
|
||||
|
||||
Changed DefaultXPelsPerMeter and DefaultYPelsPerMeter to #define
|
||||
lines in EasyBMP.h to make the library compatible with
|
||||
with the header-code split.
|
||||
|
||||
Removed memory hole in ~BMP() where "delete Colors;" was used
|
||||
instead of "delete [] Colors;". Likewise with MetaData1 and
|
||||
MetaData2.
|
||||
|
||||
Fixed memory leak in BMP::SetBitDepth() by changing to
|
||||
delete [] Colors;
|
||||
|
||||
Removed potential memory leak in BMP::WriteToFile() in 24- and
|
||||
32-bit writing where szTemp wasn't delete at the end of a row.
|
||||
|
||||
Fixed bug where XPelsPerMeter and YPelsPerMeter weren't
|
||||
properly initialized in the BMP::BMP() constructor, leading
|
||||
to strange horizontal and vertical resolutions.
|
||||
|
||||
Fixed memory leak in BMP::ReadFromFile() where TempSkipBYTE
|
||||
wasn't deleted.
|
||||
|
||||
Fixed memory leak in BMP::ReadFromFile() where szTemp wasn't
|
||||
deleted.
|
||||
|
||||
Added BMP::TellVerticalDPI() and BMP::TellHorizontalDPI()
|
||||
functions to give this information. If those values have
|
||||
not yet been set, then they are first set to the EasyBMP
|
||||
defaults of 96 dpi.
|
||||
|
||||
Set uninitialized RGBApixel values to white (255,255,255,0)
|
||||
in a few functions for the BMP class.
|
||||
|
||||
Added a sample cpp application and makefile.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 1.02
|
||||
Date: 05-29-2006
|
||||
|
||||
Inserted a line into EasyBMP.h to suppress the Visual Studio
|
||||
warnings. We'll keep using the C++ standard fopen for now
|
||||
until fopen_s becomes a real standard.
|
||||
|
||||
Moved the code sample and makefile to a subdirectory, so that
|
||||
unzipping EasyBMP#_##.zip into a project directory doesn't
|
||||
overwrite any crucial makefiles.
|
||||
|
||||
Improved SafeFread() to check if the proper amount of data
|
||||
could be read.
|
||||
|
||||
Dramatically cleaned up ReadFromFile() code for 1 and 4
|
||||
bpp files.
|
||||
|
||||
Fixed a typo (draw.o) in the sample makefile.
|
||||
|
||||
Modified ReadFromFile() to use buffering when reading the pixel
|
||||
data. This should substantially improve disk access performance.
|
||||
Only 16 bpp files are read in the old, slower way.
|
||||
|
||||
Changed DWORD from unsigned long to unsigned int. This should
|
||||
fix the issue where 64-bit machines see DWORD as an 8-byte
|
||||
data type, rather than 4 bytes. (Thank you to Bas Wegh!)
|
||||
|
||||
Renamed BYTE, WORD, and DWORD data types to ebmpBYTE, ebmpWORD,
|
||||
and ebmpDWORD to eliminate the possibility of conflict with
|
||||
windows applications, particularly with 64-bit windows, which
|
||||
likely uses 8 byte DWORDS.
|
||||
|
||||
Modified WriteToFile() to use buffering when reading the pixel
|
||||
data. This should substantially improve disk access performance.
|
||||
Only 16 bpp files are read in the old, slower way.
|
||||
|
||||
Added new function, EasyBMPcheckDataSize(), to check that
|
||||
the ebmpBYTE, ebmpWORD, and ebmpDWORD types have the correct
|
||||
type.
|
||||
|
||||
Added some new macros of the EasyBMP version number for easier
|
||||
version checking. New versions include _EasyBMP_Version_
|
||||
(a double), _EasyBMP_Version_String_ (a char* version), and
|
||||
_EasyBMP_Version_Integer_ (an integer version, e.g., 102).
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 1.03
|
||||
Date: 06-20-2006
|
||||
|
||||
Inserted a line into EasyBMP.h to suppress the Visual Studio
|
||||
|
||||
Added a check to BMP.SetColor() to ensure that the color table
|
||||
is defined before attempting to set a color entry.
|
||||
|
||||
Added a check to BMP.GetColor() to ensure that the color table
|
||||
is defined before attempting to retrieve a color entry.
|
||||
|
||||
Simplified the conditional in BMP.WriteToFile() from
|
||||
if( BitDepth == 1 || BitDepth == 4 || ... ) to the simpler
|
||||
if( BitDepth != 16 ).
|
||||
|
||||
Removed the old, unused code for writing 1- and 4-bit files
|
||||
from BMP.WriteToFile().
|
||||
|
||||
Removed the line Colors = new RGBApixel [NumberOfColors]; in
|
||||
BMP.ReadFromFile(). This operation is already covered by the
|
||||
earlier SetBitDepth() call, and may contribute to a memory
|
||||
leak. Furthermore, for files that had fewer than expected
|
||||
number of colors (e.g., an 8-bit file with 236 colors), it
|
||||
lead to memory access errors in BMP.GetColor() and BMP.SetColor().
|
||||
(In fact, this is the main motivation for release 1.03.)
|
||||
|
||||
Added a warning when BMP.ReadFromFile() encounters an under-
|
||||
specified color table, and code to pad the table with white
|
||||
entries.
|
||||
|
||||
Added screen output on EasyBMP version and project website to
|
||||
the code sample.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 1.04
|
||||
Date: 07-22-2006
|
||||
|
||||
Removed the assignment to the integer i in IntPow() to eliminate a
|
||||
Borland compiler warning.
|
||||
|
||||
Removed the assignment to the integer i in the Read##bitRow()
|
||||
functions to eliminate Borland compiler warnings.
|
||||
|
||||
Removed the assignment to ZeroWORD in line 478 of EasyBMP.cpp in
|
||||
BMP::WriteToFile() to eliminate Borland compiler warnings.
|
||||
|
||||
Removed the assignment to ZeroWORD in line 825 of EasyBMP.cpp in
|
||||
BMP::ReadFromFile() to eliminate Borland compiler warnings.
|
||||
|
||||
The Borland warnings about conditions always being false are
|
||||
incorrect. (Lines 1587, 1594, and 1601.) Likewise, the Borland
|
||||
warnings about unreachable code (lines 1589, 1596, and 1603) are
|
||||
incorrect. This code serves as a protection on unexpected hardware
|
||||
where the data types may not be of the correct size, and helps to
|
||||
future-proof EasyBMP. The first time this type of error was
|
||||
encountered was on 64-bit CPUs, where the size of the DWORD was
|
||||
larger than assumed when writing EasyBMP. Therefore, we will not
|
||||
"correct" these "errors" detected by Borland. If they bother you,
|
||||
compile with the -w-8008 and -w-8066 options.
|
||||
|
||||
Borland issues warnings about argc and argv being unused in the
|
||||
sample project. These are silly warnings and will be ignored. If
|
||||
this warning bothers you, compile with the -w-8057 option.
|
||||
|
||||
Modified the sample makefile so that EasyBMP.o depends upon
|
||||
EasyBMP.cpp and EasyBMP*.h in the current working directory, rather
|
||||
than the parent directory.
|
||||
|
||||
Added a global EasyBMPwarnings boolean variable, and functions
|
||||
SetEasyBMPwarningsOn() and SetEasyBMPwarningsOff() to enable and
|
||||
disable EasyBMP warnings and errors. Note that this will not
|
||||
disable error checking or any other EasyBMP behavior, other than
|
||||
cout output of the warning and error messages.
|
||||
|
||||
Added the function GetEasyBMPwarningState() to query the EasyBMP
|
||||
warning state. (Either warnings are enabled or disabled.)
|
||||
|
||||
Removed old commented code (Write1bitRow()) from EasyBMP.cpp.
|
||||
|
||||
Replaced the 24-bit EasyBMPbackground.bmp image in the code sample
|
||||
with a dithered 8-bit version to reduce the download size of the
|
||||
core library.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 1.05
|
||||
Date: 11-01-2006
|
||||
|
||||
Renamed BytesRead to ItemsRead in the SafeFread() function in
|
||||
EasyBMP.cpp for greater clarity.
|
||||
|
||||
Added a copy constructor to the BMP class. However, note that
|
||||
passing by value is not recommended practice. (Passing by refer-
|
||||
ence is much faster, and consumes less memory.)
|
||||
|
||||
Added a new function:
|
||||
bool Rescale( BMP& InputImage, char mode, int NewDimension );
|
||||
to resize an image. The mode variables are as follows:
|
||||
'P': resizes the image to a new percentage of the old size,
|
||||
e.g., 42%, 13%, etc.
|
||||
example: Rescale( SomeImage, 'p', 42 );
|
||||
'W': resizes the image such that the new width is as specified.
|
||||
example: Rescale( SomeImage, 'W', 100 );
|
||||
'H': resizes the image such that the new height is as specified.
|
||||
example: Rescale( SomeImage, 'H', 100 );
|
||||
'F': resizes the image to fit in a square of specified size.
|
||||
example: Rescale( SomeImage, 'F', 100 ); // fits in 100x100
|
||||
// box
|
||||
All rescaling is done with bilinear interpolation.
|
||||
|
||||
*--------------------------------------------------------------------*
|
||||
|
||||
Version: 1.06
|
||||
Date: 12-01-2006
|
||||
|
||||
Added includes for <cctype> and <cstring> to EasyBMP.h. These are
|
||||
used and should have been included all along. This should help
|
||||
with Intel icc compiling.
|
||||
|
||||
Fixed the && bug in the copy constructor. (Thank you to user
|
||||
fcnature!)
|
||||
|
||||
Added image scaling to the supplied code sample.
|
||||
|
||||
Added GetPixle() and SetPixel() functions for future use. These
|
||||
will be added to enable more careful use of the const keyword.
|
||||
|
||||
*--------------------------------------------------------------------*
|
104
Source/BWEM/EasyBMP_1.06/EasyBMP_DataStructures.h
Normal file
|
@ -0,0 +1,104 @@
|
|||
/*************************************************
|
||||
* *
|
||||
* EasyBMP Cross-Platform Windows Bitmap Library *
|
||||
* *
|
||||
* Author: Paul Macklin *
|
||||
* email: macklin01@users.sourceforge.net *
|
||||
* support: http://easybmp.sourceforge.net *
|
||||
* *
|
||||
* file: EasyBMP_DataStructures.h *
|
||||
* date added: 05-02-2005 *
|
||||
* date modified: 12-01-2006 *
|
||||
* version: 1.06 *
|
||||
* *
|
||||
* License: BSD (revised/modified) *
|
||||
* Copyright: 2005-6 by the EasyBMP Project *
|
||||
* *
|
||||
* description: Defines basic data structures for *
|
||||
* the BMP class *
|
||||
* *
|
||||
*************************************************/
|
||||
|
||||
#ifndef _EasyBMP_Custom_Math_Functions_
|
||||
#define _EasyBMP_Custom_Math_Functions_
|
||||
inline double Square( double number )
|
||||
{ return number*number; }
|
||||
|
||||
inline int IntSquare( int number )
|
||||
{ return number*number; }
|
||||
#endif
|
||||
|
||||
int IntPow( int base, int exponent );
|
||||
|
||||
#ifndef _EasyBMP_Defined_WINGDI
|
||||
#define _EasyBMP_Defined_WINGDI
|
||||
typedef unsigned char ebmpBYTE;
|
||||
typedef unsigned short ebmpWORD;
|
||||
typedef unsigned int ebmpDWORD;
|
||||
#endif
|
||||
|
||||
#ifndef _EasyBMP_DataStructures_h_
|
||||
#define _EasyBMP_DataStructures_h_
|
||||
|
||||
inline bool IsBigEndian()
|
||||
{
|
||||
short word = 0x0001;
|
||||
if((*(char *)& word) != 0x01 )
|
||||
{ return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
inline ebmpWORD FlipWORD( ebmpWORD in )
|
||||
{ return ( (in >> 8) | (in << 8) ); }
|
||||
|
||||
inline ebmpDWORD FlipDWORD( ebmpDWORD in )
|
||||
{
|
||||
return ( ((in&0xFF000000)>>24) | ((in&0x000000FF)<<24) |
|
||||
((in&0x00FF0000)>>8 ) | ((in&0x0000FF00)<<8 ) );
|
||||
}
|
||||
|
||||
// it's easier to use a struct than a class
|
||||
// because we can read/write all four of the bytes
|
||||
// at once (as we can count on them being continuous
|
||||
// in memory
|
||||
|
||||
typedef struct RGBApixel {
|
||||
ebmpBYTE Blue;
|
||||
ebmpBYTE Green;
|
||||
ebmpBYTE Red;
|
||||
ebmpBYTE Alpha;
|
||||
} RGBApixel;
|
||||
|
||||
class BMFH{
|
||||
public:
|
||||
ebmpWORD bfType;
|
||||
ebmpDWORD bfSize;
|
||||
ebmpWORD bfReserved1;
|
||||
ebmpWORD bfReserved2;
|
||||
ebmpDWORD bfOffBits;
|
||||
|
||||
BMFH();
|
||||
void display( void );
|
||||
void SwitchEndianess( void );
|
||||
};
|
||||
|
||||
class BMIH{
|
||||
public:
|
||||
ebmpDWORD biSize;
|
||||
ebmpDWORD biWidth;
|
||||
ebmpDWORD biHeight;
|
||||
ebmpWORD biPlanes;
|
||||
ebmpWORD biBitCount;
|
||||
ebmpDWORD biCompression;
|
||||
ebmpDWORD biSizeImage;
|
||||
ebmpDWORD biXPelsPerMeter;
|
||||
ebmpDWORD biYPelsPerMeter;
|
||||
ebmpDWORD biClrUsed;
|
||||
ebmpDWORD biClrImportant;
|
||||
|
||||
BMIH();
|
||||
void display( void );
|
||||
void SwitchEndianess( void );
|
||||
};
|
||||
|
||||
#endif
|
BIN
Source/BWEM/EasyBMP_1.06/EasyBMP_UserManual.pdf
Normal file
43
Source/BWEM/EasyBMP_1.06/EasyBMP_VariousBMPutilities.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*************************************************
|
||||
* *
|
||||
* EasyBMP Cross-Platform Windows Bitmap Library *
|
||||
* *
|
||||
* Author: Paul Macklin *
|
||||
* email: macklin01@users.sourceforge.net *
|
||||
* support: http://easybmp.sourceforge.net *
|
||||
* *
|
||||
* file: EasyBMP_VariousBMPutilities.h *
|
||||
* date added: 05-02-2005 *
|
||||
* date modified: 12-01-2006 *
|
||||
* version: 1.06 *
|
||||
* *
|
||||
* License: BSD (revised/modified) *
|
||||
* Copyright: 2005-6 by the EasyBMP Project *
|
||||
* *
|
||||
* description: Various utilities. *
|
||||
* *
|
||||
*************************************************/
|
||||
|
||||
#ifndef _EasyBMP_VariousBMPutilities_h_
|
||||
#define _EasyBMP_VariousBMPutilities_h_
|
||||
|
||||
BMFH GetBMFH( const char* szFileNameIn );
|
||||
BMIH GetBMIH( const char* szFileNameIn );
|
||||
void DisplayBitmapInfo( const char* szFileNameIn );
|
||||
int GetBitmapColorDepth( const char* szFileNameIn );
|
||||
void PixelToPixelCopy( BMP& From, int FromX, int FromY,
|
||||
BMP& To, int ToX, int ToY);
|
||||
void PixelToPixelCopyTransparent( BMP& From, int FromX, int FromY,
|
||||
BMP& To, int ToX, int ToY,
|
||||
RGBApixel& Transparent );
|
||||
void RangedPixelToPixelCopy( BMP& From, int FromL , int FromR, int FromB, int FromT,
|
||||
BMP& To, int ToX, int ToY );
|
||||
void RangedPixelToPixelCopyTransparent(
|
||||
BMP& From, int FromL , int FromR, int FromB, int FromT,
|
||||
BMP& To, int ToX, int ToY ,
|
||||
RGBApixel& Transparent );
|
||||
bool CreateGrayscaleColorTable( BMP& InputImage );
|
||||
|
||||
bool Rescale( BMP& InputImage , char mode, int NewDimension );
|
||||
|
||||
#endif
|
BIN
Source/BWEM/EasyBMP_1.06/sample/EasyBMPbackground.bmp
Normal file
After Width: | Height: | Size: 301 KiB |
82
Source/BWEM/EasyBMP_1.06/sample/EasyBMPsample.cpp
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*************************************************
|
||||
* *
|
||||
* EasyBMP Cross-Platform Windows Bitmap Library *
|
||||
* *
|
||||
* Author: Paul Macklin *
|
||||
* email: macklin01@users.sourceforge.net *
|
||||
* support: http://easybmp.sourceforge.net *
|
||||
* *
|
||||
* file: EasyBMPsample.cpp *
|
||||
* date added: 03-31-2006 *
|
||||
* date modified: 12-01-2006 *
|
||||
* version: 1.06 *
|
||||
* *
|
||||
* License: BSD (revised/modified) *
|
||||
* Copyright: 2005-6 by the EasyBMP Project *
|
||||
* *
|
||||
* description: Sample application to demonstrate *
|
||||
* some functions and capabilities *
|
||||
* *
|
||||
*************************************************/
|
||||
|
||||
#include "EasyBMP.h"
|
||||
using namespace std;
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
cout << endl
|
||||
<< "Using EasyBMP Version " << _EasyBMP_Version_ << endl << endl
|
||||
<< "Copyright (c) by the EasyBMP Project 2005-6" << endl
|
||||
<< "WWW: http://easybmp.sourceforge.net" << endl << endl;
|
||||
|
||||
BMP Text;
|
||||
Text.ReadFromFile("EasyBMPtext.bmp");
|
||||
|
||||
BMP Background;
|
||||
Background.ReadFromFile("EasyBMPbackground.bmp");
|
||||
|
||||
BMP Output;
|
||||
Output.SetSize( Background.TellWidth() , Background.TellHeight() );
|
||||
Output.SetBitDepth( 24 );
|
||||
|
||||
RangedPixelToPixelCopy( Background, 0, Output.TellWidth()-1,
|
||||
Output.TellHeight()-1 , 0,
|
||||
Output, 0,0 );
|
||||
|
||||
RangedPixelToPixelCopyTransparent( Text, 0, 380,
|
||||
43, 0,
|
||||
Output, 110,5,
|
||||
*Text(0,0) );
|
||||
|
||||
RangedPixelToPixelCopyTransparent( Text, 0, Text.TellWidth()-1,
|
||||
Text.TellWidth()-1, 50,
|
||||
Output, 100,442,
|
||||
*Text(0,49) );
|
||||
|
||||
Output.SetBitDepth( 32 );
|
||||
cout << "writing 32bpp ... " << endl;
|
||||
Output.WriteToFile( "EasyBMPoutput32bpp.bmp" );
|
||||
|
||||
Output.SetBitDepth( 24 );
|
||||
cout << "writing 24bpp ... " << endl;
|
||||
Output.WriteToFile( "EasyBMPoutput24bpp.bmp" );
|
||||
|
||||
Output.SetBitDepth( 8 );
|
||||
cout << "writing 8bpp ... " << endl;
|
||||
Output.WriteToFile( "EasyBMPoutput8bpp.bmp" );
|
||||
|
||||
Output.SetBitDepth( 4 );
|
||||
cout << "writing 4bpp ... " << endl;
|
||||
Output.WriteToFile( "EasyBMPoutput4bpp.bmp" );
|
||||
|
||||
Output.SetBitDepth( 1 );
|
||||
cout << "writing 1bpp ... " << endl;
|
||||
Output.WriteToFile( "EasyBMPoutput1bpp.bmp" );
|
||||
|
||||
Output.SetBitDepth( 24 );
|
||||
Rescale( Output, 'p' , 50 );
|
||||
cout << "writing 24bpp scaled image ..." << endl;
|
||||
Output.WriteToFile( "EasyBMPoutput24bpp_rescaled.bmp" );
|
||||
|
||||
return 0;
|
||||
}
|
BIN
Source/BWEM/EasyBMP_1.06/sample/EasyBMPtext.bmp
Normal file
After Width: | Height: | Size: 111 KiB |
53
Source/BWEM/EasyBMP_1.06/sample/makefile
Normal file
|
@ -0,0 +1,53 @@
|
|||
#
|
||||
# EasyBMP Cross-Platform Windows Bitmap Library
|
||||
#
|
||||
# Author: Paul Macklin
|
||||
# email: macklin01@users.sourceforge.net
|
||||
# support: http://easybmp.sourceforge.net
|
||||
# file: makefile
|
||||
# date added: 04-22-2006
|
||||
# date modified: 12-01-2006
|
||||
# version: 1.06
|
||||
#
|
||||
# License: BSD (revised/modified)
|
||||
# Copyright: 2005-6 by the EasyBMP Project
|
||||
#
|
||||
# description: Sample makefile for compiling with
|
||||
# the EasyBMP library. This compiles
|
||||
# the EasyBMPsample.cpp program.
|
||||
#
|
||||
|
||||
CC = g++
|
||||
|
||||
# this line gives compiler optimizations that are geared towards g++ and Pentium4
|
||||
# computers. Comment it out if you don't have a Pentium 4 (or Athlon XP) or up
|
||||
|
||||
# CFLAGS = -O3 -Wno-deprecated -mcpu=pentium4 -march=pentium4 \
|
||||
# -mfpmath=sse -msse -mmmx -msse2 -pipe -fomit-frame-pointer -s
|
||||
|
||||
# Uncomment these two lines to use with any Pentium with MMX or up.
|
||||
|
||||
# CFLAGS = -Wno-deprecated -mcpu=pentium -march=pentium -pipe \
|
||||
# -fomit-frame-pointer -mmmx -funroll-all-loops -s
|
||||
|
||||
# Uncomment these lines for some "safe" optimization flags
|
||||
|
||||
CFLAGS = -O3 -pipe -fomit-frame-pointer -funroll-all-loops -s
|
||||
|
||||
EasyBMPTest: EasyBMP.o EasyBMPsample.o
|
||||
g++ $(CFLAGS) EasyBMP.o EasyBMPsample.o -o EasyBMPtest
|
||||
|
||||
EasyBMP.o: ../EasyBMP.cpp ../EasyBMP*.h
|
||||
cp ../EasyBMP*.h .
|
||||
cp ../EasyBMP.cpp .
|
||||
g++ $(CFLAGS) -c EasyBMP.cpp
|
||||
|
||||
EasyBMPsample.o: EasyBMPsample.cpp
|
||||
g++ -c EasyBMPsample.cpp
|
||||
|
||||
clean:
|
||||
rm EasyBMP*.h
|
||||
rm EasyBMP.cpp
|
||||
rm EasyBMPtest*
|
||||
rm EasyBMPoutput*.bmp
|
||||
rm -f *.o
|
21
Source/BWEM/LICENSE.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
// (MIT/X11 License)
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
// - The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
// - The Software is provided "as is", without warranty of any kind, express
|
||||
// or implied, including but not limited to the warranties of merchantability,
|
||||
// fitness for a particular purpose and noninfringement. In no event shall the
|
||||
// authors or copyright holders be liable for any claim, damages or
|
||||
// other liability, whether in an action of contract, tort or otherwise,
|
||||
// arising from, out of or in connection with the software or the use or other
|
||||
// dealings in the Software.
|
||||
// - Except as contained in this notice, the name of the copyright holders
|
||||
// shall not be used in advertising or otherwise to promote the sale, use or
|
||||
// other dealings in this Software without prior written authorization from
|
||||
// the copyright holders.
|
31
Source/BWEM/README.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
README.txt
|
||||
===============================================================================
|
||||
the BWEM library
|
||||
===============================================================================
|
||||
|
||||
|
||||
Brood War Easy Map is a C++ library that analyses Brood War's maps and
|
||||
provides relevant information such as areas, choke points and bases.
|
||||
It is built on top of the BWAPI library (http://bwapi.github.io/index.html).
|
||||
It first aims at simplifying the development of bots for Brood War, but can be used
|
||||
for any task requiring high level map information.
|
||||
It can be used as a replacement for the BWTA2 add-on (https://bitbucket.org/auriarte/bwta2),
|
||||
as it performs faster and shows better robustness while providing similar information.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
License: MIT/X11
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Version: 1.4.1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Sourceforge project: http://sourceforge.net/projects/BWEM
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Online site: http://BWEM.sourceforge.net
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Contact: igor_dimitrijevic@yahoo.fr
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
BIN
Source/BWEM/doc/html/Andromeda.png
Normal file
After Width: | Height: | Size: 166 KiB |
BIN
Source/BWEM/doc/html/Baby Steps.png
Normal file
After Width: | Height: | Size: 223 KiB |
BIN
Source/BWEM/doc/html/Great Barrier Reef.png
Normal file
After Width: | Height: | Size: 155 KiB |
BIN
Source/BWEM/doc/html/Heartbreak Ridge.png
Normal file
After Width: | Height: | Size: 107 KiB |
134
Source/BWEM/doc/html/Iron.html
Normal file
|
@ -0,0 +1,134 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="about page"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : Iron</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>Iron</h1>
|
||||
<IMG SRC="Iron.jpg"/>
|
||||
</center>
|
||||
<P/>
|
||||
Iron is a StarCraft AI based on the BWEM library (same author).
|
||||
<br/>
|
||||
Iron can be seen as an extension of <a href="Stone.html">Stone</a>.
|
||||
<P/>
|
||||
Like Stone:
|
||||
<ul>
|
||||
<li>Iron is Terran bot.
|
||||
<li>Iron is Agent Oriented.
|
||||
<li>Focus has been on individual behaviors: Agents are highly autonomous and versatile.
|
||||
<li>These behaviors have been carefully designed to avoid indecisiveness, one of the most common and frustrating issues of AIs.
|
||||
<li>Iron aims at robustness and doesn't contain any code specific to a particular bot.
|
||||
<li>SCVs play an important role.
|
||||
</ul>
|
||||
<P/>
|
||||
Unlike Stone:
|
||||
<ul>
|
||||
<li>Iron is a complete bot that can deal with most types of threats.
|
||||
<li>Iron can expand.
|
||||
<li>Iron is a hybrid system: alongside the Multi-Agent paradigm, it uses a bunch of global strategies and algorithms.
|
||||
</ul>
|
||||
<P/>
|
||||
Iron competed in the following tournaments:
|
||||
<ul>
|
||||
<li>the <a target="_blank" href="http://sites.google.com/site/starcraftaic/result">IEEE CIG 2016 StarCraft AI Competition</a>.</li>
|
||||
<li>the <a target="_blank" href="http://www.cs.mun.ca/~dchurchill/starcraftaicomp/">AIIDE 2016 StarCraft AI Competition</a>.</li>
|
||||
<li>the <a target="_blank" href="http://sscaitournament.com/index.php?action=2016">SSCAIT 2016 Tournament</a>.</li>
|
||||
</ul>
|
||||
<P/>
|
||||
<P/>
|
||||
Iron is still under developement.
|
||||
<br/>To see its progress, go to <a target="_blank" href="http://sscaitournament.com">SSCAIT Tournament</a>.
|
||||
<P/>
|
||||
<P/>
|
||||
<HR/>
|
||||
<P/>
|
||||
<center>
|
||||
<h2>Iron's FAQ</h2>
|
||||
</center>
|
||||
|
||||
<h3>Why this name?</h3>
|
||||
Iron is <a href="Stone.html">Stone</a>'s successor...
|
||||
|
||||
<h3>How strong is it?</h3>
|
||||
Iron placed 2nd in the <a target="_blank" href="http://sites.google.com/site/starcraftaic/result">IEEE CIG 2016 StarCraft AI Competition</a>,
|
||||
and 1st in the <a target="_blank" href="http://www.cs.mun.ca/~dchurchill/starcraftaicomp/">AIIDE 2016 StarCraft AI Competition</a>,
|
||||
making it one of the strongest StarCraft bots.
|
||||
|
||||
<h3>What is Iron's style of play?</h3>
|
||||
Like its father <a href="Stone.html">Stone</a>, Iron used to be a pure conservative bot. This comes from how each unit normally behave.
|
||||
<br/>
|
||||
Iron now uses a fight simulator which can make its units look like very agressive.
|
||||
<br/>
|
||||
Autonomy of Iron's units gives its play a general guerilla aspect.
|
||||
<br/>
|
||||
In general, Iron favours the army race, rather than the tech race or the economy race.
|
||||
|
||||
<h3>I'd like to watch some of its games...</h3>
|
||||
Iron is currently playing games against other bots in <a target="_blank" href="http://sscaitournament.com">SSCAIT Tournament</a>'s ladder.
|
||||
|
||||
<h3>How to play against Iron?</h3>
|
||||
To play against Iron you need:
|
||||
<br/>- a proper Brood War installation.
|
||||
<br/>- the last release of the <a target="_blank" href="http://bwapi.github.io/index.html">BWAPI library</a>.
|
||||
<br/>- Iron's binaries: <a href="http://sscaitournament.com/index.php?action=scores">available here</a>.
|
||||
<br/>A tutorial is available here: <a target="_blank" href="https://www.youtube.com/watch?v=v99ZIMsjTPM">Starcraft Broodwar: Play vs custom AI </a>.
|
||||
<p/>
|
||||
Check also: <a href="interactiveIron.html">Interactive Iron</a>
|
||||
|
||||
<h3>Which version of BWEM does Iron use?</h3>
|
||||
Iron uses the latest version of the <a href="index.html">BWEM Library</a>.
|
||||
|
||||
<h3>Which version of the BWAPI does Iron use?</h3>
|
||||
Iron uses <a target="_blank" href="http://bwapi.github.io/index.html">BWAPI</a> 4.1.2.
|
||||
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
Source/BWEM/doc/html/Iron.jpg
Normal file
After Width: | Height: | Size: 148 KiB |
BIN
Source/BWEM/doc/html/Ride of Valkyries.png
Normal file
After Width: | Height: | Size: 103 KiB |
129
Source/BWEM/doc/html/Stone.html
Normal file
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="about page"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : Stone</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>Stone</h1>
|
||||
<IMG SRC="Stone.jpg"/>
|
||||
</center>
|
||||
<P/>
|
||||
Stone is the very first StarCraft AI based on the BWEM library (same author).
|
||||
<br/>
|
||||
Although it is a simple bot with a simple SCV rush strategy, it uses many of BWEM's features.
|
||||
<P/>
|
||||
Stone is Agent Oriented and was designed with this idea in mind: Agents should constantly be doing something valuable. At least they should never be doing something completely idiot.
|
||||
<br/>
|
||||
With this in mind, focus has been on individual behaviors: in Stone, Agents are highly autonomous and versatile.
|
||||
<br/>
|
||||
These behaviors are simple and combine well together. This, coupled to Agents's ability to cooperate at any time, makes the overall behavior especially robust.
|
||||
<br/>
|
||||
Robustness also comes of generality: Stone doesn't contain any code specific to a particular bot. It doesn't implement any clever or complex behavior either.
|
||||
If ever such a thing appears, it is emergent behavior. This happens sometimes :)
|
||||
<P/>
|
||||
Stone competed in the following tournaments:
|
||||
<ul>
|
||||
<li>the <a target="_blank" href="http://webdocs.cs.ualberta.ca/~cdavid/starcraftaicomp/report2015.shtml">AIIDE 2015 StarCraft AI Competition</a> (in a somewhat limited version).</li>
|
||||
<li>the <a target="_blank" href="http://sscaitournament.com/index.php?action=2015">SSCAIT 2015 Tournament</a>.</li>
|
||||
</ul>
|
||||
<P/>
|
||||
<P/>
|
||||
<HR/>
|
||||
<P/>
|
||||
<center>
|
||||
<h2>Stone's FAQ</h2>
|
||||
</center>
|
||||
|
||||
<h3>Why this name?</h3>
|
||||
Stone can only handle the first Terran units available. Although Stone's SCVs are quite capable, they can't really fight against advanced units like Vultures or Dragoons.
|
||||
For this reason, Stone has to live during the early game: the Stone Age...
|
||||
|
||||
<h3>How strong is it?</h3>
|
||||
Stone placed 2nd in the round-robin group phase of the <a target="_blank" href="http://sscaitournament.com/index.php?action=2015">SSCAIT 2015 Tournament</a>, making it one of the strongest StarCraft bots.
|
||||
<br/>That said, Stone only produces SCVs. So if you or your bot can figure out a way to fend off their harassment, it is likely you will win.
|
||||
<br/>To see some effective counter as a Terran, download and watch Stone-LetaBot.rep below.
|
||||
|
||||
<h3>I'd like to watch some of its games...</h3>
|
||||
Actually you can watch a couple of commented games which were held during the <a target="_blank" href="http://sscaitournament.com/index.php?action=2015">SSCAIT 2015 Tournament</a>:
|
||||
<ul>
|
||||
<li><a target="_blank" href="http://www.youtube.com/watch?v=F_F00IyEwgg">Stone vs. Ximp</a></li>
|
||||
<li><a target="_blank" href="http://www.youtube.com/watch?v=i_OQtHJWDl8">Stone vs. ZZZkBot</a></li>
|
||||
</ul>
|
||||
<P/>There are also a couple of replays available <a href="download.html">here</a>.
|
||||
<ul>
|
||||
<li>Stone-LetaBot.rep shows Stone usual harassment... and some impressive defense by LetaBot!</li>
|
||||
<li>Stone-ZZZkBot.rep shows the clash of styles between two rushing bots.
|
||||
<br/>Stone's strategy usually hard counters zerling rushes, but in this game its scouting has been delayed.
|
||||
<br/>This leads to a crasy, quite balanced and dynamic game, with suspense until the very end.</li>
|
||||
</ul>
|
||||
|
||||
<h3>How to play against Stone?</h3>
|
||||
To play against Stone you need:
|
||||
<br/>- a proper Brood War installation.
|
||||
<br/>- the last release of the <a target="_blank" href="http://bwapi.github.io/index.html">BWAPI library</a>.
|
||||
<br/>- Stone's binaries: <a href="download.html">download</a>.
|
||||
<br/>A tutorial is available here: <a target="_blank" href="https://www.youtube.com/watch?v=v99ZIMsjTPM">Starcraft Broodwar: Play vs custom AI </a>.
|
||||
|
||||
<h3>Which version of the BWEM does Stone use?</h3>
|
||||
Stone (SSCAIT 2015 version) uses BWEM 1.2
|
||||
|
||||
<h3>How big is the code?</h3>
|
||||
Although Stone's strategy sounds simple, its implementation isn't.
|
||||
There are 8000 lines of code for the bot itself, plus 5000 lines for the map analyser (BWEM).
|
||||
|
||||
<h3>Will you continue to work on Stone?</h3>
|
||||
Probably not. I may test a couple of ideas with Stone, nothing more.
|
||||
<P/>I'am currently developping a new bot, called <a href="Iron.html">Iron</a>.
|
||||
<br/>If you liked Stone, you may like Iron too...
|
||||
|
||||
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
Source/BWEM/doc/html/Stone.jpg
Normal file
After Width: | Height: | Size: 80 KiB |
63
Source/BWEM/doc/html/about.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="about page"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : about</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>about</h1>
|
||||
</center>
|
||||
<P/>
|
||||
My name is Igor Dimitrijevic. I am the author of the BWEM library.
|
||||
<P/>
|
||||
You can reach me by email at <a href="mailto:igor_dimitrijevic@yahoo.fr">igor_dimitrijevic@yahoo.fr</a>
|
||||
<P/>
|
||||
See also the project site : <a target="_blank" href="http://sourceforge.net/projects/BWEM">http://sourceforge.net/projects/BWEM</a>
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
67
Source/BWEM/doc/html/download.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="about page"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : about</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>download</h1>
|
||||
</center>
|
||||
<P/>
|
||||
The library can be downloaded here : <a target="_blank" href="http://sourceforge.net/projects/bwem/files">http://sourceforge.net/projects/bwem/files</a>
|
||||
<BR/>
|
||||
The archive only contains sources files and documentation files.
|
||||
<BR/>
|
||||
No installer is needed.
|
||||
<P/>
|
||||
Stone's binaries(SSCAIT2015) are available too, plus a couple of replays.
|
||||
<P/>
|
||||
New: <a href="interactiveIron.html">Interactive Iron</a>'s binaries available.
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
289
Source/BWEM/doc/html/faq.html
Normal file
|
@ -0,0 +1,289 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="FAQ"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : FAQ</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>FAQ</h1>
|
||||
</center>
|
||||
<P/>
|
||||
<HR/>
|
||||
<ul>
|
||||
<li><a href="#where-is-the-doc">Where is the API documentation?</a>
|
||||
<li><a href="#how-mature">How mature is the library?</a>
|
||||
<li><a href="#how-fast">How fast is it?</a>
|
||||
<li><a href="#how-robust">How robust is it?</a>
|
||||
<li><a href="#easy-to-use">Is it easy to use?</a>
|
||||
<li><a href="#how-work">How does it work?</a>
|
||||
<li><a href="#altitudes">What are altitudes?</a>
|
||||
<li><a href="#code-simple">Is the code simple?</a>
|
||||
<li><a href="#not-satisfied">What if I'm not satisfied with the results of the analysis?</a>
|
||||
<li><a href="#modify-the-code">So may I modify the code to fit my needs?</a>
|
||||
<li><a href="#is-it-extensible">Is the library extensible?</a>
|
||||
<li><a href="#paths-optimal">Are the paths optimal?</a>
|
||||
<li><a href="#mix-libraries">Can I use the library together with other libraries?</a>
|
||||
</ul>
|
||||
<P/>
|
||||
<HR/>
|
||||
<P/>
|
||||
|
||||
<h2 id="where-is-the-doc">Where is the API documentation?</h2>
|
||||
The whole documentation of the BWEM library is located in its headers source files.
|
||||
<br/>
|
||||
A good place to start with is <b>src/bwem.h</b>
|
||||
<br/>
|
||||
Every single function and type is documented in details.
|
||||
<P/>
|
||||
You don't need to read the whole API documentation though.
|
||||
The library provides concret and expected abstractions such as areas and choke points.
|
||||
You may want to read first the files <b>src/examples.h</b> and <b>src/examples.cpp</b>, which provide runable examples of how you can use the library and access the features.
|
||||
|
||||
<h2 id="how-mature">How mature is the library?</h2>
|
||||
I consider it quite mature, in terms of both functionality and robustness.
|
||||
<ul>
|
||||
<li/>The API is stable now.
|
||||
<li/>The functionality should not evolve much, since the library provides all you need to access the Areas, ChokePoints, Bases, Tiles and MiniTiles in an easy and efficient way.
|
||||
<li/>The library has been tested on most of the official maps of StarCraft and BroodWar, with satisfying results.
|
||||
<li/><a href="Stone.html">Stone</a>, the first bot based on the library, demonstrated both its functionality and its robustness.
|
||||
<li/><a href="Iron.html">Iron</a>, currently under development, is based on the library too.
|
||||
</ul>
|
||||
|
||||
|
||||
<h2 id="how-fast">How fast is it?</h2>
|
||||
<u>The analysis:</u>
|
||||
<P/>
|
||||
On my computer, which runs at 2.5 GHz, the whole analysis takes 100 ms for typical maps used in StarCraft AI competitions.
|
||||
<br/>
|
||||
It takes 500 ms to analyse one of the biggest map: Frozen Sea.scx.
|
||||
<P/>
|
||||
As a consequence, you should be able to run in debug mode in a decent way.
|
||||
<P/>
|
||||
<u>The services:</u>
|
||||
<P/>
|
||||
Most of the functionality is provided with a time complexity of O(1). This includes path and ground distance requests.
|
||||
|
||||
|
||||
<h2 id="how-robust">How robust is it?</h2>
|
||||
The library has been tested on many maps, including special ones like Crystallis.scm.
|
||||
<br/>
|
||||
If you do encounter some maps yielding unacceptable results, or even a crash, please let me know!
|
||||
|
||||
|
||||
<h2 id="easy-to-use">Is it easy to use?</h2>
|
||||
I think so, but that's obviously subjective.
|
||||
Here is a snippet, taken from the file <b>examples.cpp</b> that comes with the library:
|
||||
<P>
|
||||
<pre style="background-color:rgb(253, 244, 225)">
|
||||
{
|
||||
<span class="comment">// ...</span>
|
||||
|
||||
for (const Area & area : theMap.Areas())
|
||||
for (const Base & base : area.Bases())
|
||||
{
|
||||
if (MapDrawer::showBases)
|
||||
Broodwar->drawBoxMap(Position(base.Location()),
|
||||
Position(base.Location() + UnitType(Terran_Command_Center).tileSize()),
|
||||
MapDrawer::Color::bases);
|
||||
|
||||
if (MapDrawer::showAssignedRessources)
|
||||
{
|
||||
vector<Ressource *> AssignedRessources(base.Minerals().begin(), base.Minerals().end());
|
||||
AssignedRessources.insert(AssignedRessources.end(), base.Geysers().begin(), base.Geysers().end());
|
||||
|
||||
for (const Ressource * r : AssignedRessources)
|
||||
Broodwar->drawLineMap(base.Center(), r->Pos(), MapDrawer::Color::assignedRessources);
|
||||
}
|
||||
}
|
||||
|
||||
<span class="comment">// ...</span>
|
||||
}
|
||||
</pre>
|
||||
<P/>
|
||||
The extract shows how to iterate through the Areas, the Bases, and their assigned Ressources.
|
||||
<br/>
|
||||
Do not hesitate to read more of <b>examples.cpp</b>!
|
||||
<P/>
|
||||
<i>MapDrawer</i> is a helper class that is provided together with the library. It can be used to print information about the map onto the game screen.
|
||||
<br/>
|
||||
Another helper class, <i>MapPrinter</i>, can be used to print information about the map into a file.
|
||||
<br/>
|
||||
Both are highly customizable and proved to be useful for debug purposes.
|
||||
<br/>
|
||||
By the way, they have been used to produce the <a href="index.html">screenshots</a> in this site.
|
||||
<P/>
|
||||
Safety is another aspect of the ease of use.
|
||||
BWEM provides safety through its use of modern C++ style.
|
||||
<br/>
|
||||
An exemple is type safety. Programming an AI for Starcraft requires dealing with three kinds of positions.
|
||||
In my experience, this is the source of a huge number of bugs.
|
||||
In order to avoid the possibility of errors, BWEM's API uses the template <i>TPosition</i> and its specializations
|
||||
(<i>Position</i>, <i>WalkPosition</i>, <i>TilePosition</i>)
|
||||
provided by the <a target="_blank" href="http://bwapi.github.io/index.html">BWAPI library</a>, whenever possible.
|
||||
<P/>
|
||||
Also, make sure to read the <a href="start.html">getting started</a> page.
|
||||
|
||||
|
||||
<h2 id="how-work">How does it work?</h2>
|
||||
The analysis follows the steps:
|
||||
<ol>
|
||||
<li/><a href="#altitudes">Altitudes</a> are computed for each MiniTile.
|
||||
<P/>
|
||||
<li/>The Areas are computed by considering the miniTiles successively in descending order of their altitude.
|
||||
<br/>
|
||||
Each of them either:
|
||||
<br/> - involves the creation of a new Area.
|
||||
<br/> - is added to some existing neighbouring Area.
|
||||
<br/> - makes two neighbouring Areas merge together.
|
||||
<br/>
|
||||
<P/>
|
||||
<li/>The ChokePoints are deduced.
|
||||
<P/>
|
||||
<li/>Some statistics and measures like paths and ground distances are calculated.
|
||||
<P/>
|
||||
<li/>The Bases are created at relevant locations.
|
||||
</ol>
|
||||
The library also provides automatic recalculation of paths and ground distances (in the case blocking Minerals being destroyed for example).
|
||||
<br/>When this occurs, only a small part of the analysis is processed again.
|
||||
|
||||
|
||||
<h2 id="altitudes">What are altitudes?</h2>
|
||||
The altitude is the distance from the nearest non walkable MiniTile, except those which are part of small enough zones (lakes).
|
||||
<P/>
|
||||
Altitudes play an important role in the <a href="#how-work">analysis process</a>.
|
||||
<P/>
|
||||
Besides that, altitudes can be very useful in implementing various algorithms.
|
||||
<P/>
|
||||
Suppose, for example, you have your air unit somewhere in some area, being attacked by ground units.
|
||||
You want it to reach the nearest non walkable zone, to escape from the pursuers.
|
||||
<br/>Knowing the altitude for each MiniTile, you can use this very simple greedy algorithm: among the 8 directions,
|
||||
always choose the one for which the altitude of the neighbouring MiniTile is the lowest. This way you get the shortest path in O(1).
|
||||
<P/>
|
||||
Conversely it is just as easy to reach highest altitudes, though there may be local optima.
|
||||
|
||||
|
||||
<h2 id="code-simple">Is the code simple?</h2>
|
||||
Clearly, it is not trivial!
|
||||
<br/>The algorithms used are, however, quite simples. Most of them are derived from dijkstra and breadth-first search algorithms.
|
||||
<br/>Moreover the whole analysis is divided into sequential and well separated processes so that it is easy to reason about.
|
||||
|
||||
|
||||
<h2 id="not-satisfied">What if I'm not satisfied with the results of the analysis?</h2>
|
||||
Areas, ChokePoints, Base placement are automatically computed by the BWEM library.
|
||||
<br/>You may not agree with all the results, for all the maps.
|
||||
<P/>
|
||||
Fortunatly, most of the algorithms used by the analysis are parametrised and it is fairly easy to modify these parameters.
|
||||
<br/>More information about that in <b>bwem.h</b>.
|
||||
<P/>
|
||||
As discussed in <a href="#code-simple">Is the code simple?</a>, the algorithms themselves are not that complex.
|
||||
You might want to modify them so that they fit your needs.
|
||||
|
||||
|
||||
<h2 id="modify-the-code">So may I modify the code to fit my needs?</h2>
|
||||
Usually, when you use a library, you don't want to modify it, as it may be hard work and error prone.
|
||||
Moreover, this removes the possibility of using next versions of the library easily.
|
||||
<P/>
|
||||
The case of the BWEM library is particular, however:
|
||||
<br/>- it doesn't aim at evolving much, as it is quite mature and stable now.
|
||||
<br/>- some users are not involved in a long-term project, especially those willing to compete in StarCraft AI competitions for one year only.
|
||||
<br/>So if you really need to change some of the code to fit your particular needs, feel free!
|
||||
|
||||
|
||||
<h2 id="is-it-extensible">Is the library extensible?</h2>
|
||||
Appart from willing to <a href="#modify-the-code">modify some part of the code</a>, you may want to add your own, related features.
|
||||
<br/>For simple cases, you will simply write functions that work on Areas, ChokePoints or Bases.
|
||||
<br/>But what if you want, saying, Areas to contain more information?
|
||||
<P/>
|
||||
As you don't want to modify the library, you will have to define some AreaExtension class.
|
||||
<br/>Then, you usually will want to be able to:
|
||||
<ul>
|
||||
<li/>access the Area from its corresponding AreaExtension → you can use either <i>Area::Id()</i> or Areas addresses.
|
||||
<li/>access the AreaExtension from its corresponding Area → you can use <i>Area::Ext()</i> and <i>Area::SetExt()</i>.
|
||||
</ul>
|
||||
More generally, BWEM's main classes inherit from UserData, which provides the <i>Ext()</i> / <i>SetExt()</i> methods.
|
||||
You can use them to extend theses classes.
|
||||
It is neither an easy nor a safe way, but it is fearly feasible.
|
||||
<P/>
|
||||
By the way, <a href="Stone.html">Stone</a> demonstrates this technique. It uses 4 extension types: <i>VArea</i>, <i>VChokePoint</i>, <i>VBase</i> and <i>VMap</i>.
|
||||
<br/>You can look at the source code for more details.
|
||||
<P/>
|
||||
|
||||
|
||||
<h2 id="paths-optimal">Are the paths optimal?</h2>
|
||||
The BWEM library provides paths made of ChokePoints. They are intented to be shortest, ground, paths.
|
||||
<P/>
|
||||
The suggested paths, if not optimal, are still very good paths.
|
||||
<P/>
|
||||
Looking at the first screenshot in the home page you may notice that the printed path connects the middle of the ChokePoints.
|
||||
<br/>Of course, in the general case the shortest path do NOT go through the exact middle of the ChokePoints.
|
||||
<br/>That the printed path connects middles is just a visual choice. It doesn't mean you should do the same. In a real case where you
|
||||
have to move a unit frame by frame, you would order it to move to the middle of next ChokePoint that is far enough (saying 10 tiles).
|
||||
This way, the unit will go through the ChokePoints of the path in a smart way.
|
||||
<br/><a href="Stone.html">Stone</a> demonstrates this technique. If you are interested, download its source code and look at the file <b>walking.cpp</b>.
|
||||
|
||||
|
||||
<h2 id="mix-libraries">Can I use the library together with other libraries?</h2>
|
||||
Of course you can.
|
||||
<br/>The BWEM library is a light-weight library with namespaces and minimal dependancies. It is not likely to interfere with other libraries.
|
||||
<P/>
|
||||
For example, you can include the BWEM library even if you already uses the <a target="_blank" href="https://bitbucket.org/auriarte/bwta2">BWTA2 library</a>.
|
||||
This way wou can access to specific features from each library.
|
||||
<P/>
|
||||
|
||||
|
||||
|
||||
|
||||
<hr/>
|
||||
<P/>
|
||||
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
79
Source/BWEM/doc/html/features.html
Normal file
|
@ -0,0 +1,79 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="This page presents an introductory examples of BWEM library"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : features</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>Features</h1>
|
||||
</center>
|
||||
<P/>
|
||||
<UL>
|
||||
<LI>Modern C++11 code</LI>
|
||||
<LI>Standard, portable C++ code.</LI>
|
||||
<LI>No dependancies, except for the BWAPI library.</LI>
|
||||
<LI>Provides useful debugging tools (print the map into a file, onto the screen)</LI>
|
||||
<LI>Provides common and expected high level abstractions: areas, choke points, bases.</LI>
|
||||
<LI>Provides relevant, low level representations: tiles and mini-tiles.</LI>
|
||||
<LI>Provides distance to nearest edge, for each mini-tile.</LI>
|
||||
<LI>Provides paths and ground distance.</LI>
|
||||
<LI>Handles blocking mineral patches and blocking static buildings</LI>
|
||||
<LI>Handles stacked mineral patches and stacked static buildings</LI>
|
||||
<LI>Handles minerals that need to be gathered before a base can be built.</LI>
|
||||
<LI>Dynamic: Paths and ground distance are automatically updated when blocking items get destroyed</LI>
|
||||
<LI>Robust: performs well for all the maps tested (including Crystallis.scm)</LI>
|
||||
<LI>Fast analysis: performs in less then 1 second</LI>
|
||||
<LI>Scales: Frozen Sea.scx analysis still performs in less then 1 second</LI>
|
||||
<LI>Fast access: almost all the functionality is O(1), including paths and ground distance.</LI>
|
||||
<LI>Memory used < 128 x number of tiles</LI>
|
||||
<LI>Extensible : provides free-to-use data for main types.</LI>
|
||||
|
||||
</UL>
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
70
Source/BWEM/doc/html/help.html
Normal file
|
@ -0,0 +1,70 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="help page"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : help</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>help</h1>
|
||||
</center>
|
||||
<P/>
|
||||
|
||||
|
||||
Have you read the <a href="faq.html">FAQ</a>?
|
||||
<P/>
|
||||
Looking for the <a href="faq.html#where-is-the-doc">API documentation</a>?
|
||||
<P/>
|
||||
Also make sure to read the <a href="start.html">getting started section</a>.
|
||||
<P/>
|
||||
If you still encounter some problems, you can contact me by email at <a href="mailto:igor_dimitrijevic@yahoo.fr">igor_dimitrijevic@yahoo.fr</a>
|
||||
or post a question here : <a target="_blank" href="http://sourceforge.net/p/bwem/discussion/general">http://sourceforge.net/p/bwem/discussion/general</a>
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
152
Source/BWEM/doc/html/index.html
Normal file
|
@ -0,0 +1,152 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="This is the homepage of BWEM library"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library Homepage</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>Welcome to the BWEM library homepage</h1>
|
||||
</center>
|
||||
<center><a target="_blank" href="http://BWEM.sourceforge.net">[online version of this page]</a></center>
|
||||
<p/>
|
||||
Brood War Easy Map is a C++ library that analyses Brood War's maps and
|
||||
provides relevant information such as areas, choke points and base locations.
|
||||
<br/>
|
||||
It is built on top of the <a target="_blank" href="http://bwapi.github.io/index.html">BWAPI library</a>.
|
||||
<br/>
|
||||
It first aims at simplifying the development of bots for Brood War, but can be used
|
||||
for any task requiring high level map information.
|
||||
It can be used as a replacement for the <a target="_blank" href="https://bitbucket.org/auriarte/bwta2">BWTA2 add-on</a>,
|
||||
as it performs faster and shows better robustness while providing similar information.
|
||||
<p/>
|
||||
The current version is <B>1.4.1</B>
|
||||
<P/>
|
||||
It has been tested with Microsoft Visual Studio Express 2013 for Windows Desktop, 32-bit
|
||||
<P/>
|
||||
If you encounter any bug, error or warning message, do not hesitate to report it on
|
||||
<a target="_blank" href="http://sourceforge.net/p/bwem/discussion/general">http://sourceforge.net/p/bwem/discussion/general</a>
|
||||
or <a href="about.html">contact me</a>.
|
||||
<HR/>
|
||||
<h2>Screenshots:</h2>
|
||||
<P/>
|
||||
<IMG SRC="Andromeda.png"/>
|
||||
<BR/>
|
||||
<I>Andromeda.scx</I>
|
||||
<P/>
|
||||
<IMG SRC="Ride of Valkyries.png"/>
|
||||
<BR/>
|
||||
<I>Ride of Valkyries.scx</I>
|
||||
<P/>
|
||||
<IMG SRC="Heartbreak Ridge.png"/>
|
||||
<BR/>
|
||||
<I>Heartbreak Ridge.scx</I>
|
||||
<P/>
|
||||
<IMG SRC="Great Barrier Reef.png"/>
|
||||
<BR/>
|
||||
<I>Great Barrier Reef.scx</I>
|
||||
<P/>
|
||||
<IMG SRC="Baby Steps.png"/>
|
||||
<BR/>
|
||||
<I>Baby Steps.scm</I>
|
||||
<P/>
|
||||
<HR/>
|
||||
<h2><a href="download.html">Download link</a></h2>
|
||||
<HR/>
|
||||
<h2>License: MIT/X11</h2>
|
||||
<HR/>
|
||||
<h2>Requirements:</h2>
|
||||
<UL>
|
||||
<LI><a target="_blank" href="http://bwapi.github.io/index.html">BWAPI 4.1.2</a></LI>
|
||||
<LI>C++11 compiler (e.g. Visual Studio 2013)</LI>
|
||||
</UL>
|
||||
<HR/>
|
||||
<h2>Limitations:</h2>
|
||||
<UL>
|
||||
<LI>BWEM doesn't provide any geometric description (polygon) of the computed areas. If you need this, check the <a target="_blank" href="https://bitbucket.org/auriarte/bwta2">BWTA2 library</a></LI>
|
||||
<LI>BWEM is not compatible with older versions of BWAPI (prior to 4.0). If you need such compatibility, check the <a target="_blank" href="https://code.google.com/p/bwta/">BWTA library</a></LI>
|
||||
</UL>
|
||||
<P/>
|
||||
<HR/>
|
||||
<h2>History:</h2>
|
||||
<h3>July, 2017 : 1.4</h3>
|
||||
<UL>
|
||||
<LI>fix: A bug in Area::BoundingBoxSize</LI>
|
||||
<LI>fix: A bug with BWAPIClient and Map reinitialization (thanks to Florian Klemme for report and good hint)</LI>
|
||||
<LI>fix: A bug with Electric Circuit (thanks to Florian Klemme @Kruecke for report)</LI>
|
||||
<LI>fix: UserData::(Set)Ext was wrongly equivalent to UserData::(Set)Ptr (thanks to Florian Klemme for report and fix)</LI>
|
||||
<LI>fix: Compiling under vs 2017 (thanks to Joseph Huang for report and fix)</LI>
|
||||
<LI>new feature: ExampleWall</LI>
|
||||
<LI>new feature: BWEM_ext::disjoint</LI>
|
||||
</UL>
|
||||
<h3>September, 2016 : 1.3</h3>
|
||||
<UL>
|
||||
<LI>fix: A bug in Map::Crop</LI>
|
||||
<LI>fix: The length calculation in Map::GetPath has been improved in the case of a path through one ChokePoint exactly.</LI>
|
||||
<LI>new feature: Area::LowGroundPercentage, Area::HighGroundPercentage, Area::VeryHighGroundPercentage</LI>
|
||||
<LI>new feature: Tile::Doodad</LI>
|
||||
<LI>new feature: Ressource::Amount</LI>
|
||||
<LI>new feature: inBoundingBox</LI>
|
||||
<LI>new feature: Map::Initialized()</LI>
|
||||
<LI>new feature: GridMap</LI>
|
||||
<LI>new feature: Added the macros BWEM_USE_WINUTILS and BWEM_USE_MAP_PRINTER</LI>
|
||||
<LI>break: Tile::HigherGround was somewhat useless and has been replaced with Tile::GroundHeight (see the screenshot Ride of Valkyries.scx. See also this <a target="_blank" href="https://github.com/bwapi/bwapi/issues/675">related issue in BWAPI</a>).</LI>
|
||||
<LI>break: The type utils::check_t is now a class enum. If you used the 'check' and 'no_check' values explicitly, you will have to replace them with 'check_t::check' and 'check_t::no_check' respectively.</LI>
|
||||
</UL>
|
||||
<h3>November, 2015 : 1.2</h3>
|
||||
<UL>
|
||||
<LI>fix: MapPrinter could crash when writing the file, due to some invalid path. Now errors are handled in the constructor in a safer way.</LI>
|
||||
<LI>fix: The semantics of MapPrinter::showAreas and MapPrinter::showContinents have been made clearer. </LI>
|
||||
<LI>fix: An empty Log.txt was created and could crash, due to some invalid path. This file creation has been removed. </LI>
|
||||
<LI>fix: Tile::Data and Tile::SetData are no longer used by the internals. This removes the possibility that the automatic path recalculation overwrites user data.</LI>
|
||||
<LI>fix: BWAPI_ext::makeBoundingBoxIncludePoint is now more robust.</LI>
|
||||
<LI>feature: Area, ChokePoint, Base and Tile classes now inherit from the UserData class, thus providing them with the same free-to-use data.</LI>
|
||||
</UL>
|
||||
<h3>September, 2015 : first release 1.0 beta</h3>
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
139
Source/BWEM/doc/html/interactiveIron.html
Normal file
|
@ -0,0 +1,139 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="about page"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : Interactive Iron</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>Control the Iron!</h1>
|
||||
</center>
|
||||
<P/>
|
||||
You can now <a href="download.html">download</a> a special version of Iron called Interactive Iron.
|
||||
<P/>
|
||||
This version allow you to control many aspects of Iron play, in real time.
|
||||
<P/>
|
||||
As a bot developper, you can use it to make your bot much more robust against any potential threat from Iron.
|
||||
With Interactive Iron, you can make Iron stronger, and test you bot against it.
|
||||
You can also make Iron weaker of course.
|
||||
<P/>
|
||||
As a human player, using Interactive Iron will allow you to play more different games.
|
||||
<P/>
|
||||
<HR/>
|
||||
<P/>
|
||||
|
||||
<center>
|
||||
<h2>game play commands</h2>
|
||||
</center>
|
||||
For most of these commands, type the same command twice to undo.
|
||||
<h3><i>integer</i></h3>
|
||||
Specify the delay between each frame in ms.
|
||||
<h3>scvs</h3>
|
||||
Make more SCVs. When the bases are saturated, excess SCVs are send to fight.
|
||||
<h3>marines</h3>
|
||||
Make more marines.
|
||||
<h3>vultures</h3>
|
||||
Make more vultures.
|
||||
<h3>tanks</h3>
|
||||
Make more tanks.
|
||||
<h3>goliaths</h3>
|
||||
Make more goliaths.
|
||||
<h3>wraiths</h3>
|
||||
Make more wraiths.
|
||||
<h3>expand</h3>
|
||||
Favor fast expansion.
|
||||
<h3>berserker</h3>
|
||||
Enter berserker mode. When in berserker mode, conservative behavior is less important.
|
||||
<h3>target <i>integer</i> <i>integer</i></h3>
|
||||
Specify a tile position as the default target for the combat units.
|
||||
<br/>This doesn't mean all the combat units will always go and stay their, though: Iron's units have their own decisions...
|
||||
<P/>
|
||||
Make sure the tile specified is a walkable tile that all the ground units can reach.
|
||||
<P/>
|
||||
Also, you may find the command <b>/grid</b> useful to see the each tile position.
|
||||
<h3>target</h3>
|
||||
Back to Iron's default target.
|
||||
<center>
|
||||
<P/>
|
||||
<HR/>
|
||||
<P/>
|
||||
<h2>BWEM display commands</h2>
|
||||
</center>
|
||||
Even if you don't use the BWEM library, Interactive Iron allows you to test some of its features on any map.
|
||||
<h3>seas</h3>
|
||||
<h3>lakes</h3>
|
||||
<h3>unbuildable</h3>
|
||||
<h3>gh</h3>
|
||||
<h3>minerals</h3>
|
||||
<h3>geysers</h3>
|
||||
<h3>static buildings</h3>
|
||||
<h3>bases</h3>
|
||||
<h3>assigned ressources</h3>
|
||||
<h3>frontier</h3>
|
||||
<h3>cp</h3>
|
||||
<h3>all</h3>
|
||||
All these commands can be combined together.
|
||||
<br/>Type the same command twice to undo.
|
||||
<br/>You can also type <b>show minerals</b> or <b>show minerals</b>.
|
||||
<P/>
|
||||
See <I>BWEM::utils::MapDrawer</I> for more information.
|
||||
<center>
|
||||
<P/>
|
||||
<HR/>
|
||||
<P/>
|
||||
<h2>BWEM print tool</h2>
|
||||
</center>
|
||||
When the game is finished, Interactive Iron automatically prints the map into the file <b><StarCraftFolder>bwapi-data/map.bmp</b>.
|
||||
<br/>See <I>BWEM::utils::MapPrinter</I> for more information.
|
||||
<P/>
|
||||
<HR/>
|
||||
<P/>
|
||||
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
315
Source/BWEM/doc/html/start.html
Normal file
|
@ -0,0 +1,315 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="DESCRIPTION" content="Getting started"/>
|
||||
<meta name="KEYWORDS" content="BWEM,C++,library,BWAPI,Brood War,Starcraft,map,map analyser,"/>
|
||||
<title>BWEM library : getting started</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
<center>
|
||||
<h1>Getting started</h1>
|
||||
</center>
|
||||
<P/>
|
||||
|
||||
<HR/>
|
||||
<UL>
|
||||
<LI><a href="#install-the-lib">How to install the library</a></LI>
|
||||
<LI><a href="#use-the-lib">How to use the library</a></LI>
|
||||
</UL>
|
||||
<P/>
|
||||
|
||||
<HR/>
|
||||
<h2 id="install-the-lib">How to install the library</h2>
|
||||
The library should be structured as follows:
|
||||
<UL>
|
||||
<LI><b>BWEM</b></LI>
|
||||
<UL>
|
||||
<LI><b>src</b></LI>
|
||||
Contains the source files of the BWEM library.
|
||||
<LI><b>EasyBMP_1.06</b></LI>
|
||||
Contains additionnal source files required by the <I>BWEM::utils::printMap()</I> facility.
|
||||
<LI><b>doc</b></LI>
|
||||
Contains an offline copy of this documentation.
|
||||
</UL>
|
||||
</UL>
|
||||
<u>First note</u>: the BWEM library includes the <a target="_blank" href="http://easybmp.sourceforge.net">EasyBMP library</a> (BSD-revised),
|
||||
whose source files are all contained in the <b>EasyBMP_1.06</b> folder.
|
||||
If you don't use the BWEM::utils::printMap() utility though, you don't need this third party library either and
|
||||
you can freely remove the whole folder. In this case, just make sure you also remove <b>src/mapPrinter.h</b> and <b>src/mapPrinter.cpp</b> plus
|
||||
any reference to these files. Before you do that though, note this simple and flexible utility may prove to be very useful
|
||||
while debugging for example. Alternatively, you can just set <i>BWEM_USE_MAP_PRINTER</i> to 0 in <b>src/defs.s</b>: this will disable the compilation of the related files.
|
||||
<BR/>
|
||||
Note that the EasyBMP library includes some Windows headers, so if you are on Linux, you have to set <i>BWEM_USE_MAP_PRINTER</i> to 0.
|
||||
<P/>
|
||||
<u>Second note</u>: if you are in Linux, you also have to set <i>BWEM_USE_WINUTILS</i> to 0 in <b>src/defs.s</b>.
|
||||
This will disable the compilation of the optional utils provided in <b>winutils.h</b>.
|
||||
<P/>
|
||||
The BWEM library consists in C++ source files only.
|
||||
You could create a library project to get a library file (.lib or .dll) from them.
|
||||
In the following though, only the direct approach will be discussed, i.e. adding these files into your C++ project.
|
||||
<P/>
|
||||
First, you should have a starting or an existing project that makes use of the <a target="_blank" href="http://bwapi.github.io/index.html">BWAPI library</a>.
|
||||
In the following, I will assume you are using the ExampleAIModule that comes with the BWAPI release. Also, make sure to use the latest version (at least 4.1.2).
|
||||
<P/>
|
||||
Copy the <b>BWEM</b> folder into your project (wherever appropriate). For example, in <b>ExampleAIModule\Source</b>.
|
||||
<BR/>
|
||||
Now you have to add the files into your C++ project, just as you would for any other C++ source file.
|
||||
<BR/>
|
||||
If you are using Visual Studio, this can be achieved using the solution explorer.
|
||||
<BR/>
|
||||
Right-click on your project, then add a new filter "BWEM".
|
||||
<BR/>
|
||||
Right-click on that filter, then add an existing item : actually you will browse and select all the files in <b>ExampleAIModule\Source\BWEM\src</b>.
|
||||
<BR/>
|
||||
Right-click on the filter once again, then browse and add the files <b> EasyBMP.h</b> and <b> EasyBMP.cpp</b> located in <b>ExampleAIModule\Source\BWEM\src\EasyBMP_1.06</b>.
|
||||
<BR/>
|
||||
That's all!
|
||||
|
||||
<HR/>
|
||||
<h2 id="use-the-lib">How to use the library</h2>
|
||||
<P/>
|
||||
Again, I will assume you are working on the ExampleAIModule.
|
||||
To use the library, we will only modify <b>ExampleAIModule.cpp</b>.
|
||||
<P/>
|
||||
First, modify the first lines so that it shows as:
|
||||
<P/>
|
||||
<pre style="background-color:rgb(253, 244, 225)">
|
||||
<span class="existingCode">#include "ExampleAIModule.h"</span>
|
||||
#include "BWEM/src/bwem.h" <span class="comment">// update the path if necessary</span><span class="existingCode">
|
||||
#include <iostream>
|
||||
|
||||
using namespace BWAPI;
|
||||
using namespace Filter;</span>
|
||||
//using namespace BWEM;
|
||||
//using namespace BWEM::BWAPI_ext;
|
||||
//using namespace BWEM::utils;
|
||||
|
||||
namespace { auto & theMap = BWEM::Map::Instance(); }</span>
|
||||
</pre>
|
||||
The <I>class BWEM::Map</I> is the entry point for almost every thing in BWEM.
|
||||
<BR/>
|
||||
The unique instance can be accessed using <I>BWEM::Map::Instance()</I>.
|
||||
For convenience, we define an alias for it : <I>theMap</I>, local to this file.
|
||||
We could as well use a reference or a pointer member of the class <I>ExampleAIModule</I> but, because the instance of <I>Map</I> is a global variable, this matters little.
|
||||
<P/>
|
||||
You may want to uncomment some or all of the 3 using directives.
|
||||
The namespace <I>BWEM</I> introduces very few names so bringing them all is probably not a big deal.
|
||||
<BR/>
|
||||
The two other namespaces are not direcly related to BWEM functionnality, but you might still want to use some of their stuff.
|
||||
<BR/>
|
||||
<I>BWEM::BWAPI_ext</I> contains several helper functions, built on top of the BWAPI library, that prove to be useful while implementing the BWEM library.
|
||||
<BR/>
|
||||
<I>BWEM::utils</I> also contains helper functions, but they are more general and do not depend on the BWAPI library.
|
||||
|
||||
<P/>
|
||||
Before we can use theMap, we need to initialize it.
|
||||
The right place to do this is in ExampleAIModule::onStart().
|
||||
But first, let's inclose the whole code inside a standard and basic: try-catch handler:
|
||||
|
||||
<pre style="background-color:rgb(253, 244, 225)">
|
||||
<span class="existingCode">void ExampleAIModule::onStart()
|
||||
{</span>
|
||||
try
|
||||
{<span class="existingCode">
|
||||
// Hello World!
|
||||
|
||||
// ...</span>
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
Broodwar << "EXCEPTION: " << e.what() << std::endl;
|
||||
}<span class="existingCode">
|
||||
}</span>
|
||||
</pre>
|
||||
|
||||
This will catch any standard exception, as well as any exception from BWEM.
|
||||
We will do that in the other methods too.
|
||||
<P/>
|
||||
Now, we add the initialization code:
|
||||
|
||||
<pre style="background-color:rgb(253, 244, 225)">
|
||||
<span class="existingCode"> // ...
|
||||
|
||||
else // if this is not a replay
|
||||
{
|
||||
// Retrieve you and your enemy's races. enemy() will just return the first enemy.
|
||||
// If you wish to deal with multiple enemies then you must use enemies().
|
||||
if ( Broodwar->enemy() ) // First make sure there is an enemy
|
||||
Broodwar << "The matchup is " << Broodwar->self()->getRace() << " vs " << Broodwar->enemy()->getRace() << std::endl;</span>
|
||||
|
||||
Broodwar << "Map initialization..." << std::endl;
|
||||
|
||||
theMap.Initialize();
|
||||
theMap.EnableAutomaticPathAnalysis();
|
||||
bool startingLocationsOK = theMap.FindBasesForStartingLocations();
|
||||
assert(startingLocationsOK);
|
||||
|
||||
BWEM::utils::MapPrinter::Initialize(&theMap);
|
||||
BWEM::utils::printMap(theMap); <span class="comment">// will print the map into the file <StarCraftFolder>bwapi-data/map.bmp</span>
|
||||
BWEM::utils::pathExample(theMap); <span class="comment">// add to the printed map a path between two starting locations</span>
|
||||
|
||||
Broodwar << "gg" << std::endl;<span class="existingCode">
|
||||
}
|
||||
}
|
||||
catch (const std::exception & e)</span>
|
||||
</pre>
|
||||
|
||||
We have correctly initialized BWEM, and we have started using it (see the code in <I>printMap</I> and <I>pathExample</I>, which are good examples).
|
||||
<BR/>
|
||||
But to get the best out of it we need to inform it of two events, so we add the following:
|
||||
|
||||
<pre style="background-color:rgb(253, 244, 225)">
|
||||
<span class="existingCode">void ExampleAIModule::onUnitDestroy(BWAPI::Unit unit)
|
||||
{</span>
|
||||
try
|
||||
{
|
||||
if (unit->getType().isMineralField()) theMap.OnMineralDestroyed(unit);
|
||||
else if (unit->getType().isSpecialBuilding()) theMap.OnStaticBuildingDestroyed(unit);
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
Broodwar << "EXCEPTION: " << e.what() << std::endl;
|
||||
}<span class="existingCode">
|
||||
}</span>
|
||||
</pre>
|
||||
|
||||
As an example, let's use <I>BWEM::utils::drawMap</I>, which provides similar functionality to <I>BWEM::utils::printMap</I>.
|
||||
<BR/>
|
||||
Instead of printing the map into a file, it draws it directly on the game screen, using BWAPI primitives.
|
||||
<BR/>
|
||||
Don't forget to look at the code of <I>drawMap</I>. To use it, we just insert the following in <I>ExampleAIModule::onFrame()</I>:
|
||||
|
||||
<pre style="background-color:rgb(253, 244, 225)">
|
||||
<span class="existingCode">void ExampleAIModule::onFrame()
|
||||
{
|
||||
// Called once every game frame</span>
|
||||
try
|
||||
{
|
||||
BWEM::utils::gridMapExample(theMap);
|
||||
BWEM::utils::drawMap(theMap);
|
||||
|
||||
<span class="existingCode">// Display the game frame rate as text in the upper left area of the screen
|
||||
Broodwar->drawTextScreen(200, 0, "FPS: %d", Broodwar->getFPS() );
|
||||
Broodwar->drawTextScreen(200, 20, "Average FPS: %f", Broodwar->getAverageFPS() );
|
||||
|
||||
// ...</span>
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
Broodwar << "EXCEPTION: " << e.what() << std::endl;
|
||||
}<span class="existingCode">
|
||||
}</span>
|
||||
</pre>
|
||||
|
||||
(We also called <I>BWEM::utils::gridMapExample</I>, which demonstrates the use of the new class utils::GridMap.)
|
||||
<BR/>
|
||||
Finally, the class <I>BWEM::utils::MapDrawer</I> comes in handy for controling the information displayed on the screen.
|
||||
To see that, let's modify <I>ExampleAIModule::onSendText</I>:
|
||||
|
||||
<pre style="background-color:rgb(253, 244, 225)">
|
||||
<span class="existingCode">void ExampleAIModule::onSendText(std::string text)
|
||||
{</span>
|
||||
BWEM::utils::MapDrawer::ProcessCommand(text);<span class="existingCode">
|
||||
|
||||
// Send the text to the game if it is not being processed.
|
||||
Broodwar->sendText("%s", text.c_str());
|
||||
|
||||
// Make sure to use %s and pass the text as a parameter,
|
||||
// otherwise you may run into problems when you use the %(percent) character!
|
||||
}</span>
|
||||
</pre>
|
||||
|
||||
Run your bot. You should now be able select which information you want to show.
|
||||
<BR/>
|
||||
Press <enter>, then type: minerals
|
||||
<BR/>
|
||||
Do it again.
|
||||
<BR/>
|
||||
In <I>MapDrawer::ProcessCommand</I> you will find all the available items you can control.
|
||||
|
||||
<P/>
|
||||
<center>
|
||||
<a href="index.html">home</a>
|
||||
|
|
||||
<a href="features.html">features</a>
|
||||
|
|
||||
<a href="start.html">getting started</a>
|
||||
|
|
||||
<a href="faq.html">FAQ</a>
|
||||
|
|
||||
<a href="Stone.html">Stone</a>
|
||||
|
|
||||
<a href="Iron.html">Iron</a>
|
||||
|
|
||||
<a href="interactiveIron.html">Control the Iron!</a>
|
||||
|
|
||||
<a href="download.html">download</a>
|
||||
|
|
||||
<a href="help.html">help</a>
|
||||
|
|
||||
<a href="about.html">about</a>
|
||||
</center>
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</html>
|
2
Source/BWEM/doc/html/style.css
Normal file
|
@ -0,0 +1,2 @@
|
|||
.comment{ color: #007000; }
|
||||
.existingCode{ color: #808080; }
|
427
Source/BWEM/src/area.cpp
Normal file
|
@ -0,0 +1,427 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file is part of the BWEM Library.
|
||||
// BWEM is free software, licensed under the MIT/X11 License.
|
||||
// A copy of the license is provided with the library in the LICENSE file.
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "area.h"
|
||||
#include "mapImpl.h"
|
||||
#include "graph.h"
|
||||
#include "neutral.h"
|
||||
#include "winutils.h"
|
||||
#include <map>
|
||||
|
||||
|
||||
using namespace BWAPI;
|
||||
using namespace BWAPI::UnitTypes::Enum;
|
||||
namespace { auto & bw = Broodwar; }
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace BWEM {
|
||||
|
||||
using namespace detail;
|
||||
using namespace BWAPI_ext;
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// class Area
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Area::Area(Graph * pGraph, id areaId, WalkPosition top, int miniTiles)
|
||||
: m_pGraph(pGraph), m_id(areaId), m_top(top), m_miniTiles(miniTiles)
|
||||
{
|
||||
bwem_assert(areaId > 0);
|
||||
|
||||
auto & topMiniTile = GetMap()->GetMiniTile(top);
|
||||
bwem_assert(topMiniTile.AreaId() == areaId);
|
||||
|
||||
m_maxAltitude = topMiniTile.Altitude();
|
||||
}
|
||||
|
||||
|
||||
Area::Area(const Area & Other)
|
||||
: m_pGraph(Other.m_pGraph)
|
||||
{
|
||||
bwem_assert(false);
|
||||
}
|
||||
|
||||
|
||||
Map * Area::GetMap() const
|
||||
{
|
||||
return m_pGraph->GetMap();
|
||||
}
|
||||
|
||||
|
||||
TilePosition Area::BoundingBoxSize() const
|
||||
{
|
||||
return m_bottomRight - m_topLeft + 1;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<ChokePoint> & Area::ChokePoints(const Area * pArea) const
|
||||
{
|
||||
auto it = m_ChokePointsByArea.find(pArea);
|
||||
bwem_assert(it != m_ChokePointsByArea.end());
|
||||
return *it->second;
|
||||
}
|
||||
|
||||
|
||||
void Area::AddGeyser(Geyser * pGeyser)
|
||||
{
|
||||
bwem_assert(pGeyser && !contains(m_Geysers, pGeyser));
|
||||
m_Geysers.push_back(pGeyser);
|
||||
}
|
||||
|
||||
|
||||
void Area::AddMineral(Mineral * pMineral)
|
||||
{
|
||||
bwem_assert(pMineral && !contains(m_Minerals, pMineral));
|
||||
m_Minerals.push_back(pMineral);
|
||||
}
|
||||
|
||||
|
||||
void Area::OnMineralDestroyed(const Mineral * pMineral)
|
||||
{
|
||||
bwem_assert(pMineral);
|
||||
|
||||
auto iMineral = find(m_Minerals.begin(), m_Minerals.end(), pMineral);
|
||||
if (iMineral != m_Minerals.end())
|
||||
fast_erase(m_Minerals, distance(m_Minerals.begin(), iMineral));
|
||||
|
||||
// let's examine the bases even if pMineral was not found in this Area,
|
||||
// which could arise if Minerals were allowed to be assigned to neighbouring Areas.
|
||||
for (Base & base : Bases())
|
||||
base.OnMineralDestroyed(pMineral);
|
||||
}
|
||||
|
||||
|
||||
void Area::AddChokePoints(Area * pArea, vector<ChokePoint> * pChokePoints)
|
||||
{
|
||||
bwem_assert(!m_ChokePointsByArea[pArea] && pChokePoints);
|
||||
|
||||
m_ChokePointsByArea[pArea] = pChokePoints;
|
||||
|
||||
for (const auto & cp : *pChokePoints)
|
||||
m_ChokePoints.push_back(&cp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
vector<int> Area::ComputeDistances(const ChokePoint * pStartCP, const vector<const ChokePoint *> & TargetCPs) const
|
||||
{
|
||||
bwem_assert(!contains(TargetCPs, pStartCP));
|
||||
|
||||
TilePosition start = GetMap()->BreadthFirstSearch(TilePosition(pStartCP->PosInArea(ChokePoint::middle, this)),
|
||||
[this](const Tile & tile, TilePosition) { return tile.AreaId() == Id(); }, // findCond
|
||||
[](const Tile &, TilePosition) { return true; }); // visitCond
|
||||
|
||||
vector<TilePosition> Targets;
|
||||
for (const ChokePoint * cp : TargetCPs)
|
||||
Targets.push_back(GetMap()->BreadthFirstSearch(TilePosition(cp->PosInArea(ChokePoint::middle, this)),
|
||||
[this](const Tile & tile, TilePosition) { return tile.AreaId() == Id(); }, // findCond
|
||||
[](const Tile &, TilePosition) { return true; })); // visitCond
|
||||
|
||||
return ComputeDistances(start, Targets);
|
||||
}
|
||||
|
||||
|
||||
// Returns Distances such that Distances[i] == ground_distance(start, Targets[i]) in pixels
|
||||
// Note: same algorithm than Graph::ComputeDistances (derived from Dijkstra)
|
||||
vector<int> Area::ComputeDistances(TilePosition start, const vector<TilePosition> & Targets) const
|
||||
{
|
||||
const Map * pMap = GetMap();
|
||||
vector<int> Distances(Targets.size());
|
||||
|
||||
Tile::UnmarkAll();
|
||||
|
||||
multimap<int, TilePosition> ToVisit; // a priority queue holding the tiles to visit ordered by their distance to start.
|
||||
ToVisit.emplace(0, start);
|
||||
|
||||
int remainingTargets = Targets.size();
|
||||
while (!ToVisit.empty())
|
||||
{
|
||||
int currentDist = ToVisit.begin()->first;
|
||||
TilePosition current = ToVisit.begin()->second;
|
||||
const Tile & currentTile = pMap->GetTile(current, check_t::no_check);
|
||||
bwem_assert(currentTile.InternalData() == currentDist);
|
||||
ToVisit.erase(ToVisit.begin());
|
||||
currentTile.SetInternalData(0); // resets Tile::m_internalData for future usage
|
||||
currentTile.SetMarked();
|
||||
|
||||
for (int i = 0 ; i < (int)Targets.size() ; ++i)
|
||||
if (current == Targets[i])
|
||||
{
|
||||
Distances[i] = int(0.5 + currentDist * 32 / 10000.0);
|
||||
--remainingTargets;
|
||||
}
|
||||
if (!remainingTargets) break;
|
||||
|
||||
for (TilePosition delta : { TilePosition(-1, -1), TilePosition(0, -1), TilePosition(+1, -1),
|
||||
TilePosition(-1, 0), TilePosition(+1, 0),
|
||||
TilePosition(-1, +1), TilePosition(0, +1), TilePosition(+1, +1)})
|
||||
{
|
||||
const bool diagonalMove = (delta.x != 0) && (delta.y != 0);
|
||||
const int newNextDist = currentDist + (diagonalMove ? 14142 : 10000);
|
||||
|
||||
TilePosition next = current + delta;
|
||||
if (pMap->Valid(next))
|
||||
{
|
||||
const Tile & nextTile = pMap->GetTile(next, check_t::no_check);
|
||||
if (!nextTile.Marked())
|
||||
{
|
||||
if (nextTile.InternalData()) // next already in ToVisit
|
||||
{
|
||||
if (newNextDist < nextTile.InternalData()) // nextNewDist < nextOldDist
|
||||
{ // To update next's distance, we need to remove-insert it from ToVisit:
|
||||
auto range = ToVisit.equal_range(nextTile.InternalData());
|
||||
auto iNext = find_if(range.first, range.second, [next]
|
||||
(const pair<int, TilePosition> & e) { return e.second == next; });
|
||||
bwem_assert(iNext != range.second);
|
||||
|
||||
ToVisit.erase(iNext);
|
||||
nextTile.SetInternalData(newNextDist);
|
||||
// nextTile.SetPtr(const_cast<Tile *>(¤tTile)); // note: we won't use this backward trace
|
||||
ToVisit.emplace(newNextDist, next);
|
||||
}
|
||||
}
|
||||
else if ((nextTile.AreaId() == Id()) || (nextTile.AreaId() == -1))
|
||||
{
|
||||
nextTile.SetInternalData(newNextDist);
|
||||
// nextTile.SetPtr(const_cast<Tile *>(¤tTile)); // note: we won't use this backward trace
|
||||
ToVisit.emplace(newNextDist, next);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bwem_assert(!remainingTargets);
|
||||
|
||||
// Reset Tile::m_internalData for future usage
|
||||
for (auto e : ToVisit)
|
||||
pMap->GetTile(e.second, check_t::no_check).SetInternalData(0);
|
||||
|
||||
return Distances;
|
||||
}
|
||||
|
||||
|
||||
void Area::UpdateAccessibleNeighbours()
|
||||
{
|
||||
m_AccessibleNeighbours.clear();
|
||||
|
||||
for (auto it : ChokePointsByArea())
|
||||
if (any_of(it.second->begin(), it.second->end(), [](const ChokePoint & cp){ return !cp.Blocked(); }))
|
||||
m_AccessibleNeighbours.push_back(it.first);
|
||||
}
|
||||
|
||||
|
||||
// Called for each tile t of this Area
|
||||
void Area::AddTileInformation(const BWAPI::TilePosition t, const Tile & tile)
|
||||
{
|
||||
++m_tiles;
|
||||
if (tile.Buildable()) ++m_buildableTiles;
|
||||
if (tile.GroundHeight() == 1) ++m_highGroundTiles;
|
||||
if (tile.GroundHeight() == 2) ++m_veryHighGroundTiles;
|
||||
|
||||
if (t.x < m_topLeft.x) m_topLeft.x = t.x;
|
||||
if (t.y < m_topLeft.y) m_topLeft.y = t.y;
|
||||
if (t.x > m_bottomRight.x) m_bottomRight.x = t.x;
|
||||
if (t.y > m_bottomRight.y) m_bottomRight.y = t.y;
|
||||
}
|
||||
|
||||
|
||||
// Called after AddTileInformation(t) has been called for each tile t of this Area
|
||||
void Area::PostCollectInformation()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Calculates the score >= 0 corresponding to the placement of a Base Command Center at 'location'.
|
||||
// The more there are ressources nearby, the higher the score is.
|
||||
// The function assumes the distance to the nearby ressources has already been computed (in InternalData()) for each tile around.
|
||||
// The job is therefore made easier : just need to sum the InternalData() values.
|
||||
// Returns -1 if the location is impossible.
|
||||
|
||||
int Area::ComputeBaseLocationScore(TilePosition location) const
|
||||
{
|
||||
const Map * pMap = GetMap();
|
||||
const TilePosition dimCC = UnitType(Terran_Command_Center).tileSize();
|
||||
|
||||
int sumScore = 0;
|
||||
for (int dy = 0 ; dy < dimCC.y ; ++dy)
|
||||
for (int dx = 0 ; dx < dimCC.x ; ++dx)
|
||||
{
|
||||
const Tile & tile = pMap->GetTile(location + TilePosition(dx, dy), check_t::no_check);
|
||||
if (!tile.Buildable()) return -1;
|
||||
if (tile.InternalData() == -1) return -1; // The special value InternalData() == -1 means there is some ressource at maximum 3 tiles, which Starcraft rules forbid.
|
||||
// Unfortunately, this is guaranteed only for the ressources in this Area, which is the very reason of ValidateBaseLocation
|
||||
if (tile.AreaId() != Id()) return -1;
|
||||
if (tile.GetNeutral() && tile.GetNeutral()->IsStaticBuilding()) return -1;
|
||||
|
||||
sumScore += tile.InternalData();
|
||||
}
|
||||
|
||||
return sumScore;
|
||||
}
|
||||
|
||||
|
||||
// Checks if 'location' is a valid location for the placement of a Base Command Center.
|
||||
// If the location is valid except for the presence of Mineral patches of less than 9 (see Andromeda.scx),
|
||||
// the function returns true, and these Minerals are reported in BlockingMinerals
|
||||
// The function is intended to be called after ComputeBaseLocationScore, as it is more expensive.
|
||||
// See also the comments inside ComputeBaseLocationScore.
|
||||
bool Area::ValidateBaseLocation(TilePosition location, vector<Mineral *> & BlockingMinerals) const
|
||||
{
|
||||
const Map * pMap = GetMap();
|
||||
const TilePosition dimCC = UnitType(Terran_Command_Center).tileSize();
|
||||
|
||||
BlockingMinerals.clear();
|
||||
|
||||
for (int dy = -3 ; dy < dimCC.y + 3 ; ++dy)
|
||||
for (int dx = -3 ; dx < dimCC.x + 3 ; ++dx)
|
||||
{
|
||||
TilePosition t = location + TilePosition(dx, dy);
|
||||
if (pMap->Valid(t))
|
||||
{
|
||||
const Tile & tile = pMap->GetTile(t, check_t::no_check);
|
||||
if (Neutral * n = tile.GetNeutral())
|
||||
{
|
||||
if (n->IsGeyser()) return false;
|
||||
if (Mineral * m = n->IsMineral())
|
||||
if (m->InitialAmount() <= 8) BlockingMinerals.push_back(m);
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checks the distance to the Bases already created:
|
||||
for (const Base & base : Bases())
|
||||
if (roundedDist(base.Location(), location) < min_tiles_between_Bases) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Fills in m_Bases with good locations in this Area.
|
||||
// The algorithm repeatedly searches the best possible location L (near ressources)
|
||||
// When it finds one, the nearby ressources are assigned to L, which makes the remaining ressources decrease.
|
||||
// This causes the algorithm to always terminate due to the lack of remaining ressources.
|
||||
// To efficiently compute the distances to the ressources, with use Potiential Fields in the InternalData() value of the Tiles.
|
||||
void Area::CreateBases()
|
||||
{
|
||||
const TilePosition dimCC = UnitType(Terran_Command_Center).tileSize();
|
||||
const Map * pMap = GetMap();
|
||||
|
||||
|
||||
// Initialize the RemainingRessources with all the Minerals and Geysers in this Area satisfying some conditions:
|
||||
vector<Ressource *> RemainingRessources;
|
||||
for (Mineral * m : Minerals()) if ((m->InitialAmount() >= 40) && !m->Blocking()) RemainingRessources.push_back(m);
|
||||
for (Geyser * g : Geysers()) if ((g->InitialAmount() >= 300) && !g->Blocking()) RemainingRessources.push_back(g);
|
||||
|
||||
m_Bases.reserve(min(100, (int)RemainingRessources.size()));
|
||||
|
||||
while (!RemainingRessources.empty())
|
||||
{
|
||||
// 1) Calculate the SearchBoundingBox (needless to search too far from the RemainingRessources):
|
||||
|
||||
TilePosition topLeftRessources = {numeric_limits<int>::max(), numeric_limits<int>::max()};
|
||||
TilePosition bottomRightRessources = {numeric_limits<int>::min(), numeric_limits<int>::min()};
|
||||
for (const Ressource * r : RemainingRessources)
|
||||
{
|
||||
makeBoundingBoxIncludePoint(topLeftRessources, bottomRightRessources, r->TopLeft());
|
||||
makeBoundingBoxIncludePoint(topLeftRessources, bottomRightRessources, r->BottomRight());
|
||||
}
|
||||
|
||||
TilePosition topLeftSearchBoundingBox = topLeftRessources - dimCC - max_tiles_between_CommandCenter_and_ressources;
|
||||
TilePosition bottomRightSearchBoundingBox = bottomRightRessources + 1 + max_tiles_between_CommandCenter_and_ressources;
|
||||
makePointFitToBoundingBox(topLeftSearchBoundingBox, TopLeft(), BottomRight() - dimCC + 1);
|
||||
makePointFitToBoundingBox(bottomRightSearchBoundingBox, TopLeft(), BottomRight() - dimCC + 1);
|
||||
|
||||
// 2) Mark the Tiles with their distances from each remaining Ressource (Potential Fields >= 0)
|
||||
for (const Ressource * r : RemainingRessources)
|
||||
for (int dy = -dimCC.y-max_tiles_between_CommandCenter_and_ressources ; dy < r->Size().y + dimCC.y+max_tiles_between_CommandCenter_and_ressources ; ++dy)
|
||||
for (int dx = -dimCC.x-max_tiles_between_CommandCenter_and_ressources ; dx < r->Size().x + dimCC.x+max_tiles_between_CommandCenter_and_ressources ; ++dx)
|
||||
{
|
||||
TilePosition t = r->TopLeft() + TilePosition(dx, dy);
|
||||
if (pMap->Valid(t))
|
||||
{
|
||||
const Tile & tile = pMap->GetTile(t, check_t::no_check);
|
||||
int dist = (distToRectangle(center(t), r->TopLeft(), r->Size())+16)/32;
|
||||
int score = max(max_tiles_between_CommandCenter_and_ressources + 3 - dist, 0);
|
||||
if (r->IsGeyser()) score *= 3; // somewhat compensates for Geyser alone vs the several Minerals
|
||||
if (tile.AreaId() == Id()) tile.SetInternalData(tile.InternalData() + score); // note the additive effect (assume tile.InternalData() is 0 at the begining)
|
||||
}
|
||||
}
|
||||
|
||||
// 3) Invalidate the 7 x 7 Tiles around each remaining Ressource (Starcraft rule)
|
||||
for (const Ressource * r : RemainingRessources)
|
||||
for (int dy = -3 ; dy < r->Size().y + 3 ; ++dy)
|
||||
for (int dx = -3 ; dx < r->Size().x + 3 ; ++dx)
|
||||
{
|
||||
TilePosition t = r->TopLeft() + TilePosition(dx, dy);
|
||||
if (pMap->Valid(t))
|
||||
pMap->GetTile(t, check_t::no_check).SetInternalData(-1);
|
||||
}
|
||||
|
||||
|
||||
// 4) Search the best location inside the SearchBoundingBox:
|
||||
TilePosition bestLocation;
|
||||
int bestScore = 0;
|
||||
vector<Mineral *> BlockingMinerals;
|
||||
|
||||
for (int y = topLeftSearchBoundingBox.y ; y <= bottomRightSearchBoundingBox.y ; ++y)
|
||||
for (int x = topLeftSearchBoundingBox.x ; x <= bottomRightSearchBoundingBox.x ; ++x)
|
||||
{
|
||||
int score = ComputeBaseLocationScore(TilePosition(x, y));
|
||||
if (score > bestScore)
|
||||
if (ValidateBaseLocation(TilePosition(x, y), BlockingMinerals))
|
||||
{
|
||||
bestScore = score;
|
||||
bestLocation = TilePosition(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// 5) Clear Tile::m_internalData (required due to our use of Potential Fields: see comments in 2))
|
||||
for (const Ressource * r : RemainingRessources)
|
||||
for (int dy = -dimCC.y-max_tiles_between_CommandCenter_and_ressources ; dy < r->Size().y + dimCC.y+max_tiles_between_CommandCenter_and_ressources ; ++dy)
|
||||
for (int dx = -dimCC.x-max_tiles_between_CommandCenter_and_ressources ; dx < r->Size().x + dimCC.x+max_tiles_between_CommandCenter_and_ressources ; ++dx)
|
||||
{
|
||||
TilePosition t = r->TopLeft() + TilePosition(dx, dy);
|
||||
if (pMap->Valid(t)) pMap->GetTile(t, check_t::no_check).SetInternalData(0);
|
||||
}
|
||||
|
||||
if (!bestScore) break;
|
||||
|
||||
// 6) Create a new Base at bestLocation, assign to it the relevant ressources and remove them from RemainingRessources:
|
||||
vector<Ressource *> AssignedRessources;
|
||||
for (Ressource * r : RemainingRessources)
|
||||
if (distToRectangle(r->Pos(), bestLocation, dimCC) + 2 <= max_tiles_between_CommandCenter_and_ressources*32)
|
||||
AssignedRessources.push_back(r);
|
||||
really_remove_if(RemainingRessources, [&AssignedRessources](const Ressource * r){ return contains(AssignedRessources, r); });
|
||||
|
||||
if (AssignedRessources.empty())
|
||||
{
|
||||
//bwem_assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
m_Bases.emplace_back(this, bestLocation, AssignedRessources, BlockingMinerals);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace BWEM
|
||||
|
||||
|
||||
|
190
Source/BWEM/src/area.h
Normal file
|
@ -0,0 +1,190 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file is part of the BWEM Library.
|
||||
// BWEM is free software, licensed under the MIT/X11 License.
|
||||
// A copy of the license is provided with the library in the LICENSE file.
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef BWEM_AREA_H
|
||||
#define BWEM_AREA_H
|
||||
|
||||
#include <BWAPI.h>
|
||||
#include "bwapiExt.h"
|
||||
#include "utils.h"
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
namespace BWEM {
|
||||
|
||||
class Mineral;
|
||||
class Geyser;
|
||||
class Tile;
|
||||
class Base;
|
||||
class ChokePoint;
|
||||
class Map;
|
||||
|
||||
namespace detail { class Graph; }
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// class Area
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Areas are regions that BWEM automatically computes from Brood War's maps
|
||||
// Areas aim at capturing relevant regions that can be walked, though they may contain small inner non walkable regions called lakes.
|
||||
// More formally:
|
||||
// - An area consists in a set of 4-connected MiniTiles, which are either Terrain-MiniTiles or Lake-MiniTiles.
|
||||
// - An Area is delimited by the side of the Map, by Water-MiniTiles, or by other Areas. In the latter case
|
||||
// the adjoining Areas are called neighbouring Areas, and each pair of such Areas defines at least one ChokePoint.
|
||||
// Like ChokePoints and Bases, the number and the addresses of Area instances remain unchanged.
|
||||
// To access Areas one can use their ids or their addresses with equivalent efficiency.
|
||||
//
|
||||
// Areas inherit utils::Markable, which provides marking ability
|
||||
// Areas inherit utils::UserData, which provides free-to-use data.
|
||||
|
||||
class Area : public utils::Markable<Area, int>, public utils::UserData
|
||||
{
|
||||
public:
|
||||
typedef int16_t id;
|
||||
|
||||
typedef int16_t groupId;
|
||||
|
||||
// Unique id > 0 of this Area. Range = 1 .. Map::Areas().size()
|
||||
// this == Map::GetArea(Id())
|
||||
// Id() == Map::GetMiniTile(w).AreaId() for each walkable MiniTile w in this Area.
|
||||
// Area::ids are guaranteed to remain unchanged.
|
||||
id Id() const { return m_id; }
|
||||
|
||||
// Unique id > 0 of the group of Areas which are accessible from this Area.
|
||||
// For each pair (a, b) of Areas: a->GroupId() == b->GroupId() <==> a->AccessibleFrom(b)
|
||||
// A groupId uniquely identifies a maximum set of mutually accessible Areas, that is, in the absence of blocking ChokePoints, a continent.
|
||||
groupId GroupId() const { return m_groupId; }
|
||||
|
||||
// Bounding box of this Area.
|
||||
const BWAPI::TilePosition & TopLeft() const { return m_topLeft ; }
|
||||
const BWAPI::TilePosition & BottomRight() const { return m_bottomRight ; }
|
||||
BWAPI::TilePosition BoundingBoxSize() const;
|
||||
|
||||
// Position of the MiniTile with the highest Altitude() value.
|
||||
const BWAPI::WalkPosition & Top() const { return m_top; }
|
||||
|
||||
// Returns Map::GetMiniTile(Top()).Altitude().
|
||||
altitude_t MaxAltitude() const { return m_maxAltitude; }
|
||||
|
||||
// Returns the number of MiniTiles in this Area.
|
||||
// This most accurately defines the size of this Area.
|
||||
int MiniTiles() const { return m_miniTiles; }
|
||||
|
||||
// Returns the percentage of low ground Tiles in this Area.
|
||||
int LowGroundPercentage() const { return (m_tiles - m_highGroundTiles - m_veryHighGroundTiles) * 100 / m_tiles; }
|
||||
|
||||
// Returns the percentage of high ground Tiles in this Area.
|
||||
int HighGroundPercentage() const { return m_highGroundTiles * 100 / m_tiles; }
|
||||
|
||||
// Returns the percentage of very high ground Tiles in this Area.
|
||||
int VeryHighGroundPercentage() const { return m_veryHighGroundTiles * 100 / m_tiles; }
|
||||
|
||||
// Returns the ChokePoints between this Area and the neighbouring ones.
|
||||
// Note: if there are no neighbouring Areas, then an empty set is returned.
|
||||
// Note there may be more ChokePoints returned than the number of neighbouring Areas, as there may be several ChokePoints between two Areas (Cf. ChokePoints(const Area * pArea)).
|
||||
const std::vector<const ChokePoint *> & ChokePoints() const { return m_ChokePoints; }
|
||||
|
||||
// Returns the ChokePoints between this Area and pArea.
|
||||
// Assumes pArea is a neighbour of this Area, i.e. ChokePointsByArea().find(pArea) != ChokePointsByArea().end()
|
||||
// Note: there is always at least one ChokePoint between two neighbouring Areas.
|
||||
const std::vector<ChokePoint> & ChokePoints(const Area * pArea) const;
|
||||
|
||||
// Returns the ChokePoints of this Area grouped by neighbouring Areas
|
||||
// Note: if there are no neighbouring Areas, than an empty set is returned.
|
||||
const std::map<const Area *, const std::vector<ChokePoint> *> & ChokePointsByArea() const { return m_ChokePointsByArea; }
|
||||
|
||||
// Returns the accessible neighbouring Areas.
|
||||
// The accessible neighbouring Areas are a subset of the neighbouring Areas (the neighbouring Areas can be iterated using ChokePointsByArea()).
|
||||
// Two neighbouring Areas are accessible from each over if at least one the ChokePoints they share is not Blocked (Cf. ChokePoint::Blocked).
|
||||
const std::vector<const Area *>&AccessibleNeighbours() const { return m_AccessibleNeighbours; }
|
||||
|
||||
// Returns whether this Area is accessible from pArea, that is, if they share the same GroupId().
|
||||
// Note: accessibility is always symmetrical.
|
||||
// Note: even if a and b are neighbouring Areas,
|
||||
// we can have: a->AccessibleFrom(b)
|
||||
// and not: contains(a->AccessibleNeighbours(), b)
|
||||
// See also GroupId()
|
||||
bool AccessibleFrom(const Area * pArea) const { return GroupId() == pArea->GroupId(); }
|
||||
|
||||
// Returns the Minerals contained in this Area.
|
||||
// Note: only a call to Map::OnMineralDestroyed(BWAPI::Unit u) may change the result (by removing eventually one element).
|
||||
const std::vector<Mineral *> & Minerals() const { return m_Minerals; }
|
||||
|
||||
// Returns the Geysers contained in this Area.
|
||||
// Note: the result will remain unchanged.
|
||||
const std::vector<Geyser *> & Geysers() const { return m_Geysers; }
|
||||
|
||||
// Returns the Bases contained in this Area.
|
||||
// Note: the result will remain unchanged.
|
||||
const std::vector<Base> & Bases() const { return m_Bases; }
|
||||
|
||||
Map * GetMap() const;
|
||||
|
||||
Area & operator=(const Area &) = delete;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Details: The functions below are used by the BWEM's internals
|
||||
|
||||
Area(detail::Graph * pGraph, id areaId, BWAPI::WalkPosition top, int miniTiles);
|
||||
Area(const Area & Other);
|
||||
void AddChokePoints(Area * pArea, std::vector<ChokePoint> * pChokePoints);
|
||||
void AddMineral(Mineral * pMineral);
|
||||
void AddGeyser(Geyser * pGeyser);
|
||||
void AddTileInformation(const BWAPI::TilePosition t, const Tile & tile);
|
||||
void OnMineralDestroyed(const Mineral * pMineral);
|
||||
void PostCollectInformation();
|
||||
std::vector<int> ComputeDistances(const ChokePoint * pStartCP, const std::vector<const ChokePoint *> & TargetCPs) const;
|
||||
void UpdateAccessibleNeighbours();
|
||||
void SetGroupId(groupId gid) { bwem_assert(gid >= 1); m_groupId = gid; }
|
||||
void CreateBases();
|
||||
std::vector<Base> & Bases() { return m_Bases; }
|
||||
|
||||
private:
|
||||
const detail::Graph * GetGraph() const { return m_pGraph; }
|
||||
detail::Graph * GetGraph() { return m_pGraph; }
|
||||
|
||||
int ComputeBaseLocationScore(BWAPI::TilePosition location) const;
|
||||
bool ValidateBaseLocation(BWAPI::TilePosition location, std::vector<Mineral *> & BlockingMinerals) const;
|
||||
std::vector<int> ComputeDistances(BWAPI::TilePosition start, const std::vector<BWAPI::TilePosition> & Targets) const;
|
||||
|
||||
detail::Graph * const m_pGraph;
|
||||
id m_id;
|
||||
groupId m_groupId = 0;
|
||||
BWAPI::WalkPosition m_top;
|
||||
BWAPI::TilePosition m_topLeft = {std::numeric_limits<int>::max(), std::numeric_limits<int>::max()};
|
||||
BWAPI::TilePosition m_bottomRight = {std::numeric_limits<int>::min(), std::numeric_limits<int>::min()};
|
||||
altitude_t m_maxAltitude;
|
||||
int m_miniTiles;
|
||||
int m_tiles = 0;
|
||||
int m_buildableTiles = 0;
|
||||
int m_highGroundTiles = 0;
|
||||
int m_veryHighGroundTiles = 0;
|
||||
|
||||
std::map<const Area *, const std::vector<ChokePoint> *> m_ChokePointsByArea;
|
||||
std::vector<const Area *> m_AccessibleNeighbours;
|
||||
std::vector<const ChokePoint *> m_ChokePoints;
|
||||
std::vector<Mineral *> m_Minerals;
|
||||
std::vector<Geyser *> m_Geysers;
|
||||
std::vector<Base> m_Bases;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace BWEM
|
||||
|
||||
|
||||
#endif
|
||||
|
85
Source/BWEM/src/base.cpp
Normal file
|
@ -0,0 +1,85 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file is part of the BWEM Library.
|
||||
// BWEM is free software, licensed under the MIT/X11 License.
|
||||
// A copy of the license is provided with the library in the LICENSE file.
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "base.h"
|
||||
#include "graph.h"
|
||||
#include "mapImpl.h"
|
||||
#include "neutral.h"
|
||||
#include "bwapiExt.h"
|
||||
|
||||
|
||||
using namespace BWAPI;
|
||||
using namespace BWAPI::UnitTypes::Enum;
|
||||
namespace { auto & bw = Broodwar; }
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace BWEM {
|
||||
|
||||
using namespace detail;
|
||||
using namespace BWAPI_ext;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// class Base
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Base::Base(Area * pArea, const TilePosition & location, const vector<Ressource *> & AssignedRessources, const vector<Mineral *> & BlockingMinerals)
|
||||
: m_pArea(pArea),
|
||||
m_pMap(pArea->GetMap()),
|
||||
m_location(location),
|
||||
m_center(Position(location) + Position(UnitType(Terran_Command_Center).tileSize()) / 2),
|
||||
m_BlockingMinerals(BlockingMinerals)
|
||||
{
|
||||
bwem_assert(!AssignedRessources.empty());
|
||||
|
||||
for (Ressource * r : AssignedRessources)
|
||||
if (Mineral * m = r->IsMineral()) m_Minerals.push_back(m);
|
||||
else if (Geyser * g = r->IsGeyser()) m_Geysers.push_back(g);
|
||||
}
|
||||
|
||||
|
||||
Base::Base(const Base & Other)
|
||||
: m_pMap(Other.m_pMap), m_pArea(Other.m_pArea)
|
||||
{
|
||||
bwem_assert(false);
|
||||
}
|
||||
|
||||
|
||||
void Base::SetStartingLocation(const TilePosition & actualLocation)
|
||||
{
|
||||
m_starting = true;
|
||||
m_location = actualLocation;
|
||||
m_center = Position(actualLocation) + Position(UnitType(Terran_Command_Center).tileSize()) / 2;
|
||||
}
|
||||
|
||||
|
||||
void Base::OnMineralDestroyed(const Mineral * pMineral)
|
||||
{
|
||||
bwem_assert(pMineral);
|
||||
|
||||
auto iMineral = find(m_Minerals.begin(), m_Minerals.end(), pMineral);
|
||||
if (iMineral != m_Minerals.end())
|
||||
fast_erase(m_Minerals, distance(m_Minerals.begin(), iMineral));
|
||||
|
||||
iMineral = find(m_BlockingMinerals.begin(), m_BlockingMinerals.end(), pMineral);
|
||||
if (iMineral != m_BlockingMinerals.end())
|
||||
fast_erase(m_BlockingMinerals, distance(m_BlockingMinerals.begin(), iMineral));
|
||||
}
|
||||
|
||||
|
||||
} // namespace BWEM
|
||||
|
||||
|
||||
|
117
Source/BWEM/src/base.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file is part of the BWEM Library.
|
||||
// BWEM is free software, licensed under the MIT/X11 License.
|
||||
// A copy of the license is provided with the library in the LICENSE file.
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef BWEM_BASE_H
|
||||
#define BWEM_BASE_H
|
||||
|
||||
#include <BWAPI.h>
|
||||
#include "utils.h"
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
namespace BWEM {
|
||||
|
||||
class Ressource;
|
||||
class Mineral;
|
||||
class Geyser;
|
||||
class Area;
|
||||
class Map;
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// class Base
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// After Areas and ChokePoints, Bases are the third kind of object BWEM automatically computes from Brood War's maps.
|
||||
// A Base is essentially a suggested location (intended to be optimal) to put a Command Center, Nexus, or Hatchery.
|
||||
// It also provides information on the ressources available, and some statistics.
|
||||
// A Base alway belongs to some Area. An Area may contain zero, one or several Bases.
|
||||
// Like Areas and ChokePoints, the number and the addresses of Base instances remain unchanged.
|
||||
//
|
||||
// Bases inherit utils::UserData, which provides free-to-use data.
|
||||
|
||||
class Base : public utils::UserData
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
// Tells whether this Base's location is contained in Map::StartingLocations()
|
||||
// Note: all players start at locations taken from Map::StartingLocations(),
|
||||
// which doesn't mean all the locations in Map::StartingLocations() are actually used.
|
||||
bool Starting() const { return m_starting; }
|
||||
|
||||
// Returns the Area this Base belongs to.
|
||||
const Area * GetArea() const { return m_pArea; }
|
||||
|
||||
// Returns the location of this Base (top left Tile position).
|
||||
// If Starting() == true, it is guaranteed that the loction corresponds exactly to one of Map::StartingLocations().
|
||||
const BWAPI::TilePosition & Location() const { return m_location; }
|
||||
|
||||
// Returns the location of this Base (center in pixels).
|
||||
const BWAPI::Position & Center() const { return m_center; }
|
||||
|
||||
// Returns the available Minerals.
|
||||
// These Minerals are assigned to this Base (it is guaranteed that no other Base provides them).
|
||||
// Note: The size of the returned list may decrease, as some of the Minerals may get destroyed.
|
||||
const std::vector<Mineral *> & Minerals() const { return m_Minerals; }
|
||||
|
||||
// Returns the available Geysers.
|
||||
// These Geysers are assigned to this Base (it is guaranteed that no other Base provides them).
|
||||
// Note: The size of the returned list may NOT decrease, as Geysers never get destroyed.
|
||||
const std::vector<Geyser *> & Geysers() const { return m_Geysers; }
|
||||
|
||||
// Returns the blocking Minerals.
|
||||
// These Minerals are special ones: they are placed at the exact location of this Base (or very close),
|
||||
// thus blocking the building of a Command Center, Nexus, or Hatchery.
|
||||
// So before trying to build this Base, one have to finish gathering these Minerals first.
|
||||
// Fortunately, these are guaranteed to have their InitialAmount() <= 8.
|
||||
// As an example of blocking Minerals, see the two islands in Andromeda.scx.
|
||||
// Note: if Starting() == true, an empty list is returned.
|
||||
// Note Base::BlockingMinerals() should not be confused with ChokePoint::BlockingNeutral() and Neutral::Blocking():
|
||||
// the last two refer to a Neutral blocking a ChokePoint, not a Base.
|
||||
const std::vector<Mineral *> & BlockingMinerals() const { return m_BlockingMinerals; }
|
||||
|
||||
Base & operator=(const Base &) = delete;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Details: The functions below are used by the BWEM's internals
|
||||
|
||||
Base(Area * pArea, const BWAPI::TilePosition & location, const std::vector<Ressource *> & AssignedRessources, const std::vector<Mineral *> & BlockingMinerals);
|
||||
Base(const Base & Other);
|
||||
void SetStartingLocation(const BWAPI::TilePosition & actualLocation);
|
||||
void OnMineralDestroyed(const Mineral * pMineral);
|
||||
|
||||
private:
|
||||
Map * GetMap() const { return m_pMap; }
|
||||
Map * GetMap() { return m_pMap; }
|
||||
|
||||
Map * const m_pMap;
|
||||
Area * const m_pArea;
|
||||
BWAPI::TilePosition m_location;
|
||||
BWAPI::Position m_center;
|
||||
std::vector<Mineral *> m_Minerals;
|
||||
std::vector<Geyser *> m_Geysers;
|
||||
std::vector<Mineral *> m_BlockingMinerals;
|
||||
bool m_starting = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace BWEM
|
||||
|
||||
|
||||
#endif
|
||||
|
39
Source/BWEM/src/bwapiExt.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file is part of the BWEM Library.
|
||||
// BWEM is free software, licensed under the MIT/X11 License.
|
||||
// A copy of the license is provided with the library in the LICENSE file.
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "bwapiExt.h"
|
||||
|
||||
|
||||
using namespace BWAPI;
|
||||
using namespace BWAPI::UnitTypes::Enum;
|
||||
namespace { auto & bw = Broodwar; }
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace BWEM {
|
||||
|
||||
using namespace utils;
|
||||
using namespace detail;
|
||||
|
||||
namespace BWAPI_ext {
|
||||
|
||||
|
||||
void drawDiagonalCrossMap(BWAPI::Position topLeft, BWAPI::Position bottomRight, BWAPI::Color col)
|
||||
{
|
||||
bw->drawLineMap(topLeft, bottomRight, col);
|
||||
bw->drawLineMap(Position(bottomRight.x, topLeft.y), Position(topLeft.x, bottomRight.y), col);
|
||||
}
|
||||
|
||||
|
||||
}} // namespace BWEM::BWAPI_ext
|
||||
|
||||
|
||||
|
179
Source/BWEM/src/bwapiExt.h
Normal file
|
@ -0,0 +1,179 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file is part of the BWEM Library.
|
||||
// BWEM is free software, licensed under the MIT/X11 License.
|
||||
// A copy of the license is provided with the library in the LICENSE file.
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef BWEM_BWAPI_EXT_H
|
||||
#define BWEM_BWAPI_EXT_H
|
||||
|
||||
#include <BWAPI.h>
|
||||
#include "utils.h"
|
||||
#include "defs.h"
|
||||
#include <vector>
|
||||
|
||||
namespace BWEM {
|
||||
|
||||
|
||||
namespace BWAPI_ext {
|
||||
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline std::ostream & operator<<(std::ostream & out, BWAPI::Point<T, Scale> A) { out << "(" << A.x << ", " << A.y << ")"; return out; }
|
||||
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline BWAPI::Position center(BWAPI::Point<T, Scale> A) { return BWAPI::Position(A) + BWAPI::Position(Scale/2, Scale/2); }
|
||||
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline BWAPI::Point<T, Scale> operator+(BWAPI::Point<T, Scale> A, int b) { return A + BWAPI::Point<T, Scale>(b, b); }
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline BWAPI::Point<T, Scale> operator+(int a, BWAPI::Point<T, Scale> B) { return B + a; }
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline BWAPI::Point<T, Scale> operator-(BWAPI::Point<T, Scale> A, int b) { return A + (-b); }
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline BWAPI::Point<T, Scale> operator-(int a, BWAPI::Point<T, Scale> B) { return a + (B*-1); }
|
||||
|
||||
|
||||
// Enlarges the bounding box [TopLeft, BottomRight] so that it includes A.
|
||||
template<typename T, int Scale = 1>
|
||||
inline void makeBoundingBoxIncludePoint(BWAPI::Point<T, Scale> & TopLeft, BWAPI::Point<T, Scale> & BottomRight, const BWAPI::Point<T, Scale> & A)
|
||||
{
|
||||
if (A.x < TopLeft.x) TopLeft.x = A.x;
|
||||
if (A.x > BottomRight.x) BottomRight.x = A.x;
|
||||
|
||||
if (A.y < TopLeft.y) TopLeft.y = A.y;
|
||||
if (A.y > BottomRight.y) BottomRight.y = A.y;
|
||||
}
|
||||
|
||||
|
||||
// Makes the smallest change to A so that it is included in the bounding box [TopLeft, BottomRight].
|
||||
template<typename T, int Scale = 1>
|
||||
inline void makePointFitToBoundingBox(BWAPI::Point<T, Scale> & A, const BWAPI::Point<T, Scale> & TopLeft, const BWAPI::Point<T, Scale> & BottomRight)
|
||||
{
|
||||
if (A.x < TopLeft.x) A.x = TopLeft.x;
|
||||
else if (A.x > BottomRight.x) A.x = BottomRight.x;
|
||||
|
||||
if (A.y < TopLeft.y) A.y = TopLeft.y;
|
||||
else if (A.y > BottomRight.y) A.y = BottomRight.y;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
bool inBoundingBox(const BWAPI::Point<T, Scale> & A, const BWAPI::Point<T, Scale> & topLeft, const BWAPI::Point<T, Scale> & bottomRight)
|
||||
{
|
||||
return (A.x >= topLeft.x) && (A.x <= bottomRight.x) &&
|
||||
(A.y >= topLeft.y) && (A.y <= bottomRight.y);
|
||||
}
|
||||
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline int queenWiseDist(BWAPI::Point<T, Scale> A, BWAPI::Point<T, Scale> B){ A -= B; return utils::queenWiseNorm(A.x, A.y); }
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline int squaredDist(BWAPI::Point<T, Scale> A, BWAPI::Point<T, Scale> B) { A -= B; return squaredNorm(A.x, A.y); }
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline double dist(BWAPI::Point<T, Scale> A, BWAPI::Point<T, Scale> B) { A -= B; return utils::norm(A.x, A.y); }
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline int roundedDist(BWAPI::Point<T, Scale> A, BWAPI::Point<T, Scale> B) { return int(0.5 + dist(A, B)); }
|
||||
|
||||
|
||||
inline int distToRectangle(const BWAPI::Position & a, const BWAPI::TilePosition & TopLeft, const BWAPI::TilePosition & Size)
|
||||
{
|
||||
auto topLeft = BWAPI::Position(TopLeft);
|
||||
auto bottomRight = BWAPI::Position(TopLeft + Size) - 1;
|
||||
|
||||
if (a.x >= topLeft.x)
|
||||
if (a.x <= bottomRight.x)
|
||||
if (a.y > bottomRight.y) return a.y - bottomRight.y; // S
|
||||
else if (a.y < topLeft.y) return topLeft.y - a.y; // N
|
||||
else return 0; // inside
|
||||
else
|
||||
if (a.y > bottomRight.y) return roundedDist(a, bottomRight); // SE
|
||||
else if (a.y < topLeft.y) return roundedDist(a, BWAPI::Position(bottomRight.x, topLeft.y)); // NE
|
||||
else return a.x - bottomRight.x; // E
|
||||
else
|
||||
if (a.y > bottomRight.y) return roundedDist(a, BWAPI::Position(topLeft.x, bottomRight.y)); // SW
|
||||
else if (a.y < topLeft.y) return roundedDist(a, topLeft); // NW
|
||||
else return topLeft.x - a.x; // W
|
||||
}
|
||||
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline std::vector<BWAPI::Point<T, Scale>> innerBorder(BWAPI::Point<T, Scale> TopLeft, BWAPI::Point<T, Scale> Size, bool noCorner = false)
|
||||
{
|
||||
std::vector<BWAPI::Point<T, Scale>> Border;
|
||||
for (int dy = 0 ; dy < Size.y ; ++dy)
|
||||
for (int dx = 0 ; dx < Size.x ; ++dx)
|
||||
if ((dy == 0) || (dy == Size.y-1) ||
|
||||
(dx == 0) || (dx == Size.x-1))
|
||||
if (!noCorner ||
|
||||
!(((dx == 0) && (dy == 0)) || ((dx == Size.x-1) && (dy == Size.y-1)) ||
|
||||
((dx == 0) && (dy == Size.y-1)) || ((dx == Size.x-1) && (dy == 0))))
|
||||
Border.push_back(TopLeft + BWAPI::Point<T, Scale>(dx, dy));
|
||||
|
||||
return Border;
|
||||
}
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline std::vector<BWAPI::Point<T, Scale>> outerBorder(BWAPI::Point<T, Scale> TopLeft, BWAPI::Point<T, Scale> Size, bool noCorner = false)
|
||||
{
|
||||
return innerBorder(TopLeft - 1, Size + 2, noCorner);
|
||||
}
|
||||
|
||||
|
||||
inline std::vector<BWAPI::WalkPosition> outerMiniTileBorder(BWAPI::TilePosition TopLeft, BWAPI::TilePosition Size, bool noCorner = false)
|
||||
{
|
||||
return outerBorder(BWAPI::WalkPosition(TopLeft), BWAPI::WalkPosition(Size), noCorner);
|
||||
}
|
||||
|
||||
|
||||
inline std::vector<BWAPI::WalkPosition> innerMiniTileBorder(BWAPI::TilePosition TopLeft, BWAPI::TilePosition Size, bool noCorner = false)
|
||||
{
|
||||
return innerBorder(BWAPI::WalkPosition(TopLeft), BWAPI::WalkPosition(Size), noCorner);
|
||||
}
|
||||
|
||||
|
||||
void drawDiagonalCrossMap(BWAPI::Position topLeft, BWAPI::Position bottomRight, BWAPI::Color col);
|
||||
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline bool overlap(const BWAPI::Point<T, Scale> & TopLeft1, const BWAPI::Point<T, Scale> & Size1, const BWAPI::Point<T, Scale> & TopLeft2, const BWAPI::Point<T, Scale> & Size2)
|
||||
{
|
||||
if (TopLeft2.x >= TopLeft1.x + Size1.x) return false;
|
||||
if (TopLeft2.y >= TopLeft1.y + Size1.y) return false;
|
||||
if (TopLeft1.x >= TopLeft2.x + Size2.x) return false;
|
||||
if (TopLeft1.y >= TopLeft2.y + Size2.y) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T, int Scale = 1>
|
||||
inline bool disjoint(const BWAPI::Point<T, Scale> & TopLeft1, const BWAPI::Point<T, Scale> & Size1, const BWAPI::Point<T, Scale> & TopLeft2, const BWAPI::Point<T, Scale> & Size2)
|
||||
{
|
||||
if (TopLeft2.x > TopLeft1.x + Size1.x) return true;
|
||||
if (TopLeft2.y > TopLeft1.y + Size1.y) return true;
|
||||
if (TopLeft1.x > TopLeft2.x + Size2.x) return true;
|
||||
if (TopLeft1.y > TopLeft2.y + Size2.y) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace BWEM::BWAPI_ext
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
44
Source/BWEM/src/bwem.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file is part of the BWEM Library.
|
||||
// BWEM is free software, licensed under the MIT/X11 License.
|
||||
// A copy of the license is provided with the library in the LICENSE file.
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "bwem.h"
|
||||
|
||||
|
||||
using namespace BWAPI;
|
||||
using namespace BWAPI::UnitTypes::Enum;
|
||||
namespace { auto & bw = Broodwar; }
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace BWEM {
|
||||
|
||||
using namespace utils;
|
||||
|
||||
namespace detail {
|
||||
|
||||
void onAssertThrowFailed(const std::string & file, int line, const std::string & condition, const std::string & message)
|
||||
{
|
||||
unused(file);
|
||||
unused(line);
|
||||
unused(condition);
|
||||
unused(message);
|
||||
|
||||
assert(false);
|
||||
throw Exception(file + ", line " + std::to_string(line) + " - " + message);
|
||||
}
|
||||
|
||||
} // namespace details
|
||||
|
||||
|
||||
|
||||
} // namespace BWEM
|
||||
|
||||
|
75
Source/BWEM/src/bwem.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This file is part of the BWEM Library.
|
||||
// BWEM is free software, licensed under the MIT/X11 License.
|
||||
// A copy of the license is provided with the library in the LICENSE file.
|
||||
// Copyright (c) 2015, 2017, Igor Dimitrijevic
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef BWEM_H
|
||||
#define BWEM_H
|
||||
|
||||
|
||||
#include "map.h"
|
||||
#include "tiles.h"
|
||||
#include "area.h"
|
||||
#include "cp.h"
|
||||
#include "base.h"
|
||||
#include "neutral.h"
|
||||
#include "gridMap.h"
|
||||
#include "examples.h"
|
||||
#include "mapPrinter.h"
|
||||
#include "mapDrawer.h"
|
||||
#include "utils.h"
|
||||
#include "bwapiExt.h"
|
||||
#include "defs.h"
|
||||
|
||||
/*
|
||||
|
||||
|
||||
To see examples of how to use the BWEM library, have a look at the functions declared in examples.h.
|
||||
All the examples are runable, just follow the steps in the "Getting started" page of the html documentation.
|
||||
|
||||
To get into the documentation of the API, just read the comments in the following files (preferably in this order):
|
||||
tiles.h
|
||||
map.h
|
||||
area.h
|
||||
cp.h
|
||||
base.h
|
||||
neutral.h
|
||||
|
||||
|
||||
Many of the algorithms used in the analysis are parametrised and thus can be easily modified:
|
||||
|
||||
- To change the way the Areas or created (make them smaller or greater), look at the "Condition for the neighboring areas to merge"
|
||||
in MapImpl::ComputeTempAreas.
|
||||
Also look at the constant area_min_miniTiles defined in defs.h.
|
||||
|
||||
- To change the threshold between Seas and Lakes, look at the constants defined in defs.h.
|
||||
|
||||
- To change the shape of the ChokePoints, just modify the helper function chooseNeighboringArea.
|
||||
|
||||
- To change the way the Bases are located, look at the constants defined in defs.h.
|
||||
|
||||
- To change the way the StartingLocations are assigned to Bases, look at MapImpl::FindBasesForStartingLocations
|
||||
and the constant max_tiles_between_StartingLocation_and_its_AssignedBase defined in defs.h.
|
||||
|
||||
|
||||
If you are interested in some or all the processes of the analysis, you sould start at MapImpl::Initialize(),
|
||||
in which sub-processes are called in sequentially steps.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
namespace BWEM
|
||||
{
|
||||
|
||||
|
||||
} // namespace BWEM
|
||||
|
||||
|
||||
#endif
|
||||
|