Commit 0212bbe5 authored by drallensmith's avatar drallensmith

Merge branch 'master' into add_preprocess_action - avoid rebase

parents 3785b072 bdc7504c
...@@ -22,4 +22,4 @@ compiler: ...@@ -22,4 +22,4 @@ compiler:
- gcc - gcc
script: script:
- mkdir build && cd build - mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release .. && make -j4 && make install - cmake -DCMAKE_BUILD_TYPE=RelwithDebInfo .. && make -j4 && make install
...@@ -16,6 +16,7 @@ LowLevelFeatureExtractor::LowLevelFeatureExtractor(int num_teammates, ...@@ -16,6 +16,7 @@ LowLevelFeatureExtractor::LowLevelFeatureExtractor(int num_teammates,
assert(numOpponents >= 0); assert(numOpponents >= 0);
numFeatures = num_basic_features + numFeatures = num_basic_features +
features_per_player * (numTeammates + numOpponents); features_per_player * (numTeammates + numOpponents);
numFeatures += numTeammates + numOpponents; // Uniform numbers
feature_vec.resize(numFeatures); feature_vec.resize(numFeatures);
} }
...@@ -184,6 +185,38 @@ const std::vector<float>& LowLevelFeatureExtractor::ExtractFeatures( ...@@ -184,6 +185,38 @@ const std::vector<float>& LowLevelFeatureExtractor::ExtractFeatures(
addFeature(0); addFeature(0);
} }
} }
// ========================= UNIFORM NUMBERS ========================== //
detected_teammates = 0;
for (PlayerPtrCont::const_iterator it = teammates.begin();
it != teammates.end(); ++it) {
PlayerObject* teammate = *it;
if (teammate->pos().x > 0 && teammate->unum() > 0 &&
detected_teammates < numTeammates) {
addFeature(teammate->unum());
detected_teammates++;
}
}
// Add zero features for any missing teammates
for (int i=detected_teammates; i<numTeammates; ++i) {
addFeature(0);
}
detected_opponents = 0;
for (PlayerPtrCont::const_iterator it = opponents.begin();
it != opponents.end(); ++it) {
PlayerObject* opponent = *it;
if (opponent->pos().x > 0 && opponent->unum() > 0 &&
detected_opponents < numOpponents) {
addFeature(opponent->unum());
detected_opponents++;
}
}
// Add zero features for any missing opponents
for (int i=detected_opponents; i<numOpponents; ++i) {
addFeature(0);
}
assert(featIndx == numFeatures); assert(featIndx == numFeatures);
checkFeatures(); checkFeatures();
return feature_vec; return feature_vec;
......
...@@ -17,7 +17,7 @@ public: ...@@ -17,7 +17,7 @@ public:
protected: protected:
// Number of features for non-player objects. // Number of features for non-player objects.
const static int num_basic_features = 58; const static int num_basic_features = 58;
// Number of features for each player or opponent in game. // Number of features for each player or opponent in game, not including uniform numbers.
const static int features_per_player = 8; const static int features_per_player = 8;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment