diff --git a/snake.cpp b/snake.cpp new file mode 100644 index 0000000..d8f9f0e --- /dev/null +++ b/snake.cpp @@ -0,0 +1,57 @@ +#include +#include +#include +#include + +using namespace std; + +bool gameOver; +const int width = 40; +const int height = 40; +int x, y, fruitX, fruitY, score; +enum eDirection { STOP = 0, LEFT, RIGHT, UP, DOWN }; +eDirection dir; + +void setup() { + gameOver = false; + dir = STOP; + x = width / 2; + y = height / 2; + fruitX = rand() % width; + fruitY = rand() % height; + score = 0; +} + +void draw() { + system("cls"); + for(int i = 0; i < width + 2; i++) cout << "#"; + cout << "\n"; + for(int i = 0; i < height; i++) { + for(int j = 0; j < width; j++ ) { + if(j == 0) cout << "#"; + cout << " "; + if(j == width - 1) cout << "#"; + } + cout << "\n"; + } + for(int i = 0; i < width + 2; i++) cout << "#"; + cout << "\n"; + +} + +void input() { + +} + +void logic() { + +} + +int main() { + setup(); + while(!gameOver){ + draw(); + input(); + logic(); + } +} \ No newline at end of file