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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
#include <iostream>
using namespace std;
int TCY[5] = { 1, 2, 3, 4, 5 };
char piezas[5][5] =
{
{ 'X', 'X', 'X', 'X', 'X' },
{ ' ', ' ', ' ', ' ', ' ' },
{ ' ', ' ', ' ', ' ', ' ' },
{ ' ', ' ', ' ', ' ', ' ' },
{ '0', '0', '0', '0', '0' },
};
int row1, row2, colum1, colum2;
char turn = 'X';
bool playing = true;
bool validacion = false;
void tablero();
void entrada();
void move();
void fin();
int main() {
cout << "************** DAMAS *****************" << endl;
cout << endl;
cout << "Player 1: [X]\n";
cout << "Player 2: [0]\n\n";
cout << "rows and columns start at 0\n";
cout << "<----COLUMNAS--->\n";
cout << "^\n";
cout << "|\n";
cout << "|\n";
cout << "|\n";
cout << "ROWS\n";
cout << "|\n";
cout << "|\n";
cout << "|\n";
cout << "v\n\n";
cout << endl;
system("pause");
cout << "\n\n";
while (playing)
{
tablero();
if (turn == 'X')
{
cout << endl;
cout << " - Player 1 [X] - \n" << endl;
}
else if (turn == '0')
{
cout << endl;
cout << " - Player 2 [0] - \n" << endl;
}
entrada();
}
}
void tablero()
{
cout << " +---+---+---+---+---+\n";
cout << " | " << piezas[0][0] << " | " << piezas[0][1] << " | " << piezas[0][2] << " | " << piezas[0][3] << " | " << piezas[0][4] << " | " << TCY[0] << endl;
cout << " +---+---+---+---+---+\n";
cout << " | " << piezas[1][0] << " | " << piezas[1][1] << " | " << piezas[1][2] << " | " << piezas[1][3] << " | " << piezas[1][4] << " | " << TCY[1] << endl;
cout << " +---+---+---+---+---+\n";
cout << " | " << piezas[2][0] << " | " << piezas[2][1] << " | " << piezas[2][2] << " | " << piezas[2][3] << " | " << piezas[2][4] << " | " << TCY[2] << endl;
cout << " +---+---+---+---+---+\n";
cout << " | " << piezas[3][0] << " | " << piezas[3][1] << " | " << piezas[3][2] << " | " << piezas[3][3] << " | " << piezas[3][4] << " | " << TCY[3] << endl;
cout << " +---+---+---+---+---+\n";
cout << " | " << piezas[4][0] << " | " << piezas[4][1] << " | " << piezas[4][2] << " | " << piezas[4][3] << " | " << piezas[4][4] << " | " << TCY[4] << endl;
cout << " +---+---+---+---+---+\n";
cout << " 1 2 3 4 5 " << endl;
}
void entrada()
{
cout << endl;
cout << "which piece would you move?\n";
cout << "Row: ";
cin >> row1;
cout << "Column: ";
cin >> colum1;
cout << endl;
while (row1 < 0 || row1 > 5 || colum1 < 0 || colum1 > 5)
{
cout << endl;
cout << "Impossible!. numbers must be between 0 and 5. \n";
cout << "which piece would you move?\n";
cout << "Row: ";
cin >> row1;
cout << "Column: ";
cin >> colum1;
cout << endl;
}
cout << "To the position...\n";
cout << "Row: ";
cin >> row2;
cout << "Column: ";
cin >> colum2;
cout << endl;
while (row2 < 0 || row2 > 5 || colum2 < 0 || colum2 > 5)
{
cout << endl;
cout << "Impossible!. numbers must be between 0 and 5. \n";
cout << "Which piece would you move?\n";
cout << "Row: ";
cin >> row2;
cout << "Column: ";
cin >> colum2;
cout << endl;
}
}
|