-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map.hpp
81 lines (67 loc) · 1.73 KB
/
Map.hpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// Map.hpp for Snake in /home/wilmot_p/PROJETS/Snake
//
// Made by WILMOT Pierre
// Login <[email protected]>
//
// Started on Thu Apr 26 20:49:18 2012 WILMOT Pierre
// Last update Tue May 8 10:08:40 2012 WILMOT Pierre
//
#ifndef __MAP_HPP__
#define __MAP_HPP__
#include <vector>
#include <iostream>
#include "Display.hpp"
#include "Cdn.hpp"
#include "Snake.hpp"
#include "Logable.hpp"
#define MAP_X 256
#define MAP_Y 256
class Map : public Display, public Logable
{
public:
enum e_caseType
{
EMPTY,
FOOD,
WALL
};
public:
Map(int nb_snake, bool fromDB = false);
~Map();
Map::e_caseType getCase(int x, int y) const;
void display();
void play();
void spawnFood();
void deleteFood(int x, int y);
bool hasLivingSnakes() const;
unsigned int return_env1(Cdn<int> &a) const;
unsigned int return_env2(Cdn<int> &a) const;
unsigned int return_env3(Cdn<int> &a) const;
unsigned int return_env4(Cdn<int> &a) const;
void order();
bool userContinue() const;
void mute();
void refill();
unsigned int fileLog(int i);
unsigned int mysqlLog(int i);
private:
bool FoodUp(Cdn<int> &a) const;
bool FoodDown(Cdn<int> &a) const;
bool FoodRight(Cdn<int> &a) const;
bool FoodLeft(Cdn<int> &a) const;
bool FoodUpRight(Cdn<int> &a) const;
bool FoodUpLeft(Cdn<int> &a) const;
bool FoodDownRight(Cdn<int> &a) const;
bool FoodDownLeft(Cdn<int> &a) const;
bool FoodIn(int x1, int x2, int y1, int y2) const;
bool Caseis(Cdn<int> &a, int i, e_caseType ct) const;
private:
std::vector<Cdn<int> > m_food;
std::vector<Snake> m_snakes;
unsigned int m_tour;
bool m_continue;
int m_size;
std::string m_gameId; ;
};
#endif