Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string stimw = "", stimb = "";

            c       = 0;
            replace = 1;
            game_main pppp = new game_main();

            if (passing_value.bdika == 1)
            {
                mat       = passing_value.newmat;
                playernum = passing_value.playernum;
            }
            if (putmat.check == 1)
            {
                mat         = putmat.pushmat;
                label7.Text = Form14.timw;
                stimw       = label7.Text;

                puttime(stimw, -1);
                label9.Text = Form14.timb;

                stimb = label9.Text;
                puttime(stimb, 1);
                label5.Text = Form14.step2p;

                getlossers(putmat.pushpace);
            }

            // wp.URL = pppp.imageurl("sound\\sound.mp3");
            // wp.controls.play();
            PictureBox[] picbox2 = { p00, p01, p02, p03, p04, p05, p06, p07, p10, p11, p12, p13, p14, p15, p16, p17, p20, p21, p22, p23, p24, p25, p26, p27, p30, p31, p32, p33, p34, p35, p36, p37, p40, p41, p42, p43, p44, p45, p46, p47, p50, p51, p52, p53, p54, p55, p56, p57, p60, p61, p62, p63, p64, p65, p66, p67, p70, p71, p72, p73, p74, p75, p76, p77 };
            picbox = picbox2;
            int p = 0;


            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    if (mat[i, j] != 0)
                    {
                        picbox2[p].ImageLocation = pppp.chessimage(mat[i, j]);
                        picbox2[p].SizeMode      = PictureBoxSizeMode.CenterImage;
                    }
                    else
                    {
                        picbox[p].Image = null;
                    }
                    picbox2[p].Visible = true;
                    p++;
                }
            }

            pppp.playerrole(playernum, picbox, mat);
        }
Example #2
0
        void gooo(int x, int y)
        {
            game_main.loss = 0;
            if (playernum == 1)
            {
                timer1.Start();
            }
            else
            {
                timer2.Start();
            }

            if (flage == true)
            {
                canx  = x;
                cany  = y;
                flage = false;
            }
            if (steps == 40)
            {
                for (int i = 0; i < 64; i++)
                {
                    picbox[i].Enabled = false;
                }
                MessageBox.Show("equality ");
                result = "drow";
                winer  = 3;
            }

            game_main      pppp = new game_main();
            computerplayer comp = new computerplayer();

            if (picbox[x * 10 + y - 2 * x].BackColor == Color.Green || picbox[x * 10 + y - 2 * x].BackColor == Color.Yellow)
            {
                pppp.IFgreenmovelastItem(lastclick, picbox, mat, x, y, pppp.chessimage(mat[lastclick.X, lastclick.Y]), kings, rooks, kingsplace);
                setlosser();
                if (game_main.loss > 0)
                {
                    lossb += game_main.loss + ",";
                }
                else if (game_main.loss != 0)
                {
                    lossw += game_main.loss + ",";
                }

                history(x, y, canx, cany);
                flage = true;

                pppp.refreshcolors(picbox, playernum, mat);
                if (Form2.justkings(mat) == true)
                {
                    steps++;
                }

                playernum = playernum * -1;

                pppp.playerrole(playernum, picbox, mat);
            }
            else
            {
                pppp.refreshcolors(picbox, playernum, mat);

                Wathitem(x, y);
            }
            if (playernum == 1)
            {
                timer1.Stop();
                timer2.Start();
            }
            else
            {
                timer2.Stop();
                timer1.Start();
            }


            int   x1 = kingsplace[0].X;
            int   y1 = kingsplace[0].Y;
            int   x2 = kingsplace[1].X;
            int   y2 = kingsplace[1].Y;
            Point kp = new Point(-1, -1);
            king  k1 = new king(new Point(x1, y1), mat, picbox, playernum, kings, rooks);
            king  k2 = new king(new Point(x2, y2), mat, picbox, playernum, kings, rooks);

            if (k1.toking(x1, y1, mat, picbox, 1) != new Point(-1, -1))
            {
                k1.redtoging(new Point(x1, y1), picbox, -1);
            }
            if (k2.toking(x2, y2, mat, picbox, -1) != new Point(-1, -1))
            {
                k2.redtoging(new Point(x2, y2), picbox, 1);
            }
            if (k1.toking(x1, y1, mat, picbox, 1) != new Point(-1, -1) && playernum == -1)
            {
                k1.shah(x1, y1, picbox, mat, -1);
            }
            if (k2.toking(x2, y2, mat, picbox, -1) != new Point(-1, -1) && playernum == 1)
            {
                k2.shah(x2, y2, picbox, mat, 1);
            }

            if (k1.deathofking(x1, y1, mat, picbox, kings, rooks, 1) == true)
            {
                if (k1.helping(1, mat, x1, y1, picbox, kings, rooks).IsEmpty() == true)
                {
                    timer1.Stop();
                    timer2.Stop();
                    k1.shahmeet("wihte lose!");
                    result = "1";
                    winer  = 1;
                }
            }



            if (k2.deathofking(x2, y2, mat, picbox, kings, rooks, -1) == true)
            {
                if (k2.helping(-1, mat, x2, y2, picbox, kings, rooks).IsEmpty() == true)
                {
                    timer1.Stop();
                    timer2.Stop();
                    k2.shahmeet("blcak lose!");
                    result = "-1";
                    winer  = -1;
                }
            }


            lastclick = new Point(x, y);
        }