You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
468 B

  1. #pragma once
  2. #include <vector>
  3. #include "Point.h"
  4. #include "Snack.h"
  5. static constexpr int SNAKE_BODY_CHAR = 'o';
  6. static constexpr uint32_t SNAKE_DEFAULT_SIZE = 4;
  7. class Snake{
  8. private:
  9. std::vector<Point> snake_;
  10. int direction_;
  11. void updateHead();
  12. void printSnake() const;
  13. public:
  14. Snake(uint32_t headY = LINES/2, uint32_t headX = COLS/2);
  15. void moveUp();
  16. void moveDown();
  17. void moveLeft();
  18. void moveRight();
  19. void move();
  20. };