Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. bool gameover;
  7. const int width = 20;
  8. const int heigth = 20;
  9. int x, y, fruitX, fruitY, score;
  10. enum eDirection {STOP = 0, LEFT, RIGHT, UP, DOWN};
  11. eDirection dir;
  12.  
  13. void setup()
  14. {
  15.     gameover = false;
  16.     dir = STOP;
  17.     x = width / 2;
  18.     y = heigth / 2;
  19.     fruitX = rand() % width;
  20.     fruitY = rand() % heigth;
  21.     score = 0;
  22. }
  23.  
  24.  
  25. void draw()
  26. {
  27.     system("cls");
  28.     for(int i = 0; i < width + 1; i++)
  29.         cout << "#";
  30.     cout << endl;
  31.     for (int i = 0; i < width; i++)
  32.     {
  33.         for (int j = 0; j < heigth; j++)
  34.         {
  35.             if (j == 0 || j == heigth - 1)
  36.                 cout << "#";
  37.             cout << " ";
  38.  
  39.         }
  40.         cout << endl;
  41.     }
  42.     for(int i = 0; i < width + 1; i++)
  43.         cout << "#";
  44. }
  45.  
  46.  
  47. void input()
  48. {
  49.  
  50. }
  51.  
  52.  
  53. void logic()
  54. {
  55.  
  56. }
  57.  
  58.  
  59. int main()
  60. {
  61.     setup();
  62.     while (!gameover)
  63.     {
  64.         draw();
  65.         input();
  66.         logic();
  67.     }
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement