FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
Juegos con matrices
Buenas... tengo que rendir un final con matrices y es sobre todo orientado a juegos que puedan usar una matriz, ej: memotest, batalla naval, tateti, etc.
Lo que ando buscando es si alguien tiene juegos para que yo practique, no me refiero a echos (pero si estan echos no se desprecian ) asi que si a alguno se le ocurre o sabe de donde puedo sacar para practicar lo agradezco grax y salu2!!! |
#2
|
||||
|
||||
Si buscas por la red puedes encontrar muchos juegos de este estilo y con su código fuente.
Un ejemplo: http://maxxdelphisite.free.fr/tetris.htm Saludos |
#3
|
|||
|
|||
estoy googleando a full pero no encuentro lo que realmente busco...
Te agradezco un monton tu aporte, pero el tema es que eso ya es muuuuyyy complejo para mi nivel, por eso di ejemplos de los prog que he echo. |
#4
|
||||
|
||||
¿Podrías poner algún ejemplo (código) de lo que ya has hecho, para poder ver tu nivel?
¿Qué es lo que quieres exactamente? |
#5
|
|||
|
|||
ESTO SERIA EL TATETI, ESPERO QUE SIRVA PARA QUE ME PUEDAN DAR UNA MANO!!!
Código:
unit tateti; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type matriz = record ficha: integer; usado: boolean; end; TForm1 = class(TForm) Memo1: TMemo; GroupBoxjugador1: TGroupBox; Edit_fila_1: TEdit; Edit_col_1: TEdit; Label1: TLabel; Label2: TLabel; Button1: TButton; GroupBoxjugador2: TGroupBox; Label3: TLabel; Label4: TLabel; Edit_fila_2: TEdit; Edit_col_2: TEdit; Button2: TButton; Button_reiciniar: TButton; Buttonganador: TButton; Buttonimprimir: TButton; procedure FormShow(Sender: TObject); procedure Button1Click(Sender: TObject); procedure ButtonganadorClick(Sender: TObject); procedure Button2Click(Sender: TObject); procedure ButtonimprimirClick(Sender: TObject); procedure Button_reiciniarClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var tate: array [1..3,1..3] of matriz; Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormShow(Sender: TObject); begin edit_fila_1.Clear; edit_col_1.Clear; edit_fila_2.Clear; edit_col_2.Clear; memo1.Clear; groupboxjugador2.Enabled:=true; groupboxjugador1.Enabled:=true; end; {***********************************************************} procedure TForm1.Button1Click(Sender: TObject); var F,C :integer; begin if (edit_fila_1.Text='') or (edit_col_1.Text='') then showmessage ('INGRESE LAS COORDENADAS!!!') else begin F:=strtoint(edit_fila_1.Text); C:=strtoint(edit_col_1.Text); if ((F>3) or (C>3) or (F<=0) or (C<=0)) then showmessage ('NO VES QUE ES UN TATETI Y NO UNA BATALLA NAVAL!!!') else begin if (tate[F,C].usado=true) then showmessage ('CASILLA USADA!!!') else begin tate[F,C].ficha:=1; tate[F,C].usado:=true; groupboxjugador1.Enabled:=false; groupboxjugador2.Enabled:=true; end; end; end; ButtonimprimirClick(Sender); ButtonganadorClick(Sender); edit_fila_1.Clear; edit_col_1.Clear; end; {***********************************************************} procedure TForm1.Button2Click(Sender: TObject); var F,C :integer; begin if (edit_fila_2.Text='') or (edit_col_2.Text='') then showmessage ('INGRESE LAS COORDENADAS!!!') else begin F:=strtoint(edit_fila_2.Text); C:=strtoint(edit_col_2.Text); if ((F>3) or (C>3) or (F<=0) or (C<=0)) then showmessage ('NO VES QUE ES UN TATETI Y NO UNA BATALLA NAVAL!!!') else begin if (tate[F,C].usado=true) then showmessage ('CASILLA USADA!!!') else begin tate[F,C].ficha:=2; tate[F,C].usado:=true; groupboxjugador2.Enabled:=false; groupboxjugador1.Enabled:=true; end; end; end; ButtonimprimirClick(Sender); ButtonganadorClick(Sender); edit_fila_2.Clear; edit_col_2.Clear; end; {***********************************************************} procedure TForm1.ButtonganadorClick(Sender: TObject); var F,C: integer; begin {chequeo fila} for F:=1 to 3 do if ((tate[F,1].usado=true)and(tate[F,2].ficha=tate[F,1].ficha) and (tate[F,3].ficha=tate[F,1].ficha)) then begin showmessage ('TA TE TI'); groupboxjugador1.Enabled:=false; groupboxjugador2.Enabled:=false; end; for C:=1 to 3 do if ((tate[1,C].usado=true)and(tate[2,C].ficha=tate[1,C].ficha) and (tate[3,C].ficha=tate[1,C].ficha)) then begin showmessage ('TA TE TI'); groupboxjugador1.Enabled:=false; groupboxjugador2.Enabled:=false; end; if ((tate[1,1].usado=true)and(tate[2,2].ficha=tate[1,1].ficha) and (tate[3,3].ficha=tate[1,1].ficha)) then begin showmessage ('TA TE TI'); groupboxjugador1.Enabled:=false; groupboxjugador2.Enabled:=false; end; if ((tate[1,3].usado=true)and(tate[2,2].ficha=tate[1,3].ficha) and (tate[3,1].ficha=tate[1,3].ficha)) then begin showmessage ('TA TE TI'); groupboxjugador1.Enabled:=false; groupboxjugador2.Enabled:=false; end; end; {***********************************************************} procedure TForm1.ButtonimprimirClick(Sender: TObject); var F,C:integer; linea,letra: string; begin memo1.Clear; for F:=1 to 3 do begin linea:=''; for C:=1 to 3 do begin if (tate[F,C].ficha=1) then letra:='X' else if tate[F,C].ficha=2 then letra:='O' else letra:= '* '; linea:=linea+(letra)+ ' '; end; memo1.Lines.Add(linea); memo1.Lines.Add(#13) end; end; {***********************************************************} procedure TForm1.Button_reiciniarClick(Sender: TObject); var F,C:integer; begin memo1.Clear; for F:=1 to 3 do for C:=1 to 3 do begin tate[F,C].ficha:=0; tate[F,C].usado:=false; end; end; end. |
#6
|
||||
|
||||
Vale, no sabía qué era eso de "Ta te ti", hasta que he probado tu código (he tenido que diseñar enteramente el form ) y he visto que es lo que también se conoce como tres en raya
Sigo sin tener claro qué es lo que pedías, para usar este juego con una matriz yo habría hecho...
y faltaría implementar la función comprobar_ganador para ver si después de cada turno alguien ha ganado Claro que, cada uno tiene su estilo... Saludos. Última edición por ixMike fecha: 14-12-2007 a las 18:28:37. |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
matrices | finees | Varios | 5 | 15-11-2006 01:52:27 |
funciones y matrices | anto1178 | Varios | 1 | 28-08-2006 17:29:31 |
juegos 2d | Flores | Varios | 0 | 30-05-2005 14:44:35 |
Matrices | sergio_015 | OOP | 3 | 09-03-2005 19:53:07 |
Matrices | mmtaffarel | OOP | 2 | 15-10-2004 03:19:27 |
|