-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnake.h
50 lines (31 loc) · 809 Bytes
/
Snake.h
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
//
// Created by Daniel Eidlin on 17/07/2020.
//
#ifndef SNAKE_SNAKE_H
#define SNAKE_SNAKE_H
#include <utility>
#include <vector>
#include "Direction.h"
#include "BodyPart.h"
class Snake {
private:
int length;
bool movable;
std::vector<BodyPart> bodyParts;
std::pair<int, int> previousTailCoordinates;
bool apple;
public:
Snake();
Snake(int length, std::pair<int, int> spawnCoordinates);
~Snake();
BodyPart getHeadPart() const;
std::vector<BodyPart> getBodyParts() const;
void move();
std::pair<int, int> getPreviousTailCoordinates() const;
bool CanMove() const;
void setCanMove(bool status);
bool hasApple() const;
void setApple(bool hasApple);
void changeHeadDirection(Direction newDirection);
};
#endif //SNAKE_SNAKE_H