NEWS
ACERVO
HTML, CSS
JAVA
C, C++, C#
PASCAL
PYTHON
PHP
ALGORITMO
EDI. VÍDEO
EDI. ÁUDIO
EDI. IMAGEM
LINUX
FERRAMENTAS
EMOJI TECLADO
CONVERSOR ADSENSE
CALCULADORA
CURSOS
SOCIAL
GITHUB
YOUTUBE
INSTAGRAM
MYSELF.JUNIOR
DOAR
INFORMATICODE
Delphi,Jogo da Velha
Código do Jogo da Velha COMPLETO!
Fornecido por:
http://www.planetadelphi.com.br/downloading/5071
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Buttons, StdCtrls, ExtCtrls, WinSkinData, Menus; type TForm1 = class(TForm) Panel1: TPanel; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button7: TButton; Button8: TButton; Button9: TButton; GroupBox1: TGroupBox; Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; Edit3: TEdit; Edit4: TEdit; GroupBox2: TGroupBox; BitBtn1: TBitBtn; BitBtn2: TBitBtn; Label3: TLabel; Label4: TLabel; Edit5: TEdit; Label5: TLabel; MainMenu1: TMainMenu; Sobre1: TMenuItem; Programador1: TMenuItem; email1: TMenuItem; fone1: TMenuItem; novaconexaobrasilhotmailcom1: TMenuItem; N98871472291: TMenuItem; N98819535891: TMenuItem; N86811437611: TMenuItem; FranciscoNonatoVieiradosSantos1: TMenuItem; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Button8Click(Sender: TObject); procedure Button9Click(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Novo1Click(Sender: TObject); private { Private declarations } public { Public declarations } procedure limpa; procedure finaliza; procedure start; end; var Form1: TForm1; cont: string; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button1.Caption:='X'; Button1.Font.Color:=clBlue; Edit5.Text:='0'; Button1.Enabled:=false; end else begin Button1.Caption:='O'; Button1.Font.Color:=clYellow; Edit5.Text:='1'; Button1.Enabled:=false; Button1.Font.Color:=clYellow; Button1.Font.Color:=clYellow; end; end; procedure TForm1.Button2Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button2.Caption:='X'; Button2.Font.Color:=clBlue; Edit5.Text:='0'; Button2.Enabled:=false; end else begin Button2.Caption:='O'; Button2.Font.Color:=clRed; Edit5.Text:='1'; Button2.Enabled:=false; end; end; procedure TForm1.Button3Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button3.Caption:='X'; Button3.Font.Color:=clBlue; Edit5.Text:='0'; Button3.Enabled:=false; end else begin Button3.Caption:='O'; Button3.Font.Color:=clRed; Edit5.Text:='1'; Button3.Enabled:=false; end; end; procedure TForm1.Button4Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button4.Caption:='X'; Button4.Font.Color:=clBlue; Edit5.Text:='0'; Button4.Enabled:=false; end else begin Button4.Caption:='O'; Button4.Font.Color:=clRed; Edit5.Text:='1'; Button4.Enabled:=false; end; end; procedure TForm1.Button5Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button5.Caption:='X'; Button5.Font.Color:=clBlue; Edit5.Text:='0'; Button5.Enabled:=false; end else begin Button5.Caption:='O'; Button5.Font.Color:=clRed; Edit5.Text:='1'; Button5.Enabled:=false; end; end; procedure TForm1.Button6Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button6.Caption:='X'; Button6.Font.Color:=clBlue; Edit5.Text:='0'; Button6.Enabled:=false; end else begin Button6.Caption:='O'; Button6.Font.Color:=clRed; Edit5.Text:='1'; Button6.Enabled:=false; end; end; procedure TForm1.Button7Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button7.Caption:='X'; Button7.Font.Color:=clBlue; Edit5.Text:='0'; Button7.Enabled:=false; end else begin Button7.Caption:='O'; Button7.Font.Color:=clRed; Edit5.Text:='1'; Button7.Enabled:=false; end; end; procedure TForm1.Button8Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button8.Caption:='X'; Button8.Font.Color:=clBlue; Edit5.Text:='0'; Button8.Enabled:=false; end else begin Button8.Caption:='O'; Button8.Font.Color:=clRed; Edit5.Text:='1'; Button8.Enabled:=false; end; end; procedure TForm1.Button9Click(Sender: TObject); begin cont:=edit5.Text; if (cont='1') then begin Button9.Caption:='X'; Button9.Font.Color:=clBlue; Edit5.Text:='0'; Button9.Enabled:=false; end else begin Button9.Caption:='O'; Button9.Font.Color:=clRed; Edit5.Text:='1'; Button9.Enabled:=false; end; end; procedure TForm1.BitBtn1Click(Sender: TObject); begin finaliza; BitBtn1.Caption:='Ver Resultado!'; begin if (Button1.Caption=Button2.Caption) and (Button2.Caption=Button3.Caption) and (Button1.Caption<>'')and(Button2.Caption<>'')and(Button3.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit1.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit2.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button4.Caption=Button5.Caption) and (Button5.Caption=Button6.Caption) and (Button4.Caption<>'')and(Button5.Caption<>'')and(Button6.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit1.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit2.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button7.Caption=Button8.Caption) and (Button8.Caption=Button9.Caption) and (Button7.Caption<>'')and(Button8.Caption<>'')and(Button9.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit1.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit2.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button1.Caption=Button4.Caption) and (Button4.Caption=Button7.Caption) and (Button1.Caption<>'')and(Button4.Caption<>'')and(Button7.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit1.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit2.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button2.Caption=Button5.Caption) and (Button5.Caption=Button8.Caption) and (Button2.Caption<>'')and(Button5.Caption<>'')and(Button8.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit1.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit2.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button3.Caption=Button6.Caption) and (Button6.Caption=Button9.Caption) and (Button3.Caption<>'')and(Button6.Caption<>'')and(Button9.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit1.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit2.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button1.Caption=Button5.Caption) and (Button5.Caption=Button9.Caption) and (Button1.Caption<>'')and(Button5.Caption<>'')and(Button9.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit1.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit2.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button3.Caption=Button5.Caption) and (Button5.Caption=Button7.Caption) and (Button3.Caption<>'')and(Button5.Caption<>'')and(Button7.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit1.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit2.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; limpa; start; end; if MessageDlg('Deseja abrir uma nova partida?', mtConfirmation, [mbYES,mbNO], 0) = mryes then begin if (cont='1') then begin ShowMessage(' Quem começa a partida é '+Edit2.Text); end else begin ShowMessage(' Quem começa a partida é '+Edit1.Text); end; start; limpa; end else begin finaliza; end; end; procedure TForm1.BitBtn2Click(Sender: TObject); begin if MessageDlg('Deseja sair do jogo agora?', mtConfirmation, [mbyes,mbno],0) = mryes then begin close; end; end; procedure TForm1.FormCreate(Sender: TObject); begin ShowMessage('Digite o nome dos jogadores !!!'); end; procedure TForm1.Novo1Click(Sender: TObject); begin finaliza; BitBtn1.Caption:='Ver Resultado!'; if (Button1.Enabled=true) then begin if (Button1.Caption=Button2.Caption) and (Button2.Caption=Button3.Caption) and (Button1.Caption<>'')and(Button2.Caption<>'')and(Button3.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit2.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit1.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button4.Caption=Button5.Caption) and (Button5.Caption=Button6.Caption) and (Button4.Caption<>'')and(Button5.Caption<>'')and(Button6.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit2.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit1.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button7.Caption=Button8.Caption) and (Button8.Caption=Button9.Caption) and (Button7.Caption<>'')and(Button8.Caption<>'')and(Button9.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit2.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit1.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button1.Caption=Button4.Caption) and (Button4.Caption=Button7.Caption) and (Button1.Caption<>'')and(Button4.Caption<>'')and(Button7.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit2.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit1.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button2.Caption=Button5.Caption) and (Button5.Caption=Button8.Caption) and (Button2.Caption<>'')and(Button5.Caption<>'')and(Button8.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit2.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit1.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button3.Caption=Button6.Caption) and (Button6.Caption=Button9.Caption) and (Button3.Caption<>'')and(Button6.Caption<>'')and(Button9.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit2.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit1.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button1.Caption=Button5.Caption) and (Button5.Caption=Button9.Caption) and (Button1.Caption<>'')and(Button5.Caption<>'')and(Button9.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit2.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit1.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; if (Button3.Caption=Button5.Caption) and (Button5.Caption=Button7.Caption) and (Button3.Caption<>'')and(Button5.Caption<>'')and(Button7.Caption<>'') then begin if (Edit5.Text='0') then begin ShowMessage('O vencedor foi '+ edit2.text); Edit3.Text:=IntToStr(StrToInt(Edit3.Text)+1); end else begin ShowMessage('O vencedor foi '+ edit1.text); Edit4.Text:=IntToStr(StrToInt(Edit4.Text)+1); end; end; limpa; BitBtn1.Caption:='Novo'; start; end; if MessageDlg('Deseja abrir uma nova partida?', mtConfirmation, [mbYES,mbNO], 0) = mryes then begin if (cont='1') then begin ShowMessage(' Quem começa a partida é '+Edit1.Text); end else begin ShowMessage(' Quem começa a partida é '+Edit2.Text); end; start; end; end; procedure TForm1.limpa; begin Button1.Caption:=''; Button2.Caption:=''; Button3.Caption:=''; Button4.Caption:=''; Button5.Caption:=''; Button6.Caption:=''; Button7.Caption:=''; Button8.Caption:=''; Button9.Caption:=''; end; procedure TForm1.finaliza; begin Button1.Enabled:=false; Button2.Enabled:=false; Button3.Enabled:=false; Button4.Enabled:=false; Button5.Enabled:=false; Button6.Enabled:=false; Button7.Enabled:=false; Button8.Enabled:=false; Button9.Enabled:=false; end; procedure TForm1.start; begin Button1.Enabled:=true; Button2.Enabled:=true; Button3.Enabled:=true; Button4.Enabled:=true; Button5.Enabled:=true; Button6.Enabled:=true; Button7.Enabled:=true; Button8.Enabled:=true; Button9.Enabled:=true; end; end.
Postagem mais recente
Postagem mais antiga
Página inicial