Delphi'de Zeka Oyunu

+ Yorum Gönder
Webmaster ve Diğer Kodlama Dilleri Bölümünden Delphi'de Zeka Oyunu ile ilgili Kısaca Bilgi
  1. 1
    aslan-67
    Üye
    Reklam

    Delphi'de Zeka Oyunu

    Reklam



    Delphi'de Zeka Oyunu

    Forum Alev
    Delphi'de Zeka Oyunu

    Kod:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Buttons, Menus;
    
    type
      TForm1 = class(TForm)
        BitBtn1: TBitBtn;
        BitBtn2: TBitBtn;
        BitBtn3: TBitBtn;
        BitBtn4: TBitBtn;
        BitBtn5: TBitBtn;
        BitBtn6: TBitBtn;
        BitBtn7: TBitBtn;
        BitBtn8: TBitBtn;
        BitBtn9: TBitBtn;
        MainMenu1: TMainMenu;
        Oyun1: TMenuItem;
        YeniOyun1: TMenuItem;
        N1: TMenuItem;
        Hakknda1: TMenuItem;
        N2: TMenuItem;
        k1: TMenuItem;
        procedure FormCreate(Sender: TObject);
        procedure BitBtn1KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure BitBtn4KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure BitBtn2KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure BitBtn3KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure BitBtn6KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure BitBtn5KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure BitBtn7KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure BitBtn8KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure BitBtn9KeyUp(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure YeniOyun1Click(Sender: TObject);
        procedure Hakknda1Click(Sender: TObject);
        procedure k1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1   : TForm1;
      Sayilar : Array [1..9] Of Byte;
      Say,X,Y : Byte;
      Durum   : Boolean;
    
    implementation
    
    {$R *.dfm}
    
    Procedure Yeni;
    Begin
      Form1.BitBtn1.Visible:=True;
      Form1.BitBtn2.Visible:=True;
      Form1.BitBtn3.Visible:=True;
      Form1.BitBtn4.Visible:=True;
      Form1.BitBtn5.Visible:=True;
      Form1.BitBtn6.Visible:=True;
      Form1.BitBtn7.Visible:=True;
      Form1.BitBtn8.Visible:=True;
      Form1.BitBtn9.Visible:=True;
      Form1.BitBtn1.Enabled:=False;
      Form1.BitBtn2.Enabled:=False;
      Form1.BitBtn3.Enabled:=False;
      Form1.BitBtn4.Enabled:=False;
      Form1.BitBtn5.Enabled:=False;
      Form1.BitBtn6.Enabled:=False;
      Form1.BitBtn7.Enabled:=False;
      Form1.BitBtn8.Enabled:=False;
      Form1.BitBtn9.Enabled:=False;
      For Say:=0 To 8 Do
      Sayilar[Say+1]:=9;
      Randomize;
       For Say:=1 To 9 Do
       Begin
        Repeat
        Durum:=False;
        Sayilar[Say]:=Random(9);
        For X:=1 To 9 Do
        Begin
          If (Sayilar[Say]=Sayilar[X]) And (Say<>X) Then Durum:=True;
        End;
        Until Durum=False;
      End;
      Form1.BitBtn1.Caption:=IntToStr(Sayilar[1]);
      Form1.BitBtn2.Caption:=IntToStr(Sayilar[2]);
      Form1.BitBtn3.Caption:=IntToStr(Sayilar[3]);
      Form1.BitBtn4.Caption:=IntToStr(Sayilar[4]);
      Form1.BitBtn5.Caption:=IntToStr(Sayilar[5]);
      Form1.BitBtn6.Caption:=IntToStr(Sayilar[6]);
      Form1.BitBtn7.Caption:=IntToStr(Sayilar[7]);
      Form1.BitBtn8.Caption:=IntToStr(Sayilar[8]);
      Form1.BitBtn9.Caption:=IntToStr(Sayilar[9]);
      If Form1.BitBtn1.Caption='0' Then Form1.BitBtn1.Visible:=False;
      If Form1.BitBtn2.Caption='0' Then Form1.BitBtn2.Visible:=False;
      If Form1.BitBtn3.Caption='0' Then Form1.BitBtn3.Visible:=False;
      If Form1.BitBtn4.Caption='0' Then Form1.BitBtn4.Visible:=False;
      If Form1.BitBtn5.Caption='0' Then Form1.BitBtn5.Visible:=False;
      If Form1.BitBtn6.Caption='0' Then Form1.BitBtn6.Visible:=False;
      If Form1.BitBtn7.Caption='0' Then Form1.BitBtn7.Visible:=False;
      If Form1.BitBtn8.Caption='0' Then Form1.BitBtn8.Visible:=False;
      If Form1.BitBtn9.Caption='0' Then Form1.BitBtn9.Visible:=False;
      If Form1.BitBtn1.Visible=True Then Form1.BitBtn1.Enabled:=True
      Else Form1.BitBtn2.Enabled:=True;
    End;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Yeni;
    end;
    
    procedure TForm1.BitBtn1KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=40 Then
      Begin
        BitBtn1.Enabled:=False;
        If BitBtn4.Visible=True Then
        Begin
          BitBtn4.Enabled:=True;
          BitBtn4.SetFocus;
        End;
        If BitBtn4.Visible=False Then
        Begin
          BitBtn1.Enabled:=False;
          BitBtn1.Visible:=False;
          BitBtn4.Visible:=True;
          BitBtn4.Enabled:=True;
          BitBtn4.Caption:=BitBtn1.Caption;
          BitBtn4.SetFocus;
        End;
      End;
    
      If Key=39 Then
      Begin
        BitBtn1.Enabled:=False;
        If BitBtn2.Visible=True Then
        Begin
          BitBtn2.Enabled:=True;
          BitBtn2.SetFocus;
        End;
        If BitBtn2.Visible=False Then
        Begin
          BitBtn1.Enabled:=False;
          BitBtn1.Visible:=False;
          BitBtn2.Visible:=True;
          BitBtn2.Enabled:=True;
          BitBtn2.Caption:=BitBtn1.Caption;
          BitBtn2.SetFocus;
        End;
      End;
      Key:=0;
    end;
    
    procedure TForm1.BitBtn4KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=40 Then
      Begin
        If BitBtn7.Visible=True Then
        Begin
          BitBtn4.Enabled:=False;
          BitBtn7.Enabled:=True;
          BitBtn7.SetFocus;
        End;
        If BitBtn7.Visible=False Then
        Begin
          BitBtn4.Enabled:=False;
          BitBtn4.Visible:=False;
          BitBtn7.Visible:=True;
          BitBtn7.Enabled:=True;
          BitBtn7.Caption:=BitBtn4.Caption;
          BitBtn7.SetFocus;
        End;
      End;
    
      If Key=39 Then
      Begin
        If BitBtn5.Visible=True Then
        Begin
          BitBtn4.Enabled:=False;
          BitBtn5.Enabled:=True;
          BitBtn5.SetFocus;
        End;
        If BitBtn5.Visible=False Then
        Begin
          BitBtn4.Enabled:=False;
          BitBtn4.Visible:=False;
          BitBtn5.Visible:=True;
          BitBtn5.Enabled:=True;
          BitBtn5.Caption:=BitBtn4.Caption;
          BitBtn5.SetFocus;
        End;
      End;
    
      If Key=38 Then
      Begin
        If BitBtn1.Visible=True Then
        Begin
          BitBtn4.Enabled:=False;
          BitBtn1.Enabled:=True;
          BitBtn1.SetFocus;
        End;
        If BitBtn1.Visible=False Then
        Begin
          BitBtn4.Enabled:=False;
          BitBtn4.Visible:=False;
          BitBtn1.Visible:=True;
          BitBtn1.Enabled:=True;
          BitBtn1.Caption:=BitBtn4.Caption;
          BitBtn1.SetFocus;
        End;
      End;
      Key:=0;
    end;
    
    procedure TForm1.BitBtn2KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=40 Then
      Begin
        If BitBtn5.Visible=True Then
        Begin
          BitBtn2.Enabled:=False;
          BitBtn5.Enabled:=True;
          BitBtn5.SetFocus;
        End;
        If BitBtn5.Visible=False Then
        Begin
          BitBtn2.Enabled:=False;
          BitBtn2.Visible:=False;
          BitBtn5.Visible:=True;
          BitBtn5.Enabled:=True;
          BitBtn5.Caption:=BitBtn2.Caption;
          BitBtn5.SetFocus;
        End;
      End;
    
      If Key=39 Then
      Begin
        If BitBtn3.Visible=True Then
        Begin
          BitBtn2.Enabled:=False;
          BitBtn3.Enabled:=True;
          BitBtn3.SetFocus;
        End;
        If BitBtn3.Visible=False Then
        Begin
          BitBtn2.Enabled:=False;
          BitBtn2.Visible:=False;
          BitBtn3.Visible:=True;
          BitBtn3.Enabled:=True;
          BitBtn3.Caption:=BitBtn2.Caption;
          BitBtn3.SetFocus;
        End;
      End;
    
      If Key=37 Then
      Begin
        If BitBtn1.Visible=True Then
        Begin
          BitBtn2.Enabled:=False;
          BitBtn1.Enabled:=True;
          BitBtn1.SetFocus;
        End;
        If BitBtn1.Visible=False Then
        Begin
          BitBtn2.Enabled:=False;
          BitBtn2.Visible:=False;
          BitBtn1.Visible:=True;
          BitBtn1.Enabled:=True;
          BitBtn1.Caption:=BitBtn2.Caption;
          BitBtn1.SetFocus;
        End;
      End;
      Key:=0;  
    end;
    
    procedure TForm1.BitBtn3KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=40 Then
      Begin
        If BitBtn6.Visible=True Then
        Begin
          BitBtn3.Enabled:=False;
          BitBtn6.Enabled:=True;
          BitBtn6.SetFocus;
        End;
        If BitBtn6.Visible=False Then
        Begin
          BitBtn3.Enabled:=False;
          BitBtn3.Visible:=False;
          BitBtn6.Visible:=True;
          BitBtn6.Enabled:=True;
          BitBtn6.Caption:=BitBtn3.Caption;
          BitBtn6.SetFocus;
        End;
      End;
    
      If Key=37 Then
      Begin
        If BitBtn2.Visible=True Then
        Begin
          BitBtn3.Enabled:=False;
          BitBtn2.Enabled:=True;
          BitBtn2.SetFocus;
        End;
        If BitBtn2.Visible=False Then
        Begin
          BitBtn3.Enabled:=False;
          BitBtn3.Visible:=False;
          BitBtn2.Visible:=True;
          BitBtn2.Enabled:=True;
          BitBtn2.Caption:=BitBtn3.Caption;
          BitBtn2.SetFocus;
        End;
      End;
      Key:=0;
    end;
    
    procedure TForm1.BitBtn6KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=40 Then
      Begin
        If BitBtn9.Visible=True Then
        Begin
          BitBtn6.Enabled:=False;
          BitBtn9.Enabled:=True;
          BitBtn9.SetFocus;
        End;
    
        If BitBtn9.Visible=False Then
        Begin
          BitBtn6.Enabled:=False;
          BitBtn6.Visible:=False;
          BitBtn9.Visible:=True;
          BitBtn9.Enabled:=True;
          BitBtn9.Caption:=BitBtn6.Caption;
          BitBtn9.SetFocus;
        End;
    
      End;
    
      If Key=38 Then
      Begin
        If BitBtn3.Visible=True Then
        Begin
          BitBtn6.Enabled:=False;
          BitBtn3.Enabled:=True;
          BitBtn3.SetFocus;
        End;
    
        If BitBtn3.Visible=False Then
        Begin
          BitBtn6.Enabled:=False;
          BitBtn6.Visible:=False;
          BitBtn3.Visible:=True;
          BitBtn3.Enabled:=True;
          BitBtn3.Caption:=BitBtn6.Caption;
          BitBtn3.SetFocus;
        End;
      End;
    
      If Key=37 Then
      Begin
        If BitBtn5.Visible=True Then
        Begin
          BitBtn6.Enabled:=False;
          BitBtn5.Enabled:=True;
          BitBtn5.SetFocus;
        End;
        If BitBtn5.Visible=False Then
        Begin
          BitBtn6.Enabled:=False;
          BitBtn6.Visible:=False;
          BitBtn5.Visible:=True;
          BitBtn5.Enabled:=True;
          BitBtn5.Caption:=BitBtn6.Caption;
          BitBtn5.SetFocus;
        End;
      End;
      Key:=0;  
    end;
    
    procedure TForm1.BitBtn5KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=40 Then
      Begin
        If BitBtn8.Visible=True Then
        Begin
          BitBtn5.Enabled:=False;
          BitBtn8.Enabled:=True;
          BitBtn8.SetFocus;
        End;
        If BitBtn8.Visible=False Then
        Begin
          BitBtn5.Enabled:=False;
          BitBtn5.Visible:=False;
          BitBtn8.Visible:=True;
          BitBtn8.Enabled:=True;
          BitBtn8.Caption:=BitBtn5.Caption;
          BitBtn8.SetFocus;
        End;
      End;
    
      If Key=38 Then
      Begin
        If BitBtn2.Visible=True Then
        Begin
          BitBtn5.Enabled:=False;
          BitBtn2.Enabled:=True;
          BitBtn2.SetFocus;
        End;
        If BitBtn2.Visible=False Then
        Begin
          BitBtn5.Enabled:=False;
          BitBtn5.Visible:=False;
          BitBtn2.Visible:=True;
          BitBtn2.Enabled:=True;
          BitBtn2.Caption:=BitBtn5.Caption;
          BitBtn2.SetFocus;
        End;
      End;
    
      If Key=37 Then
      Begin
        If BitBtn4.Visible=True Then
        Begin
          BitBtn5.Enabled:=False;
          BitBtn4.Enabled:=True;
          BitBtn4.SetFocus;
        End;
        If BitBtn4.Visible=False Then
        Begin
          BitBtn5.Enabled:=False;
          BitBtn5.Visible:=False;
          BitBtn4.Visible:=True;
          BitBtn4.Enabled:=True;
          BitBtn4.Caption:=BitBtn5.Caption;
          BitBtn4.SetFocus;
        End;
      End;
    
      If Key=39 Then
      Begin
        If BitBtn6.Visible=True Then
        Begin
          BitBtn5.Enabled:=False;
          BitBtn6.Enabled:=True;
          BitBtn6.SetFocus;
        End;
        If BitBtn6.Visible=False Then
        Begin
          BitBtn5.Enabled:=False;
          BitBtn5.Visible:=False;
          BitBtn6.Visible:=True;
          BitBtn6.Enabled:=True;
          BitBtn6.Caption:=BitBtn5.Caption;
          BitBtn6.SetFocus;
        End;
      End;
      Key:=0;
    end;
    
    procedure TForm1.BitBtn7KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=38 Then
      Begin
        If BitBtn4.Visible=True Then
        Begin
          BitBtn7.Enabled:=False;
          BitBtn4.Enabled:=True;
          BitBtn4.SetFocus;
        End;
        If BitBtn4.Visible=False Then
        Begin
          BitBtn7.Enabled:=False;
          BitBtn7.Visible:=False;
          BitBtn4.Visible:=True;
          BitBtn4.Enabled:=True;
          BitBtn4.Caption:=BitBtn7.Caption;
          BitBtn4.SetFocus;
        End;
      End;
    
      If Key=39 Then
      Begin
        If BitBtn8.Visible=True Then
        Begin
          BitBtn7.Enabled:=False;
          BitBtn8.Enabled:=True;
          BitBtn8.SetFocus;
        End;
        If BitBtn8.Visible=False Then
        Begin
          BitBtn7.Enabled:=False;
          BitBtn7.Visible:=False;
          BitBtn8.Visible:=True;
          BitBtn8.Enabled:=True;
          BitBtn8.Caption:=BitBtn7.Caption;
          BitBtn8.SetFocus;
        End;
      End;
      Key:=0;
    end;
    
    procedure TForm1.BitBtn8KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=38 Then
      Begin
        If BitBtn5.Visible=True Then
        Begin
          BitBtn8.Enabled:=False;
          BitBtn5.Enabled:=True;
          BitBtn5.SetFocus;
        End;
        If BitBtn5.Visible=False Then
        Begin
          BitBtn8.Enabled:=False;
          BitBtn8.Visible:=False;
          BitBtn5.Visible:=True;
          BitBtn5.Enabled:=True;
          BitBtn5.Caption:=BitBtn8.Caption;
          BitBtn5.SetFocus;
        End;
      End;
    
      If Key=37 Then
      Begin
        If BitBtn7.Visible=True Then
        Begin
          BitBtn8.Enabled:=False;
          BitBtn7.Enabled:=True;
          BitBtn7.SetFocus;
        End;
    
        If BitBtn7.Visible=False Then
        Begin
          BitBtn8.Enabled:=False;
          BitBtn8.Visible:=False;
          BitBtn7.Visible:=True;
          BitBtn7.Enabled:=True;
          BitBtn7.Caption:=BitBtn8.Caption;
          BitBtn7.SetFocus;
        End;
      End;
    
      If Key=39 Then
      Begin
        If BitBtn9.Visible=True Then
        Begin
          BitBtn8.Enabled:=False;
          BitBtn9.Enabled:=True;
          BitBtn9.SetFocus;
        End;
        If BitBtn9.Visible=False Then
        Begin
          BitBtn8.Enabled:=False;
          BitBtn8.Visible:=False;
          BitBtn9.Visible:=True;
          BitBtn9.Enabled:=True;
          BitBtn9.Caption:=BitBtn8.Caption;
          BitBtn9.SetFocus;
        End;
      End;
      Key:=0;  
    end;
    
    procedure TForm1.BitBtn9KeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      If Key=37 Then
      Begin
        If BitBtn8.Visible=True Then
        Begin
          BitBtn9.Enabled:=False;
          BitBtn8.Enabled:=True;
          BitBtn8.SetFocus;
        End;
        If BitBtn8.Visible=False Then
        Begin
          BitBtn9.Enabled:=False;
          BitBtn9.Visible:=False;
          BitBtn8.Visible:=True;
          BitBtn8.Enabled:=True;
          BitBtn8.Caption:=BitBtn9.Caption;
          BitBtn8.SetFocus;
        End;
      End;
    
      If Key=38 Then
      Begin
        If BitBtn6.Visible=True Then
        Begin
          BitBtn9.Enabled:=False;
          BitBtn6.Enabled:=True;
          BitBtn6.SetFocus;
        End;
        If BitBtn6.Visible=False Then
        Begin
          BitBtn9.Enabled:=False;
          BitBtn9.Visible:=False;
          BitBtn6.Visible:=True;
          BitBtn6.Enabled:=True;
          BitBtn6.Caption:=BitBtn9.Caption;
          BitBtn6.SetFocus;
        End;
      End;
      Key:=0;
    end;
    
    procedure TForm1.YeniOyun1Click(Sender: TObject);
    begin
      Yeni;
      If Form1.BitBtn1.Visible=True Then Form1.BitBtn1.SetFocus
      Else Form1.BitBtn2.SetFocus;
    end;
    
    procedure TForm1.Hakknda1Click(Sender: TObject);
    begin
      Application.MessageBox('Halit Celepoğlu -- Ağustos 2005','Dokuz Taş Oyunu',64)
    end;
    
    procedure TForm1.k1Click(Sender: TObject);
    begin
      Halt;
    end;
    
    end.




  2. 2
    ahmet
    Üye

    --->: Delphi'de Zeka Oyunu

    Reklam



    nasıl yani bi şey anlamadım







  3. 3
    Darrt
    Üye
    kardeş bu &#231;ok zor bişe ya kullanma kulavuzu filan yokmuydu?







  4. 4
    BADMAN
    Usta Üye
    bende anlamadım vallahi bunadn birşeyler yardımcı olursan sevinirim :D

  5. 5
    EMO_BOY
    Yeni Üye
    Coooooxxx saq olun. Azerbaycan

+ Yorum Gönder
5 üzerinden | Toplam : 0 kişi