Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int i, j;

            string[] a = new string[count];
            string[] b = new string[0 - negativecount + 1];
            if (count >= 2)
            {
                for (i = 1; i <= count; i++)
                {
                    for (j = 1; j < BoardSizeC * BoardSizeL; j++)
                    {
                        if (pieceIdBoard[j].Enumarare == i)
                        {
                            a[i - 1] = ((char)('a' + (pieceIdBoard[j].Location.X / 84))).ToString() + (BoardSizeL - pieceIdBoard[j].Location.Y / 84).ToString();
                            break;
                        }
                    }
                }
                DatePiesa.MutarilePiesei1 = a;
                for (j = 1; j < BoardSizeC * BoardSizeL; j++)
                {
                    if (pieceIdBoard[j].Enumarare == 1)
                    {
                        b[0] = ((char)('a' + (pieceIdBoard[j].Location.X / 84))).ToString() + (BoardSizeL - pieceIdBoard[j].Location.Y / 84).ToString();
                        break;
                    }
                }
                for (i = -1; i >= negativecount; i--)
                {
                    for (j = 1; j < BoardSizeC * BoardSizeL; j++)
                    {
                        if (pieceIdBoard[j].Enumarare == i)
                        {
                            b[(0 - i)] = ((char)('a' + (pieceIdBoard[j].Location.X / 84))).ToString() + (BoardSizeL - pieceIdBoard[j].Location.Y / 84).ToString();
                            break;
                        }
                    }
                }
                if (b.Length != 1)
                {
                    DatePiesa.MutarilePiesei2 = b;
                }
                DatePiesa.Save         = true;
                DatePiesa.NumelePiesei = string.Copy("Regina");
                RadioButton raspuns1 = RadioButtonHelper.GetCheckedRadio(groupBox1);
                RadioButton raspuns2 = RadioButtonHelper.GetCheckedRadio(groupBox2);
                RadioButton raspuns3 = RadioButtonHelper.GetCheckedRadio(groupBox3);
                if (raspuns1 == radioButton2)
                {
                    DatePiesa.RaspunsIntrb1 = false;
                }
                else
                {
                    DatePiesa.RaspunsIntrb1 = true;
                }
                if (raspuns2 == radioButton4)
                {
                    DatePiesa.RaspunsIntrb2 = false;
                }
                else
                {
                    DatePiesa.RaspunsIntrb2 = true;
                }
                if (raspuns3 == radioButton5)
                {
                    DatePiesa.RaspunsIntrb3 = false;
                }
                else
                {
                    DatePiesa.RaspunsIntrb3 = true;
                }

                if (DatePiesa.RaspunsIntrb3 == false)
                {
                    a = new string[countt + 1];
                    for (j = 1; j < BoardSizeC * BoardSizeL; j++)
                    {
                        if (pieceIdBoard[j].Enumarare == 1)
                        {
                            a[0] = ((char)('a' + (pieceIdBoard[j].Location.X / 84))).ToString() + (BoardSizeL - pieceIdBoard[j].Location.Y / 84).ToString();
                            break;
                        }
                    }
                    for (i = 1; i <= countt; i++)
                    {
                        for (j = 1; j < BoardSizeC * BoardSizeL; j++)
                        {
                            if (pieceIdBoard[j].Capturare == i)
                            {
                                a[i] = ((char)('a' + (pieceIdBoard[j].Location.X / 84))).ToString() + (BoardSizeL - pieceIdBoard[j].Location.Y / 84).ToString();
                                break;
                            }
                        }
                    }
                    DatePiesa.MutarilePieseiCaptura = a;
                }
            }
            else
            {
                MessageBox.Show("Trebuie să aveți măcar o mutare selectată");
            }
        }
