\hypertarget{classGameProgressDetectionClass}{\section{\-Game\-Progress\-Detection\-Class \-Class \-Reference}
\label{classGameProgressDetectionClass}\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}}
}


{\ttfamily \#include $<$\-Game\-Progress\-Detection.\-h$>$}



\-Collaboration diagram for \-Game\-Progress\-Detection\-Class\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=550pt]{classGameProgressDetectionClass__coll__graph}
\end{center}
\end{figure}
\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classGameProgressDetectionClass_a12888c841ef341b30188677136438f77}{\-Game\-Progress\-Detection\-Class} ()
\item 
void \hyperlink{classGameProgressDetectionClass_a5dcb440832c092b74c8caef829e54094}{update} ()
\item 
bool \hyperlink{classGameProgressDetectionClass_a2732bf7361a3bc7dd895ef9c940f19bf}{should\-G\-G} () const 
\item 
bool \hyperlink{classGameProgressDetectionClass_a4728003c4962fc447e1bd6a85d7c30fe}{should\-Attack} () const 
\item 
\hyperlink{GameProgressDetection_8h_a09bed546b7ba05af549c7e2fbf392984}{\-State\-Type} \hyperlink{classGameProgressDetectionClass_aa8fc42881f528b3450a130eabcae2c7a}{get\-State} () const 
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
bool \hyperlink{classGameProgressDetectionClass_a7a8fbd05e4664b021f5c32f1c52eb349}{m\-Should\-G\-G}
\item 
bool \hyperlink{classGameProgressDetectionClass_a1c344f3d761c708c72d471f91dbbb7c0}{m\-Should\-Attack}
\item 
\hyperlink{GameProgressDetection_8h_a09bed546b7ba05af549c7e2fbf392984}{\-State\-Type} \hyperlink{classGameProgressDetectionClass_ac6fc2c9b54b2fd49c217c5365348ed8a}{m\-State}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 18 of file \-Game\-Progress\-Detection.\-h.



\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{classGameProgressDetectionClass_a12888c841ef341b30188677136438f77}{\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}}
\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!GameProgressDetectionClass@{\-Game\-Progress\-Detection\-Class}}
\subsubsection[{\-Game\-Progress\-Detection\-Class}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Game\-Progress\-Detection\-Class\-::\-Game\-Progress\-Detection\-Class} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classGameProgressDetectionClass_a12888c841ef341b30188677136438f77}


\-Definition at line 21 of file \-Game\-Progress\-Detection.\-h.


\begin{DoxyCode}
{}
\end{DoxyCode}


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classGameProgressDetectionClass_aa8fc42881f528b3450a130eabcae2c7a}{\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!get\-State@{get\-State}}
\index{get\-State@{get\-State}!GameProgressDetectionClass@{\-Game\-Progress\-Detection\-Class}}
\subsubsection[{get\-State}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-State\-Type} {\bf \-Game\-Progress\-Detection\-Class\-::get\-State} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classGameProgressDetectionClass_aa8fc42881f528b3450a130eabcae2c7a}


\-Definition at line 27 of file \-Game\-Progress\-Detection.\-h.



\-References m\-State.


\begin{DoxyCode}
{ return mState; }
\end{DoxyCode}
\hypertarget{classGameProgressDetectionClass_a4728003c4962fc447e1bd6a85d7c30fe}{\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!should\-Attack@{should\-Attack}}
\index{should\-Attack@{should\-Attack}!GameProgressDetectionClass@{\-Game\-Progress\-Detection\-Class}}
\subsubsection[{should\-Attack}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Game\-Progress\-Detection\-Class\-::should\-Attack} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classGameProgressDetectionClass_a4728003c4962fc447e1bd6a85d7c30fe}


\-Definition at line 26 of file \-Game\-Progress\-Detection.\-h.



\-References m\-Should\-Attack.


\begin{DoxyCode}
{ return mShouldAttack; }
\end{DoxyCode}
\hypertarget{classGameProgressDetectionClass_a2732bf7361a3bc7dd895ef9c940f19bf}{\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!should\-G\-G@{should\-G\-G}}
\index{should\-G\-G@{should\-G\-G}!GameProgressDetectionClass@{\-Game\-Progress\-Detection\-Class}}
\subsubsection[{should\-G\-G}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Game\-Progress\-Detection\-Class\-::should\-G\-G} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classGameProgressDetectionClass_a2732bf7361a3bc7dd895ef9c940f19bf}


\-Definition at line 25 of file \-Game\-Progress\-Detection.\-h.



\-References m\-Should\-G\-G.


\begin{DoxyCode}
{ return mShouldGG; }
\end{DoxyCode}
\hypertarget{classGameProgressDetectionClass_a5dcb440832c092b74c8caef829e54094}{\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!update@{update}}
\index{update@{update}!GameProgressDetectionClass@{\-Game\-Progress\-Detection\-Class}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Game\-Progress\-Detection\-Class\-::update} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classGameProgressDetectionClass_a5dcb440832c092b74c8caef829e54094}


\-Definition at line 8 of file \-Game\-Progress\-Detection.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-State\-Type\-Def\-::\-Build\-Army, \-Singleton$<$ T $>$\-::\-Instance(), \-B\-W\-A\-P\-I\-::\-Player\-::is\-Upgrading(), \-B\-W\-A\-P\-I\-::\-Upgrade\-Types\-::\-Leg\-\_\-\-Enhancements, \-Access\-Type\-Def\-::\-Lost, m\-Should\-Attack, m\-Should\-G\-G, m\-State, \-B\-W\-A\-P\-I\-::\-Races\-::\-Protoss, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Dark\-\_\-\-Templar, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-High\-\_\-\-Templar, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Observer, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Reaver, \-B\-W\-A\-P\-I\-::\-Game\-::self(), \-B\-W\-A\-P\-I\-::\-Player\-::supply\-Used(), \-B\-W\-A\-P\-I\-::\-Tech\-Types\-::\-Tank\-\_\-\-Siege\-\_\-\-Mode, \-State\-Type\-Def\-::\-Tech\-High, \-State\-Type\-Def\-::\-Tech\-Normal, and \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Zerg\-\_\-\-Lurker.


\begin{DoxyCode}
{
        mState = StateType::TechNormal;
        mShouldGG = false;
        mShouldAttack = true;

        int enemyKnownSupply = 0;
        int enemyGuessSupply = 0;
        int mySupply = BWAPI::Broodwar->self()->supplyUsed();

        for each(Unit unit in UnitTracker::Instance().selectAllEnemy())
        {
                int supply = unit->getType().supplyRequired();

                if(unit->accessibility() != AccessType::Lost)
                        enemyKnownSupply += supply;

                enemyGuessSupply += supply;
        }

        if(PlayerTracker::Instance().getEnemies().size() < 2)
        {
                int buildingCount = 0;
                for each(Unit unit in UnitTracker::Instance().selectAllUnits())
                {
                        if(unit->getType().isBuilding() && !unit->getType().
      isAddon())
                                ++buildingCount;
                }

                if(buildingCount != 0)
                {
                        if(enemyKnownSupply > mySupply*2 && 
      ResourceTracker::Instance().getMineralRate() < 5.0)
                                mShouldGG = true;

                        if(enemyGuessSupply > mySupply*3 && 
      ResourceTracker::Instance().getMineralRate() < 5.0)
                                mShouldGG = true;

                        if(enemyGuessSupply > mySupply*4 || enemyKnownSupply > 
      mySupply*3)
                                mShouldGG = true;
                }
        }
        
        // if bases available to attack are up small chokes, dont attack
       without recall or a much bigger army
        if(BWAPI::Broodwar->self()->getRace() == BWAPI::Races::Protoss)
        {
                if(UnitTracker::Instance().selectAllUnits(
      BWAPI::UnitTypes::Protoss_Observer).size() == 0)
                {
                        if(BWAPI::Broodwar->getFrameCount() > 24*60*10)
                                mState = StateType::TechHigh;
                        else if((UnitTracker::Instance().selectAllEnemy(
      BWAPI::UnitTypes::Zerg_Lurker).size() + UnitTracker::Instance().selectAllEnemy(
      BWAPI::UnitTypes::Protoss_Dark_Templar).size()) > 0)
                                mState = StateType::TechHigh;
                }
                if(BWAPI::Broodwar->self()->getUpgradeLevel(
      BWAPI::UpgradeTypes::Leg_Enhancements) == 0 && !BWAPI::Broodwar->self()->
      isUpgrading(BWAPI::UpgradeTypes::Leg_Enhancements) && PlayerTracker::Instance()
      .enemyHasReseached(BWAPI::TechTypes::Tank_Siege_Mode))
                        mState = StateType::TechHigh;

                if(PlayerTracker::Instance().isEnemyRace(BWAPI::Races::Protoss)
       && !MacroManager::Instance().hasRequirements(
      BWAPI::UnitTypes::Protoss_High_Templar) && UnitTracker::Instance().
      selectAllUnits(BWAPI::UnitTypes::Protoss_Reaver).empty())
                {
                        if(BWAPI::Broodwar->getFrameCount() > 24*60*12 || (
      UnitTracker::Instance().selectAllEnemy(BWAPI::UnitTypes::Protoss_High_Templar).
      size() + UnitTracker::Instance().selectAllEnemy(BWAPI::UnitTypes::Protoss_Reaver
      ).size()) > 0)
                                mState = StateType::TechHigh;
                }
        }

        if(mState != StateType::TechHigh)
        {
                if(enemyGuessSupply > mySupply)//TODO: also if attacking
       successfully
                        mState = StateType::BuildArmy;
                else
                {
                        if(!mShouldAttack || mySupply > 380)
                                mState = StateType::TechHigh;
                }
        }
}\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classGameProgressDetectionClass_a5dcb440832c092b74c8caef829e54094_cgraph}
\end{center}
\end{figure}




