checkers game

Apr 20 2015 1:17 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace Checkers_Game_Play
{
    public partial class CheckersBoard : Form
    {

        //your color 
        // 0 is red
        int yourcolor = 0;
        //draw your buttons
        int drawmy1 = 49;
        int drawmy2 = 58;
        int drawmy3 = 42;
        //draw enemy buttons
        int drawenemy1 = 1;
        int drawenemy2 = 10;
        int drawenemy3 = 17;
        //music and sound
        int playmusic = 1;
        //Dim playsound As Integer = 1
        //current hightlight
        int currenthightlight;
        //current selected button
        int currentselectedbutton;
        bool selectedbutton = false;
        //count clicks
        int countclicks = 0;
        //get empty places up the selected button
        int getemptyplaces1;

        int getemptyplaces2;
        //get 2 first selecte - get pair to compare
        int getpair;
        int fn;

        int sn;
        //test 
        bool fromleft;
        bool fromright;
        //time
        int counttime;
        int min;
        bool showmin;
        //test
        int getenemy;
        // Dim enemyloc As Integer = 100


        int enemytomove;

        bool callcommove;

        int morebuttons = 0;
        //drag
        bool drag;
        int mousex;

        int mousey;


        //KING TEST

        int firstselectedking;


        int enemykinglocation;
        //end game timer
        int endgamecomputer;

        int endgamehuman;

        public CheckersBoard()
        {
            InitializeComponent();
        }

        private void buttonExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CheckersBoard_KeyDown(object sender, KeyEventArgs e)
        {
            //exit
            if (e.KeyCode == Keys.Escape)
            {
                this.Close();

            }
        }

        private void CheckersBoard_Load(object sender, EventArgs e)
        {
            ControlForm objControlForm = new ControlForm();
            //get selected buttons
            if (objControlForm.RadioButton2.Checked == true)
            {
                yourcolor = 1;
            }
            else
            {
                yourcolor = 0;
            }

            //get the selected board
            //load red buttons on bottom

            if (yourcolor == 0)
            {
                foreach (object P in Panel1.Controls)
                {
                    if (P is PictureBox)

                        //load red buttons on bottom

                        if (yourcolor == 0)
                        {

                            foreach (object p in Panel1.Controls)
                            {

                                if (p is PictureBox)
                                {
                                }
                                //TEST
                                //------------------------------
                                if (morebuttons == 1)
                                {
                                    for (drawmy3 = 42; drawmy3 <= 48; drawmy3 += 2)
                                    {
                                        if (p.Name == "Pic" + drawmy3.ToString)
                                        {
                                            P.SizeMode = PictureBoxSizeMode.Zoom;
                                            P.Image = ImageList1.Images.Item(0);
                                            P.Tag = "my";


                                        }
                                    }


                                }

                                //-------------------------------



                                for (drawmy1 = 49; drawmy1 <= 56; drawmy1 += 2)
                                {
                                    if (p.Name == "Pic" + drawmy1.ToString)
                                    {
                                        p.SizeMode = PictureBoxSizeMode.Zoom;
                                        p.Image = ImageList1.Images.Item(0);
                                        p.Tag = "my";


                                    }

                                }

                            }
                            
}
//second raw
for (drawmy2 = 58; drawmy2 <= 64; drawmy2 += 2) {
if (p.Name == "Pic" + drawmy2.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(0);
p.Tag = "my";

}




}

}

//TEST
//------------------------------
if (morebuttons == 1) {
for (drawenemy3 = 17; drawenemy3 <= 24; drawenemy3 += 2) {
if (p.Name == "Pic" + drawenemy3.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "enemy";

}
}



}

//-------------------------------

//draw enemy buttons
for (drawenemy1 = 1; drawenemy1 <= 8; drawenemy1 += 2) {
if (p.Name == "Pic" + drawenemy1.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "enemy";

}
//second raw
for (drawenemy2 = 10; drawenemy2 <= 16; drawenemy2 += 2) {
if (p.Name == "Pic" +drawenemy2.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "enemy";
}


}
}

}

}



} else {
//load blue buttons on bottom

foreach (object p in Panel1.Controls) {

if (p is PictureBox) {
//TEST
//------------------------------
if (morebuttons == 1) {
for (drawmy3 = 42; drawmy3 <= 48; drawmy3 += 2) {
if (p.Name == "Pic" + drawmy3.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "my";


}
}


}

//-------------------------------


for (drawmy1 = 49; drawmy1 <= 56; drawmy1 += 2) {
if (p.Name == "Pic" + drawmy1.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "my";

}
//second raw
for (drawmy2 = 58; drawmy2 <= 64; drawmy2 += 2) {
if (p.Name == "Pic" + drawmy2.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "my";
}


}
}

//draw enemy buttons
//TEST
//------------------------------
if (morebuttons == 1) {
for (drawenemy3 = 17; drawenemy3 <= 24; drawenemy3 += 2) {
if (p.Name == "Pic" + drawenemy3.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(0);
p.Tag = "enemy";

}
}



}

//-------------------------------

for (drawenemy1 = 1; drawenemy1 <= 8; drawenemy1 += 2) {
if (p.Name == "Pic" + drawenemy1.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(0);
p.Tag = "enemy";

}
//second raw
for (drawenemy2 = 10; drawenemy2 <= 16; drawenemy2 += 2) {
if (p.Name == "Pic" + drawenemy2.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(0);
p.Tag = "enemy";

}


}
}





//picturebox loop here

}


}

//set tags to picturebiexe








}
}

public void checkmyking()
{
if (yourcolor == 0) {
if (Pic1.Tag == "my") {
Pic1.Image = My.Resources.redking1;
Pic1.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic3.Tag == "my") {
Pic3.Image = My.Resources.redking1;
Pic3.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic5.Tag == "my") {
Pic5.Image = My.Resources.redking1;
Pic5.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic7.Tag == "my") {
Pic7.Image = My.Resources.redking1;
Pic7.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
}
} else if (yourcolor == 1) {
if (Pic1.Tag == "my") {
Pic1.Image = My.Resources.blueking1;
Pic1.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic3.Tag == "my") {
Pic3.Image = My.Resources.blueking1;
Pic3.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic5.Tag == "my") {
Pic5.Image = My.Resources.blueking1;
Pic5.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic7.Tag == "my") {
Pic7.Image = My.Resources.blueking1;
Pic7.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
}
}


}

public void checkenemyking()
{
//problem with piz7
if (Pic7.Image == null) {
Pic7.Tag = "";
// resolve the tag of pic7
}




//' my color red enemy blue 
if (yourcolor == 0) {
if (Pic58.Tag == "enemy") {
Pic58.Image = My.Resources.blueking1;
Pic58.Tag = "enemyking";
} else if (Pic60.Tag == "enemy") {
Pic60.Image = My.Resources.blueking1;
Pic60.Tag = "enemyking";
} else if (Pic62.Tag == "enemy") {
Pic62.Image = My.Resources.blueking1;
Pic62.Tag = "enemyking";
} else if (Pic64.Tag == "enemy") {
Pic64.Image = My.Resources.blueking1;
Pic64.Tag = "enemyking";
}
} else if (yourcolor == 1) {
if (Pic58.Tag == "enemy") {
Pic58.Image = My.Resources.redking1;
Pic58.Tag = "enemyking";
} else if (Pic60.Tag == "enemy") {
Pic60.Image = My.Resources.redking1;
Pic60.Tag = "enemyking";
} else if (Pic62.Tag == "enemy") {
Pic62.Image = My.Resources.redking1;
Pic62.Tag = "enemyking";
} else if (Pic64.Tag == "enemy") {
Pic64.Image = My.Resources.redking1;
Pic64.Tag = "enemyking";
}
}
}



public void hightlight()
{
//test with countclicks
//  If countclicks = 2 Then



if (currenthightlight == 1) {
Pic1.BackColor = Color.LightCyan;
} else if (currenthightlight == 2) {
Pic2.BackColor = Color.LightCyan;
} else if (currenthightlight == 3) {
Pic3.BackColor = Color.LightCyan;
} else if (currenthightlight == 4) {
Pic4.BackColor = Color.LightCyan;
} else if (currenthightlight == 5) {
Pic5.BackColor = Color.LightCyan;
} else if (currenthightlight == 6) {
Pic6.BackColor = Color.LightCyan;
} else if (currenthightlight == 7) {
Pic7.BackColor = Color.LightCyan;
} else if (currenthightlight == 8) {
Pic8.BackColor = Color.LightCyan;

} else if (currenthightlight == 9) {
Pic9.BackColor = Color.LightCyan;
} else if (currenthightlight == 10) {
Pic10.BackColor = Color.LightCyan;
} else if (currenthightlight == 11) {
Pic11.BackColor = Color.LightCyan;
} else if (currenthightlight == 12) {
Pic12.BackColor = Color.LightCyan;
} else if (currenthightlight == 13) {
Pic13.BackColor = Color.LightCyan;
} else if (currenthightlight == 14) {
Pic14.BackColor = Color.LightCyan;
} else if (currenthightlight == 15) {
Pic15.BackColor = Color.LightCyan;

} else if (currenthightlight == 16) {
Pic16.BackColor = Color.LightCyan;
} else if (currenthightlight == 17) {
Pic17.BackColor = Color.LightCyan;
} else if (currenthightlight == 18) {
Pic18.BackColor = Color.LightCyan;
} else if (currenthightlight == 19) {
Pic19.BackColor = Color.LightCyan;
} else if (currenthightlight == 20) {
Pic20.BackColor = Color.LightCyan;
} else if (currenthightlight == 21) {
Pic21.BackColor = Color.LightCyan;
} else if (currenthightlight == 22) {
Pic22.BackColor = Color.LightCyan;

} else if (currenthightlight == 23) {
Pic23.BackColor = Color.LightCyan;
} else if (currenthightlight == 24) {
Pic24.BackColor = Color.LightCyan;
} else if (currenthightlight == 25) {
Pic25.BackColor = Color.LightCyan;
} else if (currenthightlight == 26) {
Pic26.BackColor = Color.LightCyan;
} else if (currenthightlight == 27) {
Pic27.BackColor = Color.LightCyan;
} else if (currenthightlight == 28) {
Pic28.BackColor = Color.LightCyan;
} else if (currenthightlight == 29) {
Pic29.BackColor = Color.LightCyan;

} else if (currenthightlight == 30) {
Pic30.BackColor = Color.LightCyan;
} else if (currenthightlight == 31) {
Pic31.BackColor = Color.LightCyan;
} else if (currenthightlight == 32) {
Pic32.BackColor = Color.LightCyan;
} else if (currenthightlight == 33) {
Pic33.BackColor = Color.LightCyan;
} else if (currenthightlight == 34) {
Pic34.BackColor = Color.LightCyan;
} else if (currenthightlight == 35) {
Pic35.BackColor = Color.LightCyan;
} else if (currenthightlight == 36) {
Pic36.BackColor = Color.LightCyan;

} else if (currenthightlight == 37) {
Pic37.BackColor = Color.LightCyan;
} else if (currenthightlight == 38) {
Pic38.BackColor = Color.LightCyan;
} else if (currenthightlight == 39) {
Pic39.BackColor = Color.LightCyan;
} else if (currenthightlight == 40) {
Pic40.BackColor = Color.LightCyan;
} else if (currenthightlight == 41) {
Pic41.BackColor = Color.LightCyan;
} else if (currenthightlight == 42) {
Pic42.BackColor = Color.LightCyan;
} else if (currenthightlight == 43) {
Pic43.BackColor = Color.LightCyan;

} else if (currenthightlight == 44) {
Pic44.BackColor = Color.LightCyan;
} else if (currenthightlight == 45) {
Pic45.BackColor = Color.LightCyan;
} else if (currenthightlight == 46) {
Pic46.BackColor = Color.LightCyan;
} else if (currenthightlight == 47) {
Pic47.BackColor = Color.LightCyan;
} else if (currenthightlight == 48) {
Pic48.BackColor = Color.LightCyan;
} else if (currenthightlight == 49) {
Pic49.BackColor = Color.LightCyan;
} else if (currenthightlight == 50) {
Pic50.BackColor = Color.LightCyan;

} else if (currenthightlight == 51) {
Pic51.BackColor = Color.LightCyan;
} else if (currenthightlight == 52) {
Pic52.BackColor = Color.LightCyan;
} else if (currenthightlight == 53) {
Pic53.BackColor = Color.LightCyan;
} else if (currenthightlight == 54) {
Pic54.BackColor = Color.LightCyan;
} else if (currenthightlight == 55) {
Pic55.BackColor = Color.LightCyan;
} else if (currenthightlight == 56) {
Pic56.BackColor = Color.LightCyan;
} else if (currenthightlight == 57) {
Pic57.BackColor = Color.LightCyan;

} else if (currenthightlight == 58) {
Pic58.BackColor = Color.LightCyan;
} else if (currenthightlight == 59) {
Pic59.BackColor = Color.LightCyan;
} else if (currenthightlight == 60) {
Pic60.BackColor = Color.LightCyan;
} else if (currenthightlight == 61) {
Pic61.BackColor = Color.LightCyan;
} else if (currenthightlight == 62) {
Pic62.BackColor = Color.LightCyan;
} else if (currenthightlight == 63) {
Pic63.BackColor = Color.LightCyan;
} else if (currenthightlight == 64) {
Pic64.BackColor = Color.LightCyan;
}
//  End If


//current selected field 
Label6.Text = currenthightlight.ToString;





int o = 0;


getpair = 0;
foreach (object p in Panel1.Controls) {
for (o = 0; o <= 64; o++) {
if (p.name == "Pic" + o.ToString & p.BackColor == Color.LightCyan) {
if (getpair < 2) {
getpair = getpair + 1;
}

Label9.Text = getpair;
//1 selected

if (getpair == 1) {




if (fn > 0) {



} else {
fn = o;

Label10.Text = fn.ToString;
}

firstselectedking = fn;


}

//second selected

if (getpair == 2) {
Label9.Text = getpair;

if (sn > 0) {

} else {
sn = currenthightlight;
// good fix instead of o(o works with upper levels dont know why)

Label11.Text = sn.ToString;





}


Label9.Text = getpair;

}

}
}

}
if (getpair == 2) {
//GET KING
foreach (PictureBox h in Panel1.Controls) {
if (h.Tag == "myking") {
myking();

}
}



//check and move

foreach (object p in Panel1.Controls) {
//check if button was selected
if (p.name == "Pic" + fn.ToString & p.tag == "my") {
int firstlocation = fn - 7;
int secondlocation = fn - 9;


int getridofenemy1 = fn - 14;
int getridofenemy2 = fn - 18;

//test next bicie
int getridofenemy3 = fn - 21;
int getridofenemy4 = fn - 23;
// 27

//test next bicie from left
int getridofenemy6 = fn - 27;
int getridofenemy5 = fn - 25;
// 27






//------------------------------------


if (currenthightlight == firstlocation | currenthightlight == secondlocation) {
//transfer the iamge




foreach (object s in Panel1.Controls) {

if (s.name == "Pic" + sn.ToString & s.tag != "my") {
s.image = p.image;
s.tag = "my";
s.SizeMode = PictureBoxSizeMode.Zoom;


p.image = null;
p.tag = "";
p.SizeMode = PictureBoxSizeMode.Zoom;

//refresh
//If getpair = 2 Then

getpair = 0;
Label9.Text = getpair;


fn = 0;
sn = 0;
o = 0;



Label10.Text = "";
Label11.Text = "";



//COMPUTER TURN NOW

Label15.Text = "Computer";

enemyinfo();
getpair = 0;
// be ready


//End If





}
}

                            {

                            }
                        }
                }
            }








        }

    }



        
    
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace Checkers_Game_Play
{
    public partial class CheckersBoard : Form
    {

        //your color 
        // 0 is red
        int yourcolor = 0;
        //draw your buttons
        int drawmy1 = 49;
        int drawmy2 = 58;
        int drawmy3 = 42;
        //draw enemy buttons
        int drawenemy1 = 1;
        int drawenemy2 = 10;
        int drawenemy3 = 17;
        //music and sound
        int playmusic = 1;
        //Dim playsound As Integer = 1
        //current hightlight
        int currenthightlight;
        //current selected button
        int currentselectedbutton;
        bool selectedbutton = false;
        //count clicks
        int countclicks = 0;
        //get empty places up the selected button
        int getemptyplaces1;

        int getemptyplaces2;
        //get 2 first selecte - get pair to compare
        int getpair;
        int fn;

        int sn;
        //test 
        bool fromleft;
        bool fromright;
        //time
        int counttime;
        int min;
        bool showmin;
        //test
        int getenemy;
        // Dim enemyloc As Integer = 100


        int enemytomove;

        bool callcommove;

        int morebuttons = 0;
        //drag
        bool drag;
        int mousex;

        int mousey;


        //KING TEST

        int firstselectedking;


        int enemykinglocation;
        //end game timer
        int endgamecomputer;

        int endgamehuman;

        public CheckersBoard()
        {
            InitializeComponent();
        }

        private void buttonExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CheckersBoard_KeyDown(object sender, KeyEventArgs e)
        {
            //exit
            if (e.KeyCode == Keys.Escape)
            {
                this.Close();

            }
        }

        private void CheckersBoard_Load(object sender, EventArgs e)
        {
            ControlForm objControlForm = new ControlForm();
            //get selected buttons
            if (objControlForm.RadioButton2.Checked == true)
            {
                yourcolor = 1;
            }
            else
            {
                yourcolor = 0;
            }

            //get the selected board
            //load red buttons on bottom

            if (yourcolor == 0)
            {
                foreach (object P in Panel1.Controls)
                {
                    if (P is PictureBox)

                        //load red buttons on bottom

                        if (yourcolor == 0)
                        {

                            foreach (object p in Panel1.Controls)
                            {

                                if (p is PictureBox)
                                {
                                }
                                //TEST
                                //------------------------------
                                if (morebuttons == 1)
                                {
                                    for (drawmy3 = 42; drawmy3 <= 48; drawmy3 += 2)
                                    {
                                        if (p.Name == "Pic" + drawmy3.ToString)
                                        {
                                            P.SizeMode = PictureBoxSizeMode.Zoom;
                                            P.Image = ImageList1.Images.Item(0);
                                            P.Tag = "my";


                                        }
                                    }


                                }

                                //-------------------------------



                                for (drawmy1 = 49; drawmy1 <= 56; drawmy1 += 2)
                                {
                                    if (p.Name == "Pic" + drawmy1.ToString)
                                    {
                                        p.SizeMode = PictureBoxSizeMode.Zoom;
                                        p.Image = ImageList1.Images.Item(0);
                                        p.Tag = "my";


                                    }

                                }

                            }
                            
}
//second raw
for (drawmy2 = 58; drawmy2 <= 64; drawmy2 += 2) {
if (p.Name == "Pic" + drawmy2.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(0);
p.Tag = "my";

}




}

}

//TEST
//------------------------------
if (morebuttons == 1) {
for (drawenemy3 = 17; drawenemy3 <= 24; drawenemy3 += 2) {
if (p.Name == "Pic" + drawenemy3.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "enemy";

}
}



}

//-------------------------------

//draw enemy buttons
for (drawenemy1 = 1; drawenemy1 <= 8; drawenemy1 += 2) {
if (p.Name == "Pic" + drawenemy1.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "enemy";

}
//second raw
for (drawenemy2 = 10; drawenemy2 <= 16; drawenemy2 += 2) {
if (p.Name == "Pic" +drawenemy2.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "enemy";
}


}
}

}

}



} else {
//load blue buttons on bottom

foreach (object p in Panel1.Controls) {

if (p is PictureBox) {
//TEST
//------------------------------
if (morebuttons == 1) {
for (drawmy3 = 42; drawmy3 <= 48; drawmy3 += 2) {
if (p.Name == "Pic" + drawmy3.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "my";


}
}


}

//-------------------------------


for (drawmy1 = 49; drawmy1 <= 56; drawmy1 += 2) {
if (p.Name == "Pic" + drawmy1.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "my";

}
//second raw
for (drawmy2 = 58; drawmy2 <= 64; drawmy2 += 2) {
if (p.Name == "Pic" + drawmy2.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(1);
p.Tag = "my";
}


}
}

//draw enemy buttons
//TEST
//------------------------------
if (morebuttons == 1) {
for (drawenemy3 = 17; drawenemy3 <= 24; drawenemy3 += 2) {
if (p.Name == "Pic" + drawenemy3.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(0);
p.Tag = "enemy";

}
}



}

//-------------------------------

for (drawenemy1 = 1; drawenemy1 <= 8; drawenemy1 += 2) {
if (p.Name == "Pic" + drawenemy1.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(0);
p.Tag = "enemy";

}
//second raw
for (drawenemy2 = 10; drawenemy2 <= 16; drawenemy2 += 2) {
if (p.Name == "Pic" + drawenemy2.ToString) {
p.SizeMode = PictureBoxSizeMode.Zoom;
p.Image = ImageList1.Images.Item(0);
p.Tag = "enemy";

}


}
}





//picturebox loop here

}


}

//set tags to picturebiexe








}
}

public void checkmyking()
{
if (yourcolor == 0) {
if (Pic1.Tag == "my") {
Pic1.Image = My.Resources.redking1;
Pic1.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic3.Tag == "my") {
Pic3.Image = My.Resources.redking1;
Pic3.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic5.Tag == "my") {
Pic5.Image = My.Resources.redking1;
Pic5.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic7.Tag == "my") {
Pic7.Image = My.Resources.redking1;
Pic7.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
}
} else if (yourcolor == 1) {
if (Pic1.Tag == "my") {
Pic1.Image = My.Resources.blueking1;
Pic1.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic3.Tag == "my") {
Pic3.Image = My.Resources.blueking1;
Pic3.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic5.Tag == "my") {
Pic5.Image = My.Resources.blueking1;
Pic5.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
} else if (Pic7.Tag == "my") {
Pic7.Image = My.Resources.blueking1;
Pic7.Tag = "myking";
//comp move
if (Label15.Text != "Computer") {
Label15.Text = "Computer";
}
}
}


}

public void checkenemyking()
{
//problem with piz7
if (Pic7.Image == null) {
Pic7.Tag = "";
// resolve the tag of pic7
}




//' my color red enemy blue 
if (yourcolor == 0) {
if (Pic58.Tag == "enemy") {
Pic58.Image = My.Resources.blueking1;
Pic58.Tag = "enemyking";
} else if (Pic60.Tag == "enemy") {
Pic60.Image = My.Resources.blueking1;
Pic60.Tag = "enemyking";
} else if (Pic62.Tag == "enemy") {
Pic62.Image = My.Resources.blueking1;
Pic62.Tag = "enemyking";
} else if (Pic64.Tag == "enemy") {
Pic64.Image = My.Resources.blueking1;
Pic64.Tag = "enemyking";
}
} else if (yourcolor == 1) {
if (Pic58.Tag == "enemy") {
Pic58.Image = My.Resources.redking1;
Pic58.Tag = "enemyking";
} else if (Pic60.Tag == "enemy") {
Pic60.Image = My.Resources.redking1;
Pic60.Tag = "enemyking";
} else if (Pic62.Tag == "enemy") {
Pic62.Image = My.Resources.redking1;
Pic62.Tag = "enemyking";
} else if (Pic64.Tag == "enemy") {
Pic64.Image = My.Resources.redking1;
Pic64.Tag = "enemyking";
}
}
}



public void hightlight()
{
//test with countclicks
//  If countclicks = 2 Then



if (currenthightlight == 1) {
Pic1.BackColor = Color.LightCyan;
} else if (currenthightlight == 2) {
Pic2.BackColor = Color.LightCyan;
} else if (currenthightlight == 3) {
Pic3.BackColor = Color.LightCyan;
} else if (currenthightlight == 4) {
Pic4.BackColor = Color.LightCyan;
} else if (currenthightlight == 5) {
Pic5.BackColor = Color.LightCyan;
} else if (currenthightlight == 6) {
Pic6.BackColor = Color.LightCyan;
} else if (currenthightlight == 7) {
Pic7.BackColor = Color.LightCyan;
} else if (currenthightlight == 8) {
Pic8.BackColor = Color.LightCyan;

} else if (currenthightlight == 9) {
Pic9.BackColor = Color.LightCyan;
} else if (currenthightlight == 10) {
Pic10.BackColor = Color.LightCyan;
} else if (currenthightlight == 11) {
Pic11.BackColor = Color.LightCyan;
} else if (currenthightlight == 12) {
Pic12.BackColor = Color.LightCyan;
} else if (currenthightlight == 13) {
Pic13.BackColor = Color.LightCyan;
} else if (currenthightlight == 14) {
Pic14.BackColor = Color.LightCyan;
} else if (currenthightlight == 15) {
Pic15.BackColor = Color.LightCyan;

} else if (currenthightlight == 16) {
Pic16.BackColor = Color.LightCyan;
} else if (currenthightlight == 17) {
Pic17.BackColor = Color.LightCyan;
} else if (currenthightlight == 18) {
Pic18.BackColor = Color.LightCyan;
} else if (currenthightlight == 19) {
Pic19.BackColor = Color.LightCyan;
} else if (currenthightlight == 20) {
Pic20.BackColor = Color.LightCyan;
} else if (currenthightlight == 21) {
Pic21.BackColor = Color.LightCyan;
} else if (currenthightlight == 22) {
Pic22.BackColor = Color.LightCyan;

} else if (currenthightlight == 23) {
Pic23.BackColor = Color.LightCyan;
} else if (currenthightlight == 24) {
Pic24.BackColor = Color.LightCyan;
} else if (currenthightlight == 25) {
Pic25.BackColor = Color.LightCyan;
} else if (currenthightlight == 26) {
Pic26.BackColor = Color.LightCyan;
} else if (currenthightlight == 27) {
Pic27.BackColor = Color.LightCyan;
} else if (currenthightlight == 28) {
Pic28.BackColor = Color.LightCyan;
} else if (currenthightlight == 29) {
Pic29.BackColor = Color.LightCyan;

} else if (currenthightlight == 30) {
Pic30.BackColor = Color.LightCyan;
} else if (currenthightlight == 31) {
Pic31.BackColor = Color.LightCyan;
} else if (currenthightlight == 32) {
Pic32.BackColor = Color.LightCyan;
} else if (currenthightlight == 33) {
Pic33.BackColor = Color.LightCyan;
} else if (currenthightlight == 34) {
Pic34.BackColor = Color.LightCyan;
} else if (currenthightlight == 35) {
Pic35.BackColor = Color.LightCyan;
} else if (currenthightlight == 36) {
Pic36.BackColor = Color.LightCyan;

} else if (currenthightlight == 37) {
Pic37.BackColor = Color.LightCyan;
} else if (currenthightlight == 38) {
Pic38.BackColor = Color.LightCyan;
} else if (currenthightlight == 39) {
Pic39.BackColor = Color.LightCyan;
} else if (currenthightlight == 40) {
Pic40.BackColor = Color.LightCyan;
} else if (currenthightlight == 41) {
Pic41.BackColor = Color.LightCyan;
} else if (currenthightlight == 42) {
Pic42.BackColor = Color.LightCyan;
} else if (currenthightlight == 43) {
Pic43.BackColor = Color.LightCyan;

} else if (currenthightlight == 44) {
Pic44.BackColor = Color.LightCyan;
} else if (currenthightlight == 45) {
Pic45.BackColor = Color.LightCyan;
} else if (currenthightlight == 46) {
Pic46.BackColor = Color.LightCyan;
} else if (currenthightlight == 47) {
Pic47.BackColor = Color.LightCyan;
} else if (currenthightlight == 48) {
Pic48.BackColor = Color.LightCyan;
} else if (currenthightlight == 49) {
Pic49.BackColor = Color.LightCyan;
} else if (currenthightlight == 50) {
Pic50.BackColor = Color.LightCyan;

} else if (currenthightlight == 51) {
Pic51.BackColor = Color.LightCyan;
} else if (currenthightlight == 52) {
Pic52.BackColor = Color.LightCyan;
} else if (currenthightlight == 53) {
Pic53.BackColor = Color.LightCyan;
} else if (currenthightlight == 54) {
Pic54.BackColor = Color.LightCyan;
} else if (currenthightlight == 55) {
Pic55.BackColor = Color.LightCyan;
} else if (currenthightlight == 56) {
Pic56.BackColor = Color.LightCyan;
} else if (currenthightlight == 57) {
Pic57.BackColor = Color.LightCyan;

} else if (currenthightlight == 58) {
Pic58.BackColor = Color.LightCyan;
} else if (currenthightlight == 59) {
Pic59.BackColor = Color.LightCyan;
} else if (currenthightlight == 60) {
Pic60.BackColor = Color.LightCyan;
} else if (currenthightlight == 61) {
Pic61.BackColor = Color.LightCyan;
} else if (currenthightlight == 62) {
Pic62.BackColor = Color.LightCyan;
} else if (currenthightlight == 63) {
Pic63.BackColor = Color.LightCyan;
} else if (currenthightlight == 64) {
Pic64.BackColor = Color.LightCyan;
}
//  End If


//current selected field 
Label6.Text = currenthightlight.ToString;





int o = 0;


getpair = 0;
foreach (object p in Panel1.Controls) {
for (o = 0; o <= 64; o++) {
if (p.name == "Pic" + o.ToString & p.BackColor == Color.LightCyan) {
if (getpair < 2) {
getpair = getpair + 1;
}

Label9.Text = getpair;
//1 selected

if (getpair == 1) {




if (fn > 0) {



} else {
fn = o;

Label10.Text = fn.ToString;
}

firstselectedking = fn;


}

//second selected

if (getpair == 2) {
Label9.Text = getpair;

if (sn > 0) {

} else {
sn = currenthightlight;
// good fix instead of o(o works with upper levels dont know why)

Label11.Text = sn.ToString;





}


Label9.Text = getpair;

}

}
}

}
if (getpair == 2) {
//GET KING
foreach (PictureBox h in Panel1.Controls) {
if (h.Tag == "myking") {
myking();

}
}



//check and move

foreach (object p in Panel1.Controls) {
//check if button was selected
if (p.name == "Pic" + fn.ToString & p.tag == "my") {
int firstlocation = fn - 7;
int secondlocation = fn - 9;


int getridofenemy1 = fn - 14;
int getridofenemy2 = fn - 18;

//test next bicie
int getridofenemy3 = fn - 21;
int getridofenemy4 = fn - 23;
// 27

//test next bicie from left
int getridofenemy6 = fn - 27;
int getridofenemy5 = fn - 25;
// 27






//------------------------------------


if (currenthightlight == firstlocation | currenthightlight == secondlocation) {
//transfer the iamge




foreach (object s in Panel1.Controls) {

if (s.name == "Pic" + sn.ToString & s.tag != "my") {
s.image = p.image;
s.tag = "my";
s.SizeMode = PictureBoxSizeMode.Zoom;


p.image = null;
p.tag = "";
p.SizeMode = PictureBoxSizeMode.Zoom;

//refresh
//If getpair = 2 Then

getpair = 0;
Label9.Text = getpair;


fn = 0;
sn = 0;
o = 0;



Label10.Text = "";
Label11.Text = "";



//COMPUTER TURN NOW

Label15.Text = "Computer";

enemyinfo();
getpair = 0;
// be ready


//End If





}
}

                            {

                            }
                        }
                }
            }








        }

    }



        
  I have bunch or Error in Image and mydrawing and void 
pleASE HELLLLLLLLLLLLP