BWAPI
UAlbertaBot_src/Projects/UAlbertaBot/Source/base/StarcraftBuildOrderSearchManager.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "Common.h"
00004 #include "BuildOrderQueue.h"
00005 #include "WorkerManager.h"
00006 #include "starcraftsearch\ActionSet.hpp"
00007 #include "starcraftsearch\ProtossState.hpp"
00008 #include "starcraftsearch\TerranState.hpp"
00009 #include "starcraftsearch\DFBBStarcraftSearch.hpp"
00010 #include "starcraftsearch\StarcraftState.hpp"
00011 #include "starcraftsearch\StarcraftSearchGoal.hpp"
00012 #include "starcraftsearch\SmartStarcraftSearch.hpp"
00013 #include "starcraftsearch\StarcraftData.hpp"
00014 #include "starcraftsearch\SearchSaveState.hpp"
00015 
00016 #include "StarcraftSearchData.h"
00017 
00018 class StarcraftBuildOrderSearchManager
00019 {
00020         // starcraftSearchData is hard coded to be protoss state for now
00021         StarcraftSearchData<ProtossState> starcraftSearchData;
00022 
00023         int lastSearchFinishTime;
00024 
00025         // returns StarcraftStateType from current BWAPI state
00026         template <class StarcraftStateType>
00027         StarcraftStateType                      getCurrentState();
00028 
00029         // gets a sample starting state for a race
00030         template <class StarcraftStateType>
00031         StarcraftStateType                      getStartState();
00032         
00033         // starts a search
00034         template <class StarcraftStateType>
00035         SearchResults                           search(std::vector< std::pair<MetaType, int> > & goalUnits);
00036 
00037         SearchResults                           previousResults;
00038 
00039         std::vector<MetaType>           getMetaVector(SearchResults & results);
00040 
00041         Action                                          getAction(MetaType t);
00042 
00043         StarcraftSearchGoal                     getGoal(std::vector< std::pair<MetaType, int> > & goalUnits);
00044 
00045         void                                            setRepetitions(StarcraftSearchGoal goal);
00046 
00047         void                                            loadOpeningBook();
00048         std::vector<std::vector<MetaType>> openingBook;
00049         std::vector<MetaType>           getMetaVector(std::string buildString);
00050         MetaType                                        getMetaType(Action a);
00051         
00052         StarcraftBuildOrderSearchManager();
00053         static StarcraftBuildOrderSearchManager *       instance;
00054 
00055 public:
00056 
00057         ~StarcraftBuildOrderSearchManager() {}
00058 
00059         static StarcraftBuildOrderSearchManager *       getInstance();
00060 
00061         void                                            update(double timeLimit);
00062 
00063         void                                            reset();
00064 
00065         void                                            setActionGoal(Action a, int count);
00066         void                                            setActionK(Action a, int k);
00067 
00068         std::vector<MetaType>           getOpeningBuildOrder();
00069         
00070         std::vector<MetaType>           findBuildOrder(BWAPI::Race race, std::vector< std::pair<MetaType, int> > & goalUnits);
00071 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines