Advertisement
HyperSensualNarwhal

broken tetris origin

Dec 13th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.24 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using std::cout;
  5. using std::cin;
  6. using std::endl;
  7.  
  8.  
  9. void main()
  10. {
  11.     int x = 4, y = 4;
  12.     char key = 0;
  13.  
  14.     while (key != 27)
  15.     {
  16.    
  17.         for (int i = 0; i < 10; i++)
  18.         {
  19.             for (int j = 0; j < 10; j++)
  20.             {
  21.  
  22.        
  23.                 if ((i >= 0 && i < 10) && (j == 0 || j == 9)) cout << (char)179;
  24.                 else if ((i == 0 || i == 10) && (j >= 0 && j < 10)) cout << (char)205;
  25.  
  26.                 if ((i == y || i == y + 1) && (j == x || j == x + 1)) cout << "* ";
  27.                 else cout << " ";
  28.  
  29.                 /*if (((i <= 2 || i >= 7) || (j <= 2 || j >= 7)) && !((i == 4 || i == 6) && (j >= 0 && j <= 2)) && !((i == 3 || i == 5) && (j >= 7 && j <= 9))) cout << "- ";
  30.                 else if ((i == 4 || i == 6) && (j >= 0 && j <= 2)) cout << "\\ ";
  31.                 else if ((i == 3 || i == 5) && (j >= 7 && j <= 9)) cout << "/ ";
  32.                 else cout << "* ";*/
  33.  
  34.             }
  35.  
  36.             cout << endl;
  37.         }
  38.  
  39.         switch (key)
  40.         {
  41.         case 87: // W
  42.             y -= 1;
  43.             break;
  44.         case 119: // W
  45.             y -= 1;
  46.             break;
  47.         case 83: // W
  48.             y += 1;
  49.             break;
  50.         case 115: // W
  51.             y += 1;
  52.             break;
  53.         case 65:
  54.             x -= 1;
  55.             break;
  56.         case 97:   
  57.             x -= 1;
  58.             break;
  59.         case 68:
  60.             x += 1;
  61.             break;
  62.         case 100:
  63.             x += 1;
  64.             break;
  65.         }
  66.  
  67.  
  68.     key = getch();
  69.     system("cls");
  70.     }while (key != 27);
  71.    
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement