I am challenging myself
I have been working in a small company as a software developer for over 2 years. The daily work is always about building web applications with Python. It's fun but hard to have a deep understanding on how computer works. I feel I need to challenge myself to learn something new. Several months ago, I finished reading the book C++ Primer Plus and got some basic knowledge about C++. I think it's time to create a project with C++ and try to implement it on Arduino.
The project idea
The project source code is on GitHub. The hardware I'm using for this project are:
- Arduino Uno R3
- Adafruit ST7735 1.44 inch TFT LCD display
- 4 Buttons
- Breadboard
- Jumper wires
The goal is to create a snake game with C++ and display it on the TFT LCD display. The game should have the following features:
- The snake can move in 4 directions: up, down, left, right
- The snake can't move in the opposite direction
- The snake can eat food and grow
- The game will end when the snake hits the wall or itself
The progress
I can display a dot for the snake on the screen and move it to the left direction, but I'm stuck on how to move the snake in other directions. I implemented some components, such as Location and Snake. However, I'm not sure about if I followed the correct design pattern and the usage of pointer and reference is suitable in this project. I have been struggling with this project for a while. Although I just worked on it for fun, I feel I should finish it instead of giving up.