// Poker Kagit Dagitma | Ali AKYILDIRIM | www.aliakyildirim.com
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
// Poker Kagit Dagitma | Ali AKYILDIRIM | www.aliakyildirim.com
namespace PokerOyna
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        // Poker Kagit Dagitma | Ali AKYILDIRIM | www.aliakyildirim.com
        string yazi = " POKER KAGIT DAGITMA - (Design: Ali AKYILDIRIM) ";
        string[] KartTur = new string[] { "Maça", "Karo", "Sinek", "Kupa" };
        string[] KartNo = new string[] { "As", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Vale", "Kiz", "Papaz" };
        private void button1_Click(object sender, EventArgs e)
        {
            if (listBox1.Items.Count > 4 && listBox2.Items.Count > 4 && listBox3.Items.Count > 4 && listBox4.Items.Count > 4)
            {
                listBox1.Items.Clear();
                listBox2.Items.Clear();
                listBox3.Items.Clear();
                listBox4.Items.Clear();
            }
            string[] Kartlar = new string[52];
            bool[] kartdurum = new bool[52];
            for (int i = 0; i 
            {
                for (int x = 0; x 
                {
                    Kartlar[i * 13 + x] = KartTur[i] + " - " + KartNo[x];
                }
            }
            Random rnd = new Random();
            for (int p = 0; p 
            {
                int index1 = rnd.Next(0, Kartlar.Length);
                if (kartdurum[index1] == true)
                {
                    while (true)
                    {
                        index1 = rnd.Next(0, Kartlar.Length);
                        if (kartdurum[index1] == false)
                            break;
                    }
                }
                kartdurum[index1] = true;
                int index2 = rnd.Next(0, Kartlar.Length);
                if (kartdurum[index2] == true)
                {
                    while (true)
                    {
                        index2 = rnd.Next(0, Kartlar.Length);
                        if (kartdurum[index2] == false)
                            break;
                    }
                }
                kartdurum[index2] = true;
                int index3 = rnd.Next(0, Kartlar.Length);
                if (kartdurum[index3] == true)
                {
                    while (true)
                    {
                        index3 = rnd.Next(0, Kartlar.Length);
                        if (kartdurum[index3] == false)
                            break;
                    }
                }
                kartdurum[index3] = true;
                int index4 = rnd.Next(0, Kartlar.Length);
                if (kartdurum[index4] == true)
                {
                    while (true)
                    {
                        index4 = rnd.Next(0, Kartlar.Length);
                        if (kartdurum[index4] == false)
                            break;
                    }
                }
                kartdurum[index4] = true;
                listBox1.Items.Add(Kartlar[index1].ToString());
                listBox2.Items.Add(Kartlar[index2].ToString());
                listBox3.Items.Add(Kartlar[index3].ToString());
                listBox4.Items.Add(Kartlar[index4].ToString());
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Start();
            this.Text = yazi;
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            string ilkharf = yazi.Substring(0, 1);
            yazi = yazi.Remove(0, 1);
            yazi += ilkharf;
            this.Text = yazi;
        }
    }
}
// Poker Kagit Dagitma | Ali AKYILDIRIM | www.aliakyildirim.com