-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLife_form.hpp
More file actions
43 lines (35 loc) · 1.16 KB
/
Copy pathLife_form.hpp
File metadata and controls
43 lines (35 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef DEF_LIFE_FORM
#define DEF_LIFE_FORM
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <Eigen\Dense>
#include <cmath>
#include "Brain.hpp"
#define WIDTH (900)
#define HEIGHT (900)
typedef Eigen::Matrix<float, Eigen::Dynamic, 1> Vector;
class Life_form {
public:
Life_form(Brain * brain);
virtual Life_form * clone() const = 0;
void set_position(Vector position) { m_position = position; }
void set_rotation(float rotation) { m_rotation = rotation; }
Vector get_position() const { return m_position; }
float get_rotation() const { return m_rotation; }
sf::ConvexShape get_body() { return m_body; }
void move(float distance);
void rotate(float rotation);
void update_body();
//==================== Life ====================
Vector see(std::vector<Life_form*> population, unsigned int precision, unsigned int range);
Vector think(Vector input) const;
void act(Vector decision);
void eat(std::vector<Life_form*> & list_life_forms);
//==============================================
protected:
Vector m_position;
Brain * m_brain;
float m_rotation; //radiants [0,2*pi]
sf::ConvexShape m_body;
};
#endif