TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
rewards.h
1 /*
2  * Copyright (c) 2017-present, Facebook, Inc.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #pragma once
9 
10 #include "state.h"
11 
12 namespace cherrypi {
13 
14 struct Reward {
15  virtual ~Reward() = default;
16  virtual void begin(cherrypi::State* state);
17  virtual void stepReward(cherrypi::State* state) = 0;
18  virtual bool terminate(cherrypi::State* state);
19  virtual bool terminateOnPeace();
20  double reward = -1e10;
21 };
22 
23 std::unique_ptr<Reward> combatReward();
24 std::unique_ptr<Reward> killSpeedReward();
25 std::unique_ptr<Reward> proximityToReward(int y, int x);
26 std::unique_ptr<Reward> proximityToEnemyReward();
27 std::unique_ptr<Reward> protectCiviliansReward();
28 std::unique_ptr<Reward> defilerProtectZerglingsReward();
29 std::unique_ptr<Reward> defilerWinLossReward();
30 
31 } // namespace cherrypi
Game state.
Definition: state.h:42
double reward
Definition: rewards.h:20
std::unique_ptr< Reward > proximityToEnemyReward()
Definition: rewards.cpp:73
virtual bool terminate(cherrypi::State *state)
Definition: rewards.cpp:22
std::unique_ptr< Reward > protectCiviliansReward()
Definition: rewards.cpp:98
std::unique_ptr< Reward > defilerProtectZerglingsReward()
Definition: rewards.cpp:126
std::unique_ptr< Reward > proximityToReward(int y, int x)
Definition: rewards.cpp:88
std::unique_ptr< Reward > killSpeedReward()
Definition: rewards.cpp:62
Definition: rewards.h:14
std::unique_ptr< Reward > combatReward()
Definition: rewards.cpp:55
std::unique_ptr< Reward > defilerWinLossReward()
Definition: rewards.cpp:236
virtual void stepReward(cherrypi::State *state)=0
Main namespace for bot-related code.
Definition: areainfo.cpp:17
virtual ~Reward()=default
virtual bool terminateOnPeace()
Definition: rewards.cpp:27
virtual void begin(cherrypi::State *state)
Definition: rewards.cpp:20