Foros del Web » Programación para mayores de 30 ;) » Programación General »

Juego Tres En Raya

Estas en el tema de Juego Tres En Raya en el foro de Programación General en Foros del Web. HOLA TENGO QUE HACER EL JUEGO DEL TRES EN RAYA Y NO ME SALE, NO SE COMO CONTINUAR. AVER SI ALGUIEN ME AYUDA A TERMINARLO ...
  #1 (permalink)  
Antiguo 26/02/2006, 16:40
 
Fecha de Ingreso: febrero-2006
Mensajes: 1
Antigüedad: 18 años, 2 meses
Puntos: 0
Juego Tres En Raya

HOLA TENGO QUE HACER EL JUEGO DEL TRES EN RAYA Y NO ME SALE, NO SE COMO CONTINUAR. AVER SI ALGUIEN ME AYUDA A TERMINARLO PLEASE.TENGO QUE USAR UNA FUNCION RECURSIVA PERO NO LLEVO MUCHO TIEMPO CON LA PROG Y SE ME DA BASTANTE MAL.TENGO QUE ENTREGARLO EL JUEVES PA CLASE...AYUDA!!


Código:
/*REALIZAR JUEGO TRES EN RAYA: JUGADOR CONTRA ORDENADOR*/

#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>

void tablero (int,int);
void jug_pc(void);
void jugador(void);
char matriz [3][3];

void main(void)
{

printf("BIENVENIDO AL TRES EN RAYA\n");
printf("--------------------------\n");
printf("Las posiciones empiezan en '0' y acaban en '2'\n\n");
printf("Jugador, introduce la posicion");
jugador();

}

void jugador(void)
{
int i,j;

printf("\n\n\n FILA : ");
scanf("%d",&i);
printf("\nCOLUMNA : ");
scanf("%d",&j);

if(i>3 || j>3)
 {
 printf("\n\nLo siento,esa coordenada no existe");
 }
 else
  {
	matriz[i][j]='X';
	tablero(i,j);
   getch();
  }
clrscr();
flushall();
jug_pc();
getch();
}

void jug_pc(void)
{
int i,j;

for (i=0; i<3; i++)
 {
   for (j=0; j<3; j++)
     {
     if(matriz[i][j]!='X')
       {
       matriz[i][j]='O';
       tablero(i,j);
       jugador();
       }
      }

 }
}


void tablero (int i,int j)
{
clrscr();

printf("\n\n    0  |  1  | 2 \n");
printf("-------------------\n");
printf(" 0  %c  |  %c  |  %c\n",matriz[0][0],matriz[0][1],matriz[0][2]);
printf("-------------------\n");
printf(" 1  %c  |  %c  |  %c\n",matriz[1][0],matriz[1][1],matriz[1][2]);
printf("-------------------\n");
printf(" 2  %c  |  %c  |  %c\n",matriz[2][0],matriz[2][1],matriz[2][2]);


return;
}
  #2 (permalink)  
Antiguo 04/03/2010, 04:12
 
Fecha de Ingreso: marzo-2010
Mensajes: 3
Antigüedad: 14 años, 2 meses
Puntos: 0
De acuerdo Respuesta: Juego Tres En Raya

Cita:
Iniciado por Manu1982 Ver Mensaje
HOLA TENGO QUE HACER EL JUEGO DEL TRES EN RAYA Y NO ME SALE, NO SE COMO CONTINUAR. AVER SI ALGUIEN ME AYUDA A TERMINARLO PLEASE.TENGO QUE USAR UNA FUNCION RECURSIVA PERO NO LLEVO MUCHO TIEMPO CON LA PROG Y SE ME DA BASTANTE MAL.TENGO QUE ENTREGARLO EL JUEVES PA CLASE...AYUDA!!


Código:
/*REALIZAR JUEGO TRES EN RAYA: JUGADOR CONTRA ORDENADOR*/

#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>

void tablero (int,int);
void jug_pc(void);
void jugador(void);
char matriz [3][3];

void main(void)
{

printf("BIENVENIDO AL TRES EN RAYA\n");
printf("--------------------------\n");
printf("Las posiciones empiezan en '0' y acaban en '2'\n\n");
printf("Jugador, introduce la posicion");
jugador();

}

void jugador(void)
{
int i,j;

printf("\n\n\n FILA : ");
scanf("%d",&i);
printf("\nCOLUMNA : ");
scanf("%d",&j);

if(i>3 || j>3)
 {
 printf("\n\nLo siento,esa coordenada no existe");
 }
 else
  {
	matriz[i][j]='X';
	tablero(i,j);
   getch();
  }
clrscr();
flushall();
jug_pc();
getch();
}

void jug_pc(void)
{
int i,j;

for (i=0; i<3; i++)
 {
   for (j=0; j<3; j++)
     {
     if(matriz[i][j]!='X')
       {
       matriz[i][j]='O';
       tablero(i,j);
       jugador();
       }
      }

 }
}


void tablero (int i,int j)
{
clrscr();

printf("\n\n    0  |  1  | 2 \n");
printf("-------------------\n");
printf(" 0  %c  |  %c  |  %c\n",matriz[0][0],matriz[0][1],matriz[0][2]);
printf("-------------------\n");
printf(" 1  %c  |  %c  |  %c\n",matriz[1][0],matriz[1][1],matriz[1][2]);
printf("-------------------\n");
printf(" 2  %c  |  %c  |  %c\n",matriz[2][0],matriz[2][1],matriz[2][2]);


return;
}
  #3 (permalink)  
Antiguo 04/03/2010, 04:13
 
Fecha de Ingreso: marzo-2010
Mensajes: 3
Antigüedad: 14 años, 2 meses
Puntos: 0
Respuesta: Juego Tres En Raya

pues yo estoy con el mismo problema no lo sabes tu bien lo que tengo aqui liao
  #4 (permalink)  
Antiguo 04/03/2010, 04:19
 
Fecha de Ingreso: marzo-2010
Mensajes: 3
Antigüedad: 14 años, 2 meses
Puntos: 0
Respuesta: Juego Tres En Raya

Cita:
Iniciado por valentin21 Ver Mensaje
Pues yo estoy con el mismo problema no lo sabes tu bien lo que tengo aqui liao. Yo lo e copiao y lo e pegao y tengo el mismo problema que tu, a ver si la haces bien antes de las 12:30 de hoy y me lo pasas al correo: [email protected] ya sabes te espero
  #5 (permalink)  
Antiguo 17/11/2010, 06:36
 
Fecha de Ingreso: enero-2010
Mensajes: 389
Antigüedad: 14 años, 3 meses
Puntos: 4
Respuesta: Juego Tres En Raya

Aquí teneis un tres en raya hecho en C , funciona perfectamente
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas (incluyéndote)




La zona horaria es GMT -6. Ahora son las 07:01.