Skip to content

Commit

Permalink
Update cpp example to use vector<double>, correct CMakeLists.txt (Far…
Browse files Browse the repository at this point in the history
…ama-Foundation#196)

Former-commit-id: f9674d7
  • Loading branch information
khan-faiz authored and mwydmuch committed May 3, 2017
1 parent e3e4489 commit 91017d6
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/c++/Basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int main() {
// Define some actions. Each list entry corresponds to declared buttons:
// MOVE_LEFT, MOVE_RIGHT, ATTACK
// more combinations are naturally possible but only 3 are included for transparency when watching.
std::vector<int> actions[3];
std::vector<double> actions[3];
actions[0] = {1, 0, 0};
actions[1] = {0, 1, 0};
actions[2] = {0, 0, 1};
Expand Down Expand Up @@ -112,7 +112,7 @@ int main() {

// Which consists of:
unsigned int n = state->number;
std::vector<int> vars = state->gameVariables;
std::vector<double> vars = state->gameVariables;
BufferPtr screenBuf = state->screenBuffer;
BufferPtr depthBuf = state->depthBuffer;
BufferPtr labelsBuf = state->labelsBuffer;
Expand Down
2 changes: 1 addition & 1 deletion examples/c++/CIG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(){
GameStatePtr state = game->getState();
// Analyze the state.

std::vector<int> action(game->getAvailableButtonsSize());
std::vector<double> action(game->getAvailableButtonsSize());
// Set your action.

game->makeAction(action);
Expand Down
2 changes: 1 addition & 1 deletion examples/c++/CIGBots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int main(){
GameStatePtr state = game->getState();
// Analyze the state.

std::vector<int> action(game->getAvailableButtonsSize());
std::vector<double> action(game->getAvailableButtonsSize());
// Set your action.

game->makeAction(action);
Expand Down
2 changes: 1 addition & 1 deletion examples/c++/CIGHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int main(){
GameStatePtr state = game->getState();
// Analyze the state.

std::vector<int> action(game->getAvailableButtonsSize());
std::vector<double> action(game->getAvailableButtonsSize());
// Set your action.

game->makeAction(action);
Expand Down
2 changes: 1 addition & 1 deletion examples/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (WIN32)
set_property(TARGET libvizdoom PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/vizdoom.lib)
endif()
if (UNIX AND NOT APPLE)
set_property(TARGET libvizdoom PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/libvizdoom.a)
set_property(TARGET libvizdoom PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/libvizdoom.so)
endif()
if (APPLE)
set_property(TARGET libvizdoom PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/libvizdoom.dylib)
Expand Down
2 changes: 1 addition & 1 deletion examples/c++/DeltaButtons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main(){
//
// For MOVE_FORWARD_BACKWARD_DELTA, MOVE_LEFT_RIGHT_DELTA, MOVE_UP_DOWN_DELTA (rarely used)
// value is the speed of movement in a given direction (100 is close to the maximum speed).
std::vector<int> action = {100, 10, 10, 1};
std::vector<double> action = {100, 10, 10, 1};

// If button's absolute value > max button's value then value = max value with original value sign.

Expand Down
2 changes: 1 addition & 1 deletion examples/c++/Seed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(){
game->init();

// Define some actions.
std::vector<int> actions[3];
std::vector<double> actions[3];
actions[0] = {1, 0, 0};
actions[1] = {0, 1, 0};
actions[2] = {0, 0, 1};
Expand Down
2 changes: 1 addition & 1 deletion examples/c++/Shaping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(){
game->init();

// Define some actions.
std::vector<int> actions[3];
std::vector<double> actions[3];
actions[0] = {1, 0, 0};
actions[1] = {0, 1, 0};
actions[2] = {0, 0, 1};
Expand Down
6 changes: 3 additions & 3 deletions examples/c++/Spectator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ int main(){
// Don't load two configs cause the second will overwrite the first one.
// Multiple config files are ok but combining these ones doesn't make much sense.

//game->loadConfig("../../scenarios/basic.cfg");
game->loadConfig("../../scenarios/basic.cfg");
//game->loadConfig("../../scenarios/deadly_corridor.cfg");
game->loadConfig("../../scenarios/deathmatch.cfg");
//game->loadConfig("../../scenarios/deathmatch.cfg");
//game->loadConfig("../../scenarios/defend_the_center.cfg");
//game->loadConfig("../../scenarios/defend_the_line.cfg");
//game->loadConfig("../../scenarios/health_gathering.cfg");
Expand Down Expand Up @@ -55,7 +55,7 @@ int main(){
// game->advanceAction(4);

// Get the last action performed by You.
std::vector<int> lastAction = game->getLastAction();
std::vector<double> lastAction = game->getLastAction();

// And reward You get.
double reward = game->getLastReward();
Expand Down

0 comments on commit 91017d6

Please sign in to comment.