public override void HamleHesapla(Tas[,] t)
        {
            if (SahKaleKontrol()) // Þah ve Kale daha önce hareket etmemiþse...
            {
                if (Renk == Renkler.Siyah && Yer.X == 4 && Yer.Y == 0)
                {
                    RokHesapla(t);
                }
                else if (Renk == Renkler.Beyaz && Yer.X == 4 && Yer.Y == 7)
                {
                    RokHesapla(t);
                }
            }

            // Vezir ile þah hareketleri benzerdir.
            // Þah, vezirin kýrpýlmýþ halidir :)
            Vezir tasVezir = new Vezir(new Point(Yer.X, Yer.Y), Taslar.Vezir, Renk);
            tasVezir.HamleHesapla(t);

            SahHareket(tasVezir, Yer.X - 1, Yer.Y); // Sola
            SahHareket(tasVezir, Yer.X + 1, Yer.Y); // Saða
            SahHareket(tasVezir, Yer.X - 1, Yer.Y + 1); // Sol Alt
            SahHareket(tasVezir, Yer.X - 1, Yer.Y - 1); // Sol Üst
            SahHareket(tasVezir, Yer.X, Yer.Y - 1); // Yukarý
            SahHareket(tasVezir, Yer.X, Yer.Y + 1); // Aþaðý
            SahHareket(tasVezir, Yer.X + 1, Yer.Y + 1); // Sað Alt
            SahHareket(tasVezir, Yer.X + 1, Yer.Y - 1); // Sað Üst
        }
        public static void TaslarOlustur(Tas[,] sTaslari)
        {
            int i;
            sTaslari[0, 0] = new Kale(new Point(0, 0), Taslar.Kale, Renkler.Siyah);
            sTaslari[1, 0] = new At(new Point(1, 0), Taslar.At, Renkler.Siyah);
            sTaslari[2, 0] = new Fil(new Point(2, 0), Taslar.Fil, Renkler.Siyah);
            sTaslari[3, 0] = new Vezir(new Point(3, 0), Taslar.Vezir, Renkler.Siyah);
            sTaslari[4, 0] = new Sah(new Point(4, 0), Taslar.Sah, Renkler.Siyah);
            sTaslari[5, 0] = new Fil(new Point(5, 0), Taslar.Fil, Renkler.Siyah);
            sTaslari[6, 0] = new At(new Point(6, 0), Taslar.At, Renkler.Siyah);
            sTaslari[7, 0] = new Kale(new Point(7, 0), Taslar.Kale, Renkler.Siyah);

            for (i = 0; i < 8; i++)
            {
                sTaslari[i, 1] = new Piyon(new Point(i, 1), Taslar.Piyon, Renkler.Siyah);
                sTaslari[i, 6] = new Piyon(new Point(i, 6), Taslar.Piyon, Renkler.Beyaz);
            }

            sTaslari[0, 7] = new Kale(new Point(0, 7), Taslar.Kale, Renkler.Beyaz);
            sTaslari[1, 7] = new At(new Point(1, 7), Taslar.At, Renkler.Beyaz);
            sTaslari[2, 7] = new Fil(new Point(2, 7), Taslar.Fil, Renkler.Beyaz);
            sTaslari[3, 7] = new Vezir(new Point(3, 7), Taslar.Vezir, Renkler.Beyaz);
            sTaslari[4, 7] = new Sah(new Point(4, 7), Taslar.Sah, Renkler.Beyaz);
            sTaslari[5, 7] = new Fil(new Point(5, 7), Taslar.Fil, Renkler.Beyaz);
            sTaslari[6, 7] = new At(new Point(6, 7), Taslar.At, Renkler.Beyaz);
            sTaslari[7, 7] = new Kale(new Point(7, 7), Taslar.Kale, Renkler.Beyaz);
        }
        private void LKontrol(Tas[,] t,int x, int fark)
        {
            if (Yer.Y + fark <= 7)
            {
                if (t[x, Yer.Y + fark] == null)
                {
                    Hamleler.Add(x); Hamleler.Add(Yer.Y + fark);
                }
                else
                {
                    DigerTasaHamle(t, x, Yer.Y + fark);
                }
            }

            if (Yer.Y - fark >= 0)
            {
                if (t[x, Yer.Y - fark] == null)
                {
                    Hamleler.Add(x); Hamleler.Add(Yer.Y - fark);
                }
                else
                {
                    DigerTasaHamle(t,x, Yer.Y - fark);
                }
            }
        }
        public static void Redo(oyunMotoru motor)
        {
            int   x1, y1, x2, y2;
            Point pKaynak      = (Point)redoNoktalar.Pop(); // x1, y1 alýndý
            Point pHedef       = (Point)redoNoktalar.Pop(); // x2, y2 alýndý
            Tas   tasinacakTas = (Tas)redoTaslar.Pop();
            Tas   yenilenTas   = (Tas)redoTaslar.Pop();

            x1 = pKaynak.X; y1 = pKaynak.Y;
            x2 = pHedef.X; y2 = pHedef.Y;

            SecilenTasIptal(motor);

            if (yenilenTas != null)
            {
                motor.satrancTaslari[x2, y2].Gizle(motor.g);
            }

            motor.satrancTaslari[x1, y1].Gizle(motor.g);
            motor.Tasi(x1, y1, x2, y2);
            motor.satrancTaslari[x2, y2].Goster(motor.g);

            RedoRok(motor);

            Hamle = (string)Log.redoHamle.Pop();
            Log.LogHamle(motor.hamleSayisi, motor.handleLView, motor.Sira, motor.satrancTaslari[x2, y2].tasTipi, x1, y1, x2, y2, Hamle);
            motor.hamleSayisi++;

            OyuncuDegistir(motor);

            undoNoktalar.Push(pKaynak);
            undoNoktalar.Push(pHedef);
            undoTaslar.Push(tasinacakTas);
            undoTaslar.Push(yenilenTas);
        }
        public static void Save(oyunMotoru motor, string dosyaYolu)
        {
            int          i, j;
            StreamWriter Yaz = new StreamWriter(dosyaYolu);

            try
            {
                for (i = 0; i < 8; i++)
                {
                    for (j = 0; j < 8; j++)
                    {
                        if (motor.satrancTaslari[i, j] != null)
                        {
                            Tas tas = motor.satrancTaslari[i, j];
                            Yaz.WriteLine(tas.Yer.X.ToString() + "" + tas.Yer.Y.ToString() + "" + (int)tas.Renk + "" + (int)tas.tasTipi);
                        }
                    }
                }

                for (i = 0; i < Log.lvHamleler.Items.Count; i++)
                {
                    Yaz.WriteLine(Log.lvHamleler.Items[i].Text + "," +
                                  Log.lvHamleler.Items[i].SubItems[1].Text + "," +
                                  Log.lvHamleler.Items[i].SubItems[2].Text);
                }
                Yaz.Close();
            }
            catch (IOException e)
            {
                MessageBox.Show("Oyun kaydedilemedi\n\n" + e.Source, "PikseLChess Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public virtual void HamleHesapla(Tas[,] taslar)
 {
     /* Bu fonksiyonu Tas sýnýfýný miras alan sýnýflarda tekrar tanýmlayýp(override) içini her taþ için 
     ayrý ayrý dolduracaðýz. Böylece tas nesnesi üzerinden tüm taþlarýn özelliklerinin yaný sýra
     bu metodada da "." notasyonu ile eriþmiþ olacaðýz. Kýsaca Polymorhism(çok biçimlilik) iþlemini gerçekleþtireceðiz.
     Yani her taþ için ayrý ayrý nesneler oluþturmak yerine Tas sýnýfýndan oluþturacaðýmýz nesne ile tüm sýnýflara
     eriþim saðlayacaðýz. */
 }
Exemple #7
0
        public bool matOldu()
        {
            int   i, j, k;
            int   x2, y2;
            Point sahYeri;
            Tas   temp = null;

            for (i = 0; i < 8; i++)
            {
                for (j = 0; j < 8; j++)
                {
                    if ((satrancTaslari[i, j] != null) && (satrancTaslari[i, j].Renk == Sira))
                    {
                        satrancTaslari[i, j].HamleHesapla(satrancTaslari);

                        for (k = 0; k < satrancTaslari[i, j].Hamleler.Count; k += 2)
                        {
                            x2 = (int)satrancTaslari[i, j].Hamleler[k];
                            y2 = (int)satrancTaslari[i, j].Hamleler[k + 1];

                            Tasi(i, j, x2, y2);
                            if (alinanTas != null) // Taþ alýnmýþsa sakla...
                            {
                                temp = alinanTas;
                            }

                            sahYeri = sahBul();
                            if (!sahCekildi(sahYeri)) // Hala þah çekiliyorsa...
                            {
                                // Taþý geri getir,
                                Tasi(x2, y2, i, j);
                                if (temp != null)
                                {
                                    satrancTaslari[x2, y2] = temp;
                                    temp = null;
                                }
                                satrancTaslari[i, j].Hamleler.Clear();
                                return(false); //Þahý koruyabildik veya þah kaçtý...
                            }
                            // Taþý geri getir,
                            Tasi(x2, y2, i, j);
                            if (temp != null)
                            {
                                satrancTaslari[x2, y2] = temp;
                                temp = null;
                            }
                        }

                        satrancTaslari[i, j].Hamleler.Clear();
                    }
                }
            }
            return(true); // Mat oldu...
        }
        public static void TaslarGoster(Tas[,] sTaslari, Graphics g)
        {
            int i, j;

            for (i = 0; i < 8; i++)
                for (j = 0; j < 8; j++)
                {
                    if (sTaslari[j, i] != null)
                        sTaslari[j, i].Goster(g);
                }
        }
        private void DigerTasaHamle(Tas[,] t, int x, int y)
        {
            if (Renk == Renkler.Siyah && t[x, y].Renk == Renkler.Beyaz) // siyah fil beyazý yesin
            {
                Hamleler.Add(x); Hamleler.Add(y);
            }

            if (Renk == Renkler.Beyaz && t[x, y].Renk == Renkler.Siyah) // beyaz fil siyahý yesin
            {
                Hamleler.Add(x); Hamleler.Add(y);
            }
        }
        private void DigerTasaHamle(Tas[,] t,int x,int y)
        {
            if (Renk == Renkler.Siyah && t[x, y].Renk == Renkler.Beyaz)
            {
                Hamleler.Add(x); Hamleler.Add(y);
            }

            if (Renk == Renkler.Beyaz && t[x, y].Renk == Renkler.Siyah)
            {
                Hamleler.Add(x); Hamleler.Add(y);
            }
        }
Exemple #11
0
        public void Tasi(int x1, int y1, int x2, int y2) // Hamle sonucunda dizideki taþýn hedefe taþýnmasý
        {
            if (satrancTaslari[x2, y2] != null)          // Alinan taþ varsa kaydet...
            {
                alinanTas = satrancTaslari[x2, y2];
            }
            else
            {
                alinanTas = null;
            }

            satrancTaslari[x2, y2] = satrancTaslari[x1, y1]; // Taþý hedefe kopyala...
            satrancTaslari[x1, y1] = null;                   // Taþý sil

            satrancTaslari[x2, y2].Yer.X = x2;               // Yer özelliðini güncelle
            satrancTaslari[x2, y2].Yer.Y = y2;
        }
 private void RokHesapla(Tas[,] t)
 {
     // Büyük Rok yap
     if (t[Yer.X - 4, Yer.Y] != null && t[Yer.X - 4, Yer.Y].tasTipi == Taslar.Kale)
     {
         if (t[Yer.X - 1, Yer.Y] == null && t[Yer.X - 2, Yer.Y] == null && t[Yer.X - 3, Yer.Y] == null)
         {
             Hamleler.Add(Yer.X - 2); Hamleler.Add(Yer.Y);
         }
     }
     // Küçük Rok yap
     if (t[Yer.X + 3, Yer.Y] != null && t[Yer.X + 3, Yer.Y].tasTipi == Taslar.Kale)
     {
         if (t[Yer.X + 1, Yer.Y] == null && t[Yer.X + 2, Yer.Y] == null)
         {
             Hamleler.Add(Yer.X + 2); Hamleler.Add(Yer.Y);
         }
     }
 }
 private void DigerTasaHamle(Tas[,] t, int x)
 {
     if (Renk == Renkler.Siyah)
     {
         if (t[x, Yer.Y + Yon] != null && t[x, Yer.Y + Yon].Renk == Renkler.Beyaz)
         {
             Hamleler.Add(x); Hamleler.Add(Yer.Y + Yon);
         }
     }
     if (Renk == Renkler.Beyaz)
     {
         if (t[x, Yer.Y + Yon] != null && t[x, Yer.Y + Yon].Renk == Renkler.Siyah)
         {
             if (t[x, Yer.Y + Yon].Renk == Renkler.Siyah)
             {
                 Hamleler.Add(x); Hamleler.Add(Yer.Y + Yon);
             }
         }
     }
 }
        public override void HamleHesapla(Tas[,] t)
        {
            if (Yer.X + 2 <= 7) // X'i kontrol ediyoruz
            {
                LKontrol(t, Yer.X + 2, 1); // Y yi de kontrol ediyoruz...
            }

            if (Yer.X + 1 <= 7)
            {
                LKontrol(t, Yer.X + 1, 2);
            }

            if (Yer.X - 2 >=0)
            {
                LKontrol(t, Yer.X - 2, 1);
            }

            if (Yer.X - 1 >= 0)
            {
                LKontrol(t, Yer.X - 1, 2);
            }
        }
        public override void HamleHesapla(Tas[,] t)
        {
            int i;

            // Vezirin bulunduðu yerde kale ve fil oluþturup hamleleri hesaplýyoruz
            Kale tasKale = new Kale(new Point(Yer.X, Yer.Y), Taslar.Kale, Renk); 
            Fil tasFil = new Fil(new Point(Yer.X,Yer.Y),Taslar.Fil, Renk);

            tasKale.HamleHesapla(t);
            tasFil.HamleHesapla(t);

            for (i = 0; i < tasFil.Hamleler.Count; i+=2)
            {
                Hamleler.Add(tasFil.Hamleler[i]); 
                Hamleler.Add(tasFil.Hamleler[i + 1]);
            }

            for (i = 0; i < tasKale.Hamleler.Count; i+=2)
            {
                Hamleler.Add(tasKale.Hamleler[i]); 
                Hamleler.Add(tasKale.Hamleler[i + 1]);
            }
        }
        public static void Undo(oyunMotoru motor) // Geri Al...
        {
            int x2, y2, x1, y1;

            Point pKaynak      = (Point)undoNoktalar.Pop(); // x2, y2 alýndý
            Point pHedef       = (Point)undoNoktalar.Pop(); // x1, y1 alýndý
            Tas   yenilenTas   = (Tas)undoTaslar.Pop();
            Tas   tasinacakTas = (Tas)undoTaslar.Pop();

            x2 = pKaynak.X; y2 = pKaynak.Y;
            x1 = pHedef.X; y1 = pHedef.Y;

            OyuncuDegistir(motor);

            SecilenTasIptal(motor);

            UndoRok(motor);

            motor.satrancTaslari[x2, y2].Gizle(motor.g);
            motor.Tasi(x2, y2, x1, y1);
            motor.satrancTaslari[x1, y1].Goster(motor.g);

            if (yenilenTas != null) // Yenilen taþ varsa
            {
                motor.satrancTaslari[x2, y2] = yenilenTas;
                motor.satrancTaslari[x2, y2].Goster(motor.g);
            }

            motor.hamleSayisi--;
            Log.SilHamle(motor.hamleSayisi);

            // Undo'nun kaynaðý Redo'nun hedefi olur...
            redoNoktalar.Push(pKaynak); // x2,y2 bas
            redoNoktalar.Push(pHedef);  // x1,y1 bas
            redoTaslar.Push(yenilenTas);
            redoTaslar.Push(tasinacakTas);
        }
        public override void HamleHesapla(Tas[,] t)
        {
            bool ilkHamle = false;

            if (Renk == Renkler.Beyaz)
                Yon = -1;
            else
                Yon = 1;

            // piyonlar baþlangýç durumunda ise...
            if ((Yer.Y == 6 && Renk == Renkler.Beyaz) || (Yer.Y == 1 && Renk == Renkler.Siyah))
                ilkHamle = true;

            // Piyonun önünde boþ alan varsa...
            if (t[Yer.X, Yer.Y + Yon] == null)
            {
                Hamleler.Add(Yer.X); Hamleler.Add(Yer.Y + Yon);
            }

            // Piyonun ilk hamlesi ise ve önündeki iki alanda boþ ise...
            if (ilkHamle && t[Yer.X, Yer.Y + Yon] == null && t[Yer.X, Yer.Y + (2 * Yon)] == null)
            {
                Hamleler.Add(Yer.X); Hamleler.Add(Yer.Y + 2 * Yon);
            }

            // En saðdaki piyona týklandýðýnda saða hamle yolu göstermesini engelle...
            if (Yer.X + 1 < 8)
            {
                DigerTasaHamle(t, Yer.X + 1);
            }

            // En soldaki piyona týklandýðýnda sola hamle yolu gösterme
            if (Yer.X - 1 >= 0)
            {
                DigerTasaHamle(t, Yer.X - 1);
            }
        }
 public static void TasOlustur(Tas[,] sTaslari, int x, int y, Renkler renk, Taslar tip)
 {
     switch (tip)
     {
         case Taslar.Piyon :
             sTaslari[x, y] = new Piyon(new Point(x, y), Taslar.Piyon, renk);
             break;
         case Taslar.Kale :
             sTaslari[x, y] = new Kale(new Point(x, y), Taslar.Kale, renk);
             break;
         case Taslar.At :
             sTaslari[x, y] = new At(new Point(x, y), Taslar.At, renk);
             break;
         case Taslar.Fil :
             sTaslari[x, y] = new Fil(new Point(x, y), Taslar.Fil, renk);
             break;
         case Taslar.Sah :
             sTaslari[x, y] = new Sah(new Point(x, y), Taslar.Sah, renk);
             break;
         case Taslar.Vezir :
             sTaslari[x, y] = new Vezir(new Point(x, y), Taslar.Vezir, renk);
             break;
     } 
 }
        public void Tasi(int x1, int y1, int x2, int y2) // Hamle sonucunda dizideki taþýn hedefe taþýnmasý
        {
            if (satrancTaslari[x2, y2] != null) // Alinan taþ varsa kaydet...
            {
                alinanTas = satrancTaslari[x2, y2]; 
            }
            else
            {
                alinanTas = null;
            }

            satrancTaslari[x2, y2] = satrancTaslari[x1, y1]; // Taþý hedefe kopyala...
            satrancTaslari[x1, y1] = null;  // Taþý sil

            satrancTaslari[x2, y2].Yer.X = x2; // Yer özelliðini güncelle
            satrancTaslari[x2, y2].Yer.Y = y2;
        } 
        public override void HamleHesapla(Tas[,] t)
        {
            int i;

            if (Yer.X > 0) // Sola
            {
                for (i = Yer.X - 1; i >= 0; i--)
                {
                    if (t[i, Yer.Y] == null)
                    {
                        Hamleler.Add(i); Hamleler.Add(Yer.Y);
                    }
                    else
                    {
                        DigerTasaHamle(t, i, Yer.Y);
                        break;
                    }
                }
            }

            if (Yer.X < 7) // Saða
            {
                for (i = Yer.X + 1; i < 8; i++)
                {
                    if (t[i, Yer.Y] == null)
                    {
                        Hamleler.Add(i); Hamleler.Add(Yer.Y);
                    }
                    else
                    {
                        DigerTasaHamle(t, i, Yer.Y);
                        break;
                    }
                }
            }

            if (Yer.Y < 7) // Aþaðý
            {
                for (i = Yer.Y + 1; i < 8; i++)
                {
                    if (t[Yer.X, i] == null)
                    {
                        Hamleler.Add(Yer.X); Hamleler.Add(i);
                    }
                    else
                    {
                        DigerTasaHamle(t, Yer.X, i);
                        break;
                    }
                }
            }

            if (Yer.Y > 0)// Yukarý
            {
                for (i = Yer.Y - 1; i >= 0; i--)
                {
                    if (t[Yer.X, i] == null)
                    {
                        Hamleler.Add(Yer.X); Hamleler.Add(i);
                    }
                    else
                    {
                        DigerTasaHamle(t, Yer.X, i);
                        break;
                    }
                }
            }
        }
        public override void HamleHesapla(Tas[,] t)
        {
            int i;

            if(Yer.X < 7 && Yer.Y < 7) // Sað alt çapraz
            {
                for (i = Yer.X + 1; i < 8 && (Yer.Y + i - Yer.X) < 8; i++) // Yolu kontrol et
                {
                    if (t[i, Yer.Y + i - Yer.X] == null)
                    {
                        Hamleler.Add(i); Hamleler.Add(Yer.Y + i - Yer.X);
                    }
                    else
                    {
                        DigerTasaHamle(t, i, Yer.Y + i - Yer.X);
                        break;
                    }
                }
            }

            if (Yer.X < 7 && Yer.Y > 0) // Sað üst çapraza oynansýn.. 
            {
                for (i = Yer.X + 1; i < 8 && (Yer.Y + Yer.X - i) >= 0 ; i++) // Yolu kontrol et
                {
                    if (t[i, Yer.Y + Yer.X - i] == null)
                    {
                        Hamleler.Add(i); Hamleler.Add(Yer.Y + Yer.X - i);
                    }
                    else
                    {
                        DigerTasaHamle(t, i, Yer.Y + Yer.X - i);
                        break;
                    }
                }
            }

            if (Yer.X > 0 && Yer.Y < 7) // Sol alt çapraza oynansýn..
            {
                for (i = Yer.X - 1; i >= 0 && (Yer.Y + Yer.X - i) < 8; i--) // Yolu kontrol et
                {
                    if (t[i, Yer.Y + Yer.X - i] == null)
                    {
                        Hamleler.Add(i); Hamleler.Add(Yer.Y + Yer.X - i);
                    }
                    else
                    {
                        DigerTasaHamle(t, i, Yer.Y + Yer.X - i);
                        break;
                    }
                }
            }

            if (Yer.X > 0 && Yer.Y > 0) // Sol üst çapraza oynansýn..
            {
                for (i = Yer.X - 1; i >= 0 && (Yer.Y + i - Yer.X) >= 0; i--) // Yolu kontrol et
                {
                    if (t[i, Yer.Y + i - Yer.X] == null)
                    {
                        Hamleler.Add(i); Hamleler.Add(Yer.Y + i - Yer.X);
                    }
                    else
                    {
                        DigerTasaHamle(t, i, Yer.Y + i - Yer.X);
                        break;
                    }
                }
            }
        }
Exemple #22
0
        public void HamleYap(int x1, int y1, int x2, int y2)
        {
            Point sahYeri;
            Tas   temp = null;

            satrancTaslari[x1, y1].YolGizle(g);
            satrancTaslari[x1, y1].Gizle(g); // Taþý Sil.

            Tasi(x1, y1, x2, y2);            // Taþý götür...

            sahYeri = sahBul();              // Oyuncunun þahýnýn yerini bul...
            if (sahCekildi(sahYeri))         // Diðer taþlar tarafýndan þah çekliliyor mu?
            {
                if (alinanTas != null)       // Taþ alýnmýþsa sakla (Tasi metodunda)
                {
                    temp = alinanTas;
                }

                Tasi(x2, y2, x1, y1);             // Mat olacak, taþý eski yerine getir...
                satrancTaslari[x1, y1].Goster(g); // Taþý Göster
                satrancTaslari[x1, y1].Hamleler.Clear();

                if (temp != null)     // Alýnan taþý da yerine koy
                {
                    satrancTaslari[x2, y2] = temp;
                    satrancTaslari[x2, y2].Goster(g);
                    temp = null;
                }

                oyunAlani.TaslarGoster(satrancTaslari, g); // Refresh
                Secim = false;                             // Oyuncu deðiþmeden yeni hamle yapýlsýn
                return;
            }

            // Piyon'un Vezir'e dönüþmesi
            if (satrancTaslari[x2, y2].tasTipi == Taslar.Piyon)
            {
                if (Oyuncu == Renkler.Beyaz && satrancTaslari[x2, y2].Yer.Y == 0)
                {
                    satrancTaslari[x2, y2] = new Vezir(new Point(x2, y2), Taslar.Vezir, Renkler.Beyaz);
                }
                else if (Oyuncu == Renkler.Beyaz && satrancTaslari[x2, y2].Yer.Y == 7)
                {
                    satrancTaslari[x2, y2] = new Vezir(new Point(x2, y2), Taslar.Vezir, Renkler.Siyah);
                }
            }

            // Undo'dan sonra kullanýcý hamle yaparsa redo dan hamle çýkar
            if (UndoRedo.redoNoktalar.Count > 0)
            {
                UndoRedo.redoNoktalar.Pop();
                UndoRedo.redoNoktalar.Pop();
                UndoRedo.redoTaslar.Pop();
                UndoRedo.redoTaslar.Pop();
            }

            UndoRedo.undoNoktalar.Push(new Point(x1, y1));
            UndoRedo.undoNoktalar.Push(new Point(x2, y2));
            UndoRedo.undoTaslar.Push(satrancTaslari[x2, y2]);

            if (alinanTas != null) // Alýnan taþ varsa yýðýna at
            {
                UndoRedo.undoTaslar.Push(alinanTas);
                alinanTas.Gizle(g);
            }
            else
            {
                UndoRedo.undoTaslar.Push(null); // Alýnan taþ yoksa null bas
            }

            satrancTaslari[x2, y2].Goster(g);          // Taþý Göster
            satrancTaslari[x2, y2].Hamleler.Clear();
            oyunAlani.TaslarGoster(satrancTaslari, g); // Refresh..

            if (Sira == Renkler.Beyaz)                 // Oyuncuyu deðiþtir
            {
                Sira = Renkler.Siyah;
            }
            else
            {
                Sira = Renkler.Beyaz;
            }

            /*Þah-Mat Kontrolü...
             * Sýra diðer oyuncuya geçti ama daha önce Diðer Oyuncunun þahýnýn yerini bul...*/
            sahYeri = sahBul();
            if (sahCekildi(sahYeri)) // Yapýlan hamle sonucunda Diðer oyuncuya þah çekildi mi?
            {
                if (matOldu())       // Þah çekildiyse mat oldu mu?
                {
                    Log.LogHamle(hamleSayisi, handleLView, Oyuncu, satrancTaslari[x2, y2].tasTipi, x1, y1, x2, y2, "Mat");
                    MessageBox.Show(Sira.ToString() + " Mat oldu. Oyunu " + Oyuncu.ToString() + " kazandý", "Oyun Bitti", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    hamleSayisi++;
                    return;
                }
                else
                {
                    Log.LogHamle(hamleSayisi, handleLView, Oyuncu, satrancTaslari[x2, y2].tasTipi, x1, y1, x2, y2, "Þah");
                    hamleSayisi++;
                    return;
                }
            }

            if (satrancTaslari[x2, y2].tasTipi == Taslar.Sah) // Þah taþýndýysa Rok Yaptý Mý?
            {
                if (x2 == x1 - 2)
                {
                    Rok(x2, y2, "bRok");
                    Log.LogHamle(hamleSayisi, handleLView, Oyuncu, satrancTaslari[x2, y2].tasTipi, x1, y1, x2, y2, "bRok");
                    hamleSayisi++;
                    return;
                }
                else if (x2 == x1 + 2)
                {
                    Rok(x2, y2, "kRok");
                    Log.LogHamle(hamleSayisi, handleLView, Oyuncu, satrancTaslari[x2, y2].tasTipi, x1, y1, x2, y2, "kRok");
                    hamleSayisi++;
                    return;
                }
            }

            Log.LogHamle(hamleSayisi, handleLView, Oyuncu, satrancTaslari[x2, y2].tasTipi, x1, y1, x2, y2, ""); // Normal Hamle
            hamleSayisi++;
        }
        public void YolGoster(Tas[,] taslar, Graphics g)
        {                      
            int i;
            SolidBrush fircaYesil = new SolidBrush(Color.FromArgb(127, Color.Green));
            SolidBrush fircaKirmizi = new SolidBrush(Color.FromArgb(127, Color.Red));

            for (i = 0; i < Hamleler.Count; i += 2)
            {
                Rectangle Kare = new Rectangle((int)Hamleler[i] * kareEnBoy, (int)Hamleler[i + 1] * kareEnBoy, kareEnBoy, kareEnBoy);

                if (taslar[(int)Hamleler[i], (int)Hamleler[i + 1]] == null)
                {
                    g.DrawImage(yolYesil, Kare);
                    //g.FillRectangle(fircaYesil, Kare);
                }
                else
                {
                    g.DrawImage(yolKirmizi, Kare);
                    //g.FillRectangle(fircaKirmizi, Kare);
                }
            }
        }