Advertisement
Guest User

Pole

a guest
Jan 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.05 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. bool gameOver;
  7. const int width = 20;
  8. const int height = 20;
  9. int x, y, fruitX, fruitY, score;
  10. enum eDirection { STOP = 0, LEFT, RIGHT, UP, DOWN };
  11. enum eDirection dir;
  12.  
  13.  
  14. void Setup() {
  15.     gameOver = false;
  16.     dir = STOP;
  17.     x = width / 2;
  18.     y = height / 2;
  19.     fruitX = rand() % width;
  20.     fruitX = rand() % height;
  21.     score = 0;
  22.  
  23.  
  24. }
  25.  
  26. void Draw()  {
  27.     system((const char *) "clear");
  28.     for (int i=0; i < width; i++)
  29.         stdout << "#";
  30.     stdout << "\n";
  31.  
  32.     for (int i = 0; i < height; i++) {
  33.         for (int j = 0; j < width; j++) {
  34.             if (j == 0 || j == width - 1 )
  35.                 stdout << "#";
  36.             stdout << " ";
  37.  
  38.         }
  39.         stdout << "\n";
  40.     }
  41.  
  42.     for (int i=0; i < width; i++)
  43.         stdout << "#";
  44.     stdout << "\n";
  45.  
  46.  
  47. }
  48.  
  49. void Input() {
  50.  
  51. }
  52.  
  53. void Logic() {
  54.  
  55. }
  56.  
  57.  
  58.  
  59.  
  60.  
  61. int main() {
  62.     Setup();
  63.     while (!gameOver) {
  64.         Draw();
  65.         Input();
  66.         Logic();
  67.  
  68.     }
  69.  
  70.     return (0);
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement