AlexMerci 0 Denunciar post Postado Dezembro 6, 2007 Galera to precisando do codigo fonte mas em c# do jogo da velha é para um trabalho de falculdade estou ficando doido já....se alguem poder me ajudar agradeço..... Compartilhar este post Link para o post Compartilhar em outros sites
quitZAUMMM 18 Denunciar post Postado Dezembro 6, 2007 putz cara eu tinha um desses, vo dar uma procurada por aki.. mas pra você tentar fazer, pense.. no jogo da velha são 9 posições, ou seja desenhe a tela e tal e vai ficar + ow - assim: 1 2 3 4 5 6 7 8 9 ai c o jogador falar o numero tres você substitui o numero 3 por 'x' ow 'o'. ex: 1 2 x 4 5 6 7 8 9 ai a partir da terceira jogada você pode ir fazendo comparações pra ver c o cara ganho. flw Compartilhar este post Link para o post Compartilhar em outros sites
AlexMerci 0 Denunciar post Postado Dezembro 6, 2007 Vlw cara obrigado pela sua atenção, se você poder conseguir o codigo fonte do jogo eu agradeço pois assim eu estou começando a mecher com o visual stutio agora não mancho muito da c# se você encontrar posta aí pra mim obrigado.... Compartilhar este post Link para o post Compartilhar em outros sites
quitZAUMMM 18 Denunciar post Postado Dezembro 6, 2007 cara entra nesse tópico e ve o segundo post;; acho q ele atende oq você pediw :D http://forum.imasters.com.br/index.php?showtopic=231228 Compartilhar este post Link para o post Compartilhar em outros sites
slackneo 0 Denunciar post Postado Dezembro 6, 2007 Sem querer ser chato... mas você pelo menos tentou fazer??? Compartilhar este post Link para o post Compartilhar em outros sites
Renato Ramos 0 Denunciar post Postado Dezembro 12, 2007 oie.. isso aki nun eh uma reposta pro tópico... ms pra não criar tópicos com titulos repetidos... vo postar aki ^^... eu criei um jogo da velha.. mas ele está apresentando problemas... ja tentei resolver eles.. pra mim akbo as possibilidades... ele trava na quarta ou quinta jogada =/.. e não sei pq... alguem pode me ajuda? // jogo-da-velha #include <stdio.h> #include <stdlib.h> #include <conio.h> char matrix[3][3]; // a matriz do jogo char check(void) { int i; for(i=0; i<3; i++) //verifica as linhas if(matrix[i][0]==matrix[i][1] && matrix[i][0]==matrix[i][2]) return matrix[i][0]; for(i=0; i<3; i++) //verifica as colunas if(matrix[0][i]==matrix[1][i] && matrix[0][i]==matrix[2][i]) return matrix[0][i]; for(i=0; i<3; i++) // verifica a diagonal if(matrix[0][0]==matrix[1][1] && matrix[1][1]==matrix[2][2]) return matrix[0][0]; for(i=0; 1<3; i++)// verifica a diagonal if(matrix[0][2]==matrix[1][1] && matrix[1][1]==matrix[2][0]) return matrix[0][2]; for(i=0; i<3; i++) // verifica se ha empate if(matrix[0][0]!=' ' && matrix[0][1] !=' ' && matrix[0][2]!=' ' && matrix[1][0] !=' ' && matrix[1][1]!=' ' && matrix[1][2] !=' ' && matrix[2][0]!=' ' && matrix[2][1] !=' ' && matrix[2][2]!=' ') return 'v'; return ' '; } void init_matrix(void) //inicializa a matriz { int i, j; for(i=0; i<3; i++) for(j=0; j<3; j++) matrix[i][j]=' '; } void jogador1(void) { int x,y; printf("Jogador 1 digite a linha e coluna para o 'x': "); scanf("%d%d", &x, &y); x--; y--; if(matrix[x][y] !=' ') { printf("Posicao invalida, tente novamente. \n"); jogador1(); } else matrix[x][y]='x'; } void disp_matrix(void) { int t; for(t=0; t<3; t++) { printf(" %c | %c | %c ", matrix[t][0], matrix[t][1], matrix[t][2]); if(t!=2) printf("\n---|---|---\n"); } printf("\n"); } void jogador2(void) { disp_matrix(); int x,y; printf("Jogador 2 digite a linha e coluna para a 'o': "); scanf("%d%d", &x, &y); x--; y--; if(matrix[x][y] !=' ') { printf("Posicao invalida, tente novamente. \n"); jogador2(); } else matrix[x][y]='o'; } int main (void) { char done; done=' '; init_matrix(); do { printf("Este e o jogo-da-velha.\n"); printf("Divirta-se com seu amigo\n"); disp_matrix(); jogador1(); done=check(); //verifica se ha vencedor system("cls"); printf("Este e o jogo-da-velha.\n"); printf("Divirta-se com seu amigo\n"); if(done!=' ')break; //vencedor jogador2(); done = check(); // verifica se ha vencedor system("cls"); }while(done==' '); if(done=='x') {printf("Jogador 1 venceu!\n"); getch();} else if(done=='o') {printf("Jogador 2 venceu\n"); getch();} else {printf("Velha!"); getch();} getch(); main(); } c não puder me ajudar... me de alguma dik por favor! valeu! Compartilhar este post Link para o post Compartilhar em outros sites
omar.pessoa 1 Denunciar post Postado Dezembro 17, 2007 Nossa... Leiam o post antes de dar uma resposta... C# Compartilhar este post Link para o post Compartilhar em outros sites
quitZAUMMM 18 Denunciar post Postado Dezembro 17, 2007 + tipo passei pra ele um link de C++.. c ele manja C# ele vai saber implementar ué Nossa... Leiam o post antes de dar uma resposta... C# Compartilhar este post Link para o post Compartilhar em outros sites
Fernanda A. Bauer 0 Denunciar post Postado Junho 15, 2014 #include<stdio.h> #include<conio.h> int main(void) { char Matriz[3][3]; char O='O', X='X'; int l=0,j,i; for(i=0;i<3;i++) for(j=0;j<3;j++) Matriz[j]=' '; while(l<=9) { printf(" JOGO DA VELHA \n"); for(i=0;i<3;i++) { printf("\t\t %c \xBA %c \xBA %c\n",Matriz[0],Matriz[1],Matriz[2]); if(i<3-1) { printf("\t\t ÍÍÍ\xCEÍÍÍ\xCEÍÍÍ\n"); } } printf("\n\n\n\n\n\n\n\n\n\n\n\nINSIRA AS COORDENADAS, "); if(l%2)printf("PLAYER 2\nLINHA: "); else printf("PLAYER 1\nLINHA: "); scanf("%d",&i); printf("COLUNA: "); scanf("%d",&j); if(Matriz[i-1][j-1]==' ') { if(l%2)Matriz[i-1][j-1]=X; else Matriz[i-1][j-1]=O; l++; } if((Matriz[0][0]==O && Matriz[0][1]==O && Matriz[0][2]==O)|| (Matriz[1][0]==O && Matriz[1][1]==O && Matriz[1][2]==O)|| (Matriz[2][0]==O && Matriz[2][1]==O && Matriz[2][2]==O)|| (Matriz[0][0]==O && Matriz[1][0]==O && Matriz[2][0]==O)|| (Matriz[0][1]==O && Matriz[1][1]==O && Matriz[2][1]==O)|| (Matriz[0][2]==O && Matriz[1][2]==O && Matriz[2][2]==O)|| (Matriz[0][0]==O && Matriz[1][1]==O && Matriz[2][2]==O)|| (Matriz[0][2]==O && Matriz[1][1]==O && Matriz[2][0]==O)) { printf("\n\a\t\tJogador 1, VOCE VENCEU!!!"); break; } if((Matriz[0][0]==X && Matriz[0][1]==X && Matriz[0][2]==X)|| (Matriz[1][0]==X && Matriz[1][1]==X && Matriz[1][2]==X)|| (Matriz[2][0]==X && Matriz[2][1]==X && Matriz[2][2]==X)|| (Matriz[0][0]==X && Matriz[1][0]==X && Matriz[2][0]==X)|| (Matriz[0][1]==X && Matriz[1][1]==X && Matriz[2][1]==X)|| (Matriz[0][2]==X && Matriz[1][2]==X && Matriz[2][2]==X)|| (Matriz[0][0]==X && Matriz[1][1]==X && Matriz[2][2]==X)|| (Matriz[0][2]==X && Matriz[1][1]==X && Matriz[2][0]==X)) { printf("\n\n\n\n\a\t\tJogador 2, VOCE VENCEU!!!"); break; } if(l==9) { printf("PARTIDA EMPATADA"); break; } } getch(); return(0); } Espero ter ajudado, também estava a procura e encontrei esse... Compartilhar este post Link para o post Compartilhar em outros sites