Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #include <stdlib.h>
- bool gameOver;
- const int width = 20;
- const int height = 20;
- int x, y, fruitX, fruitY, score;
- enum eDirection { STOP = 0, LEFT, RIGHT, UP, DOWN };
- enum eDirection dir;
- void Setup() {
- gameOver = false;
- dir = STOP;
- x = width / 2;
- y = height / 2;
- fruitX = rand() % width;
- fruitX = rand() % height;
- score = 0;
- }
- void Draw() {
- system((const char *) "clear");
- for (int i=0; i < width; i++)
- stdout << "#";
- stdout << "\n";
- for (int i = 0; i < height; i++) {
- for (int j = 0; j < width; j++) {
- if (j == 0 || j == width - 1 )
- stdout << "#";
- stdout << " ";
- }
- stdout << "\n";
- }
- for (int i=0; i < width; i++)
- stdout << "#";
- stdout << "\n";
- }
- void Input() {
- }
- void Logic() {
- }
- int main() {
- Setup();
- while (!gameOver) {
- Draw();
- Input();
- Logic();
- }
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement