My Project
 All Classes
Snake.h
1 #pragma once
2 
3 #include <vector>
4 #include <iostream>
5 #include <iterator>
6 #include <sstream>
7 #include <algorithm>
8 #include "Koord.h"
9 #include "direction.h"
10 
11 class Snake
12 {
13  public:
14  Snake();
15  Snake(int width, int height,int start_width, int start_height,unsigned int length);
16 
17 
18  void setDir(int direction);
19  int getDir(); // direction
20  unsigned int getLength();
21  Koord getPosAt(unsigned int p);
22  Koord step();
23  void turn(int direction);
24  void turnRight();
25  void turnLeft();
26  Koord getHypotStep();
27  void cutAt(int p);
28  std::vector<Koord> cutAndTurnAround();
29  std::vector<Koord> cutAndTurnAround(int amount);
30  void addChunks(int amount);
31  std::vector<Koord> cut(unsigned int amount);
32  int getChunks();
33 
34  private:
35  unsigned int dir;
36  bool blockTurn;
37  std::vector<Koord> chunks;
38  std::vector<Koord>::iterator it;
39 };