| 1 | /* |
|---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
|---|
| 3 | * > www.orxonox.net < |
|---|
| 4 | * |
|---|
| 5 | * |
|---|
| 6 | * License notice: |
|---|
| 7 | * |
|---|
| 8 | * This program is free software; you can redistribute it and/or |
|---|
| 9 | * modify it under the terms of the GNU General Public License |
|---|
| 10 | * as published by the Free Software Foundation; either version 2 |
|---|
| 11 | * of the License, or (at your option) any later version. |
|---|
| 12 | * |
|---|
| 13 | * This program is distributed in the hope that it will be useful, |
|---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | * GNU General Public License for more details. |
|---|
| 17 | * |
|---|
| 18 | * You should have received a copy of the GNU General Public License |
|---|
| 19 | * along with this program; if not, write to the Free Software |
|---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 21 | * |
|---|
| 22 | * Author: |
|---|
| 23 | * Fabian 'x3n' Landau |
|---|
| 24 | * Co-authors: |
|---|
| 25 | * ... |
|---|
| 26 | * |
|---|
| 27 | */ |
|---|
| 28 | |
|---|
| 29 | /** |
|---|
| 30 | @file Mini4DgameAI.h |
|---|
| 31 | @brief Declaration of the Mini4DgameAI class. |
|---|
| 32 | */ |
|---|
| 33 | |
|---|
| 34 | #ifndef _Mini4DgameAI_H__ |
|---|
| 35 | #define _Mini4DgameAI_H__ |
|---|
| 36 | |
|---|
| 37 | #include "mini4dgame/Mini4DgamePrereqs.h" |
|---|
| 38 | |
|---|
| 39 | #include <list> |
|---|
| 40 | |
|---|
| 41 | #include "tools/interfaces/Tickable.h" |
|---|
| 42 | |
|---|
| 43 | #include "controllers/Controller.h" |
|---|
| 44 | #include "Mini4DgameCenterpoint.h" |
|---|
| 45 | #include "Mini4Dgame.h" |
|---|
| 46 | |
|---|
| 47 | namespace orxonox |
|---|
| 48 | { |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | @brief |
|---|
| 52 | The Mini4DgameAI is an artificial intelligence for the @ref orxonox::Mini4Dgame "Mini4Dgame" gametype. |
|---|
| 53 | |
|---|
| 54 | @author |
|---|
| 55 | Oliver Richter |
|---|
| 56 | */ |
|---|
| 57 | class _Mini4DgameExport Mini4DgameAI : public Controller, public Tickable |
|---|
| 58 | { |
|---|
| 59 | public: |
|---|
| 60 | Mini4DgameAI(Context* context); //!< Constructor. Registers and initializes the object. |
|---|
| 61 | virtual ~Mini4DgameAI(); |
|---|
| 62 | |
|---|
| 63 | //void setConfigValues(); |
|---|
| 64 | |
|---|
| 65 | /** |
|---|
| 66 | @brief |
|---|
| 67 | starts the AI to make a move. implements the intelligence of the AI |
|---|
| 68 | @param timeout |
|---|
| 69 | The time the AI has to decide on a move. (Sets the strength of the AI) |
|---|
| 70 | @return move |
|---|
| 71 | The move that the AI decided to make. |
|---|
| 72 | */ |
|---|
| 73 | Vector4 makeMove(float timeout); |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | virtual void tick(float dt); |
|---|
| 77 | |
|---|
| 78 | void setCenterpoint(Mini4DgameCenterpoint* center) |
|---|
| 79 | { this->center_ = center; } |
|---|
| 80 | |
|---|
| 81 | protected: |
|---|
| 82 | |
|---|
| 83 | std::list<std::pair<Timer*, char>> reactionTimers_; //!< A list of reaction timers and the directions that take effect when their timer expires. |
|---|
| 84 | Mini4DgameCenterpoint* center_; |
|---|
| 85 | |
|---|
| 86 | private: |
|---|
| 87 | |
|---|
| 88 | std::list<Vector4> getPossibleMoves(); |
|---|
| 89 | void copyBoard(); |
|---|
| 90 | Mini4DgamePlayerColor board_[4][4][4][4]; |
|---|
| 91 | }; |
|---|
| 92 | } |
|---|
| 93 | |
|---|
| 94 | #endif /* _Mini4DgameAI_H__ */ |
|---|