Exemple #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (ortadakiKartlar.Count > 0)
            {
                ortadakiSonKart = ortadakiKartlar[ortadakiKartlar.Count - 1];
                label1.Text     = ortadakiSonKart.cinsi + " " + ortadakiSonKart.numarasi;
            }
            else
            {
                ortadakiSonKart = null;
                label1.Text     = "-";
            }

            bilgiOrta.Text = "ortadaki kart sayısı: " + ortadakiKartlar.Count.ToString();
            label4.Text    = "toplam kart sayısı: " + oyundakiKartlar.Count.ToString();

            if (oyuncu1)
            {
                button1.Enabled = true;
                button2.Enabled = false;
            }

            else
            {
                button1.Enabled = false;
                button2.Enabled = true;
            }
            if (log.Items.Count > 0)
            {
                log.SetSelected(log.Items.Count - 1, true);
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            KART b = new KART();

            b.cinsi    = listBox1.Items[listBox1.SelectedIndex].ToString().Split(' ')[0];
            b.numarasi = listBox1.Items[listBox1.SelectedIndex].ToString().Split(' ')[1];

            ortadakiKartlar.Add(b);



            listBox1.Items.Remove(listBox1.Text);
            log.Items.Add(isim + " " + b.cinsi + " " + b.numarasi + " attı");

            // oyuncu1Kartlar.Remove(v);
            if (ortadakiKartlar.Count > 0 && ortadakiSonKart != null)
            {
                if ((b.numarasi == ortadakiSonKart.numarasi || b.numarasi == "J"))
                {
                    puanla("oyuncu1");
                }
            }
            if (listBox1.Items.Count == 0 && listBox2.Items.Count == 0)
            {
                kartlariDagit();
            }
            oyuncu1 = false;
            //otomatikOyna();
            rakipOyuncu.Enabled = true;
            //label1.Text =
            //MessageBox.Show(oyundakiKartlar.Count.ToString());
        }
Exemple #3
0
        public void kartlariDagit()
        {
            if (oyundakiKartlar.Count > 0)
            {
                log.Items.Add("kartlar dağıtıldı");
                // log.SetSelected(log.Items, true);
                for (int i = 0; i < 4; i++)
                {
                    int  sayi = r.Next(0, oyundakiKartlar.Count);
                    KART a    = oyundakiKartlar[sayi];
                    oyundakiKartlar.Remove(a);
                    listBox1.Items.Add(a.cinsi + " " + a.numarasi);
                    oyuncu1Kartlar.Add(a);
                }

                for (int i = 0; i < 4; i++)
                {
                    int  sayi = r.Next(0, oyundakiKartlar.Count);
                    KART a    = oyundakiKartlar[sayi];
                    oyundakiKartlar.Remove(a);
                    listBox2.Items.Add(a.cinsi + " " + a.numarasi);
                    oyuncu2Kartlar.Add(a);
                }
            }
            else
            {
                log.Items.Add("OYUN BİTTİ");
            }
        }
Exemple #4
0
 public void ortayaEkle()
 {
     for (int i = 0; i < 4; i++)
     {
         int  sayi = r.Next(0, oyundakiKartlar.Count);
         KART a    = oyundakiKartlar[sayi];
         oyundakiKartlar.Remove(a);
         ortadakiKartlar.Add(a);
     }
 }
Exemple #5
0
        // int beklemeSuresi=3;
        private void rakipOyuncu_Tick(object sender, EventArgs e)
        {
            KART a       = new KART();
            int  rasgele = 10;

            if (zorluk == "kolay")
            {
                rasgele = r.Next(0, listBox2.Items.Count);
            }
            else if (zorluk == "zor")
            {
                //MessageBox.Show("sss");
                foreach (var item in listBox2.Items)
                {
                    if (ortadakiKartlar.Count > 0)
                    {
                        if (item.ToString().Split(' ')[1] == ortadakiSonKart.numarasi)
                        {
                            // MessageBox.Show("aynsı var " + listBox2.Items.IndexOf(item).ToString());
                            rasgele = listBox2.Items.IndexOf(item);
                            break;
                        }
                        else
                        {
                            rasgele = r.Next(0, listBox2.Items.Count);
                        }
                    }
                    else
                    {
                        rasgele = r.Next(0, listBox2.Items.Count);
                    }
                }
                if (rasgele == 10)
                {
                    rasgele = r.Next(0, listBox2.Items.Count);
                }
            }
            a.cinsi    = listBox2.Items[rasgele].ToString().Split(' ')[0];
            a.numarasi = listBox2.Items[rasgele].ToString().Split(' ')[1];

            ortadakiKartlar.Add(a);
            // oyuncu2Kartlar.Remove(a);
            listBox2.Items.Remove(listBox2.Items[rasgele]);
            log.Items.Add("rakibiniz " + a.cinsi + a.numarasi + " attı");
            if (ortadakiSonKart != null && a.numarasi == ortadakiSonKart.numarasi || a.numarasi == "J")
            {
                puanla("oyuncu2");
            }
            if (listBox1.Items.Count == 0 && listBox2.Items.Count == 0)
            {
                kartlariDagit();
            }
            oyuncu1             = true;
            rakipOyuncu.Enabled = false;
        }
Exemple #6
0
        public void kartlariOlustur()
        {
            for (int i = 1; i <= 13; i++)
            {
                for (int j = 1; j <= 4; j++)
                {
                    KART a = new KART();
                    if (i == 1 || i > 10)
                    {
                        if (i == 1)
                        {
                            a.numarasi = "A";
                        }
                        if (i == 11)
                        {
                            a.numarasi = "J";
                        }
                        if (i == 12)
                        {
                            a.numarasi = "Q";
                        }
                        if (i == 13)
                        {
                            a.numarasi = "K";
                        }
                    }
                    else
                    {
                        a.numarasi = i.ToString();
                    }
                    if (j == 1)
                    {
                        a.cinsi = "maca";
                    }
                    if (j == 2)
                    {
                        a.cinsi = "kare";
                    }
                    if (j == 3)
                    {
                        a.cinsi = "kupa";
                    }
                    if (j == 4)
                    {
                        a.cinsi = "sinek";
                    }

                    //a.id = id;
                    //id++;
                    oyundakiKartlar.Add(a);
                }
            }
        }
Exemple #7
0
        void otomatikOyna()
        {
            KART a       = new KART();
            int  rasgele = 10;

            if (zorluk == "kolay")
            {
                rasgele = r.Next(0, listBox2.Items.Count);
            }
            else if (zorluk == "zor")
            {
                MessageBox.Show("sss");
                foreach (var item in listBox2.Items)
                {
                    if (item.ToString().Split(' ')[1] == ortadakiSonKart.numarasi)
                    {
                        MessageBox.Show("aynsı var " + listBox2.Items.IndexOf(item).ToString());
                        rasgele = listBox2.Items.IndexOf(item);
                        break;
                    }
                }
                if (rasgele == 10)
                {
                    rasgele = r.Next(0, listBox2.Items.Count);
                }

                // rasgele = 1;
            }
            a.cinsi    = listBox2.Items[rasgele].ToString().Split(' ')[0];
            a.numarasi = listBox2.Items[rasgele].ToString().Split(' ')[1];

            ortadakiKartlar.Add(a);
            // oyuncu2Kartlar.Remove(a);
            listBox2.Items.Remove(listBox2.Items[rasgele]);
            if (ortadakiSonKart != null && a.numarasi == ortadakiSonKart.numarasi || a.numarasi == "J")
            {
                puanla("oyuncu2");
            }
            if (listBox1.Items.Count == 0 && listBox2.Items.Count == 0)
            {
                kartlariDagit();
            }
            oyuncu1 = true;
        }