codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> #include "mylib.h" using namespace std; struct Triqui { char x[3][3]; // tablero de juego char av[2]; // avatar de cada jugador char *jug1, *jug2; // nombres de los jugadores short turno; // 1 o 2 void verTablero(); bool casillaOcupada(short, short); void leeMovim(); void cambiaTurno(); void leeNombres(); void leeAvatares(); bool hayTriqui(); bool tableroLleno(); }; int main() { Triqui juego; juego.verTablero(); juego.turno = 1; juego.leeNombres(); juego.leeAvatares(); do { juego.cambiaTurno(); juego.leeMovim(); } while (!juego.hayTriqui() && !juego.tableroLleno()); system("pause>nul"); } void Triqui::verTablero() { cout << "JUEGO DE TRIQUI\n\n" << "_ _ _\n\n_ _ _\n\n_ _ _\n\n"; } void Triqui::leeMovim() { short x, y; do { cout << "Ingrese fila y columna de su jugada: "; cin >> x >> y; } while (x<0 || y<0 || x>3 || y>3 || casillaOcupada(x, y) ); this->x[x][y] = av[turno-1]; // guarda la jugada gotoxy(3*(y-1), 2*x); cout << av[turno-1]; } void Triqui::cambiaTurno() { } void Triqui::leeNombres() { } void Triqui::leeAvatares() { cout << "Ingrese avatares 1er y 2\xf8 jugador: "; cin >> av[0] >> av[1]; } bool Triqui::hayTriqui() { return true; } bool Triqui::casillaOcupada(short x, short y) { bool r = this->x[x][y] == av[0] || this->x[x][y] == av[1]; return r; } bool Triqui::tableroLleno() { return true; }
Private
[
?
]
Run code
Submit