Pac-Man Evolution
Loading...
Searching...
No Matches
Brains.h
1/*----------------------------------------------------------------------
2Pac-Man Evolution - Roberto Prieto
3Copyright (C) 2018-2024 MegaStorm Systems
4contact@megastormsystems.com - http://www.megastormsystems.com
5
6This software is provided 'as-is', without any express or implied
7warranty. In no event will the authors be held liable for any damages
8arising from the use of this software.
9
10Permission is granted to anyone to use this software for any purpose,
11including commercial applications, and to alter it and redistribute it
12freely, subject to the following restrictions:
13
141. The origin of this software must not be misrepresented; you must not
15claim that you wrote the original software. If you use this software
16in a product, an acknowledgment in the product documentation would be
17appreciated but is not required.
182. Altered source versions must be plainly marked as such, and must not be
19misrepresented as being the original software.
203. This notice may not be removed or altered from any source distribution.
21
22------------------------------------------------------------------------
23
24Objects brain classes.
25
26------------------------------------------------------------------------ */
27
28#ifndef OBJECTSBRAINSPME_H
29#define OBJECTSBRAINSPME_H
30
31// Includes and forward definitions
32#include "MemoryManager.h"
33class GameField;
34class Actor;
35class ArtificialNeuralNet;
36
37// --- Base Brain ---
38class Brain : public CMemPME
39{
40public:
41 explicit Brain();
42 virtual ~Brain();
43 virtual Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
44 void getName(string &);
45 Sint32 getTargetType();
46
47protected:
48 string sName;
49 Sint32 iTargetType;
50};
51
52// --- Evolved brain ---
53class BrainEvolved : public Brain
54{
55public:
56 explicit BrainEvolved();
57 ~BrainEvolved();
58 virtual Sint32 think(Actor*, Sint32&, Sint32&, GameField*) = 0;
59 Sint32 load(string sCDCFile = "", string sXMLName = "");
60 Sint32 setFitness(double);
61 double getFitness();
62 ArtificialNeuralNet* getNeuralNet();
63protected:
64 ArtificialNeuralNet* pNeuralNet;
65 Sint32 iNNInput, iNNOutput;
66 double dFitness;
67};
68
69// Brains for PacMan
70class BrainPacManHuman : public Brain
71{
72public:
73 explicit BrainPacManHuman();
74 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
75};
76class BrainPacMan : public Brain
77{
78public:
79 explicit BrainPacMan();
80 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
81};
82
83// Brains for Red Ghost
84class BrainRedGhost : public Brain
85{
86public:
87 explicit BrainRedGhost();
88 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
89};
90class BrainEvolvedRedGhost : public BrainEvolved
91{
92public:
93 explicit BrainEvolvedRedGhost(Sint32);
94 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
95};
96
97// Brains for Pink Ghost
98class BrainPinkGhost : public Brain
99{
100public:
101 explicit BrainPinkGhost();
102 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
103};
104class BrainEvolvedPinkGhost : public BrainEvolved
105{
106public:
107 explicit BrainEvolvedPinkGhost(Sint32);
108 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
109};
110
111// Brains for Blue Ghost
112class BrainBlueGhost : public Brain
113{
114public:
115 explicit BrainBlueGhost();
116 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
117};
118class BrainEvolvedBlueGhost : public BrainEvolved
119{
120public:
121 explicit BrainEvolvedBlueGhost(Sint32);
122 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
123};
124
125// Brains for Orange Ghost
126class BrainOrangeGhost : public Brain
127{
128public:
129 explicit BrainOrangeGhost();
130 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
131};
132class BrainEvolvedOrangeGhost : public BrainEvolved
133{
134public:
135 explicit BrainEvolvedOrangeGhost(Sint32);
136 Sint32 think(Actor*, Sint32&, Sint32&, GameField*);
137};
138
139
140#endif