Example #2
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            CuloarePiesa culoareajucatorului = CuloarePiesa.Alb;
            RadioButton  butonculoare        = RadioButtonHelper.GetCheckedRadio(groupBox1);

            if (butonculoare == btn_Negru)
            {
                culoareajucatorului = CuloarePiesa.Negru;
            }

            MarimeTable SizeeL = MarimeTable.Patru;
            MarimeTable SizeeC = MarimeTable.Patru;

            if (String.Equals(comboBox1.Text, "5"))
            {
                SizeeL = MarimeTable.Cinci;
            }
            if (String.Equals(comboBox1.Text, "6"))
            {
                SizeeL = MarimeTable.Sase;
            }
            if (String.Equals(comboBox1.Text, "7"))
            {
                SizeeL = MarimeTable.Sapte;
            }
            if (String.Equals(comboBox1.Text, "8"))
            {
                SizeeL = MarimeTable.Opt;
            }
            if (String.Equals(comboBox1.Text, "9"))
            {
                SizeeL = MarimeTable.Noua;
            }
            if (String.Equals(comboBox1.Text, "10"))
            {
                SizeeL = MarimeTable.Zece;
            }
            if (String.Equals(comboBox2.Text, "5"))
            {
                SizeeC = MarimeTable.Cinci;
            }
            if (String.Equals(comboBox2.Text, "6"))
            {
                SizeeC = MarimeTable.Sase;
            }
            if (String.Equals(comboBox2.Text, "7"))
            {
                SizeeC = MarimeTable.Sapte;
            }
            if (String.Equals(comboBox2.Text, "8"))
            {
                SizeeC = MarimeTable.Opt;
            }
            if (String.Equals(comboBox2.Text, "9"))
            {
                SizeeC = MarimeTable.Noua;
            }
            if (String.Equals(comboBox2.Text, "10"))
            {
                SizeeC = MarimeTable.Zece;
            }

            newGameInfo = new NewGameInfo(culoareajucatorului, SizeeC, SizeeL);
        }
Example #3
0
        private void buton_am_terminat_Click(object sender, EventArgs e)
        {
            int BoardSizeL = CalculeazaMarime(Global.GlobalMarimeLinii);
            int BoardSizeC = CalculeazaMarime(Global.GlobalMarimeColoane);
            int ok         = 0;
            int j;

            if (radioButton4.Checked == true)
            {
                ok = 2;
                for (j = 1; j < BoardSizeC * BoardSizeL; j++)
                {
                    if (pieceIdBoard[j].BackColor == Color.Yellow)
                    {
                        ok = 1;
                        break;
                    }
                }
                if (ok == 2)
                {
                    MessageBox.Show("Nu ați selectat nici o poziție de terminare a partidei", "Atenție");
                }
            }
            DatePiesa.NumePiesa = String.Copy(piesa);
            string[] a = new string[10];
            if (ok == 1)
            {
                int i = 1;
                for (j = 1; j < BoardSizeC * BoardSizeL; j++)
                {
                    if (pieceIdBoard[j].BackColor == Color.Yellow)
                    {
                        a[i - 1] = ((char)('a' + (pieceIdBoard[j].Location.X / 84))).ToString() + (BoardSizeL - pieceIdBoard[j].Location.Y / 84).ToString();
                        i++;
                    }
                }
                DatePiesa.MutariPozitie = a;
            }
            if (ok < 2)
            {
                RadioButton raspuns1 = RadioButtonHelper.GetCheckedRadio(groupBox1);
                RadioButton raspuns3 = RadioButtonHelper.GetCheckedRadio(groupBox3);
                RadioButton raspuns2 = RadioButtonHelper.GetCheckedRadio(groupBox2);
                if (raspuns1 == radioButton2)
                {
                    DatePiesa.RaspunsIntrebare1 = false;
                }
                else
                {
                    DatePiesa.RaspunsIntrebare1 = true;
                }
                if (raspuns3 == radioButton5)
                {
                    DatePiesa.RaspunsIntrebare11 = false;
                }
                else
                {
                    DatePiesa.RaspunsIntrebare11 = true;
                }
                if (raspuns2 == radioButton3)
                {
                    DatePiesa.RaspunsIntrebare2 = false;
                }
                else
                {
                    DatePiesa.RaspunsIntrebare2 = true;
                }
                DatePiesa.NumarRanduri = BoardSizeL;
                DatePiesa.NumarColoane = BoardSizeC;
                DatePiesa.Culoare      = Global.GlobalCuloare;
                this.DialogResult      = DialogResult.OK;
                this.Close();
            }
        }