\subsection{\-Member \-Data \-Documentation}
\hypertarget{classGameProgressDetectionClass_a1c344f3d761c708c72d471f91dbbb7c0}{\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!m\-Should\-Attack@{m\-Should\-Attack}}
\index{m\-Should\-Attack@{m\-Should\-Attack}!GameProgressDetectionClass@{\-Game\-Progress\-Detection\-Class}}
\subsubsection[{m\-Should\-Attack}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Game\-Progress\-Detection\-Class\-::m\-Should\-Attack}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGameProgressDetectionClass_a1c344f3d761c708c72d471f91dbbb7c0}


\-Definition at line 31 of file \-Game\-Progress\-Detection.\-h.



\-Referenced by should\-Attack(), and update().

\hypertarget{classGameProgressDetectionClass_a7a8fbd05e4664b021f5c32f1c52eb349}{\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!m\-Should\-G\-G@{m\-Should\-G\-G}}
\index{m\-Should\-G\-G@{m\-Should\-G\-G}!GameProgressDetectionClass@{\-Game\-Progress\-Detection\-Class}}
\subsubsection[{m\-Should\-G\-G}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Game\-Progress\-Detection\-Class\-::m\-Should\-G\-G}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGameProgressDetectionClass_a7a8fbd05e4664b021f5c32f1c52eb349}


\-Definition at line 30 of file \-Game\-Progress\-Detection.\-h.



\-Referenced by should\-G\-G(), and update().

\hypertarget{classGameProgressDetectionClass_ac6fc2c9b54b2fd49c217c5365348ed8a}{\index{\-Game\-Progress\-Detection\-Class@{\-Game\-Progress\-Detection\-Class}!m\-State@{m\-State}}
\index{m\-State@{m\-State}!GameProgressDetectionClass@{\-Game\-Progress\-Detection\-Class}}
\subsubsection[{m\-State}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-State\-Type} {\bf \-Game\-Progress\-Detection\-Class\-::m\-State}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGameProgressDetectionClass_ac6fc2c9b54b2fd49c217c5365348ed8a}


\-Definition at line 33 of file \-Game\-Progress\-Detection.\-h.



\-Referenced by get\-State(), and update().



\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
\-Skynet/\-Skynet/\hyperlink{GameProgressDetection_8h}{\-Game\-Progress\-Detection.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{GameProgressDetection_8cpp}{\-Game\-Progress\-Detection.\-cpp}\end{DoxyCompactItemize}
