1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include <iostream>
#include <list>
#include <random>
#define VK_NUMPAD8 0x68;
#define VK_NUMPAD2 0x62;
#define VK_NUMPAD6 0x66;
#define VK_NUMPAD4 0x64;
using namespace std;
extern int up = 0;
extern int down = 0;
extern int left = 0;
extern int right = 0;
extern int position[2] = { 0, 8 };
extern int option, x, y;
extern char character = 'O ';
extern char mainGrid[8][9] = { { 'X','X','X','X','X','X','X','X', },
{ 'X','X','X','X','X','X','X','X', },
{ 'X','X','X','X','X','X','X','X', },
{ 'X','X','X','X','X','X','X','X', },
{ 'X','X','X','X','X','X','X','X', } };
void grid()
{
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 8; y++) {
if (x == position[0] && y == position[1])
cout << character;
else
cout << mainGrid[x][y];
cout << " ";
}
cout << endl;
}
cout << "Hit enter." << cin.get();
position[1] = 1;
system("cls");
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 8; y++) {
if (x == position[0] && y == position[1])
cout << character;
else
cout << mainGrid[x][y];
cout << " ";
}
cout << endl;
}
cout << "Done! Press Enter." << cin.get();
}
int main()
{
int option;
cout << "1: Play the game! \n";
cout << "2: Exit the game. \n";
cout << "\n";
cout << "Please enter 1 of 2 options: \n";
cin >> (option);
if (option == 1)
grid();
else
return 0; // change
}
|