コード例 #1
0
ファイル: Form1.cs プロジェクト: jongwonleee/cube_solver
        private void but_solve_Click(object sender, EventArgs e)
        {
            string url = "http://rubiks-cube-solver.com/solution.php?cube=0";
            string add = "";

            int[] num = new int[] { 0, 0, 0, 0, 0, 0 };
            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        add = add + Convert.ToString(cube[i, j, k] + 1);
                        num[cube[i, j, k]]++;
                    }
                }
            }
            bool tf = true;

            for (int i = 0; i < 6; i++)
            {
                if (num[i] != 9)
                {
                    tf = false;
                }
            }
            if (tf)
            {
                url = url + add + "&x=1";
                startparse(url);
                if (sol[0] == "Error Found")
                {
                    MessageBox.Show("큐브 입력에 잘못된 부분이 있습니다.\n다시 한번 확인 해주세요.", "Error Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (sol[0] == null)
                    {
                        MessageBox.Show("다시 한번 확인 해주세요.", "Error Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        string lt = sol[0].Substring(0, 1);
                        if (lt == "L" || lt == "R" || lt == "F" || lt == "B" || lt == "D" || lt == "U")
                        {
                            try
                            {
                                Solve_form frm = new Solve_form(sol, side, cube, cnt);
                                frm.Owner = this;
                                frm.Show();
                            }catch (Exception)
                            {
                            }
                        }
                        else
                        {
                            MessageBox.Show("큐브 입력에 잘못된 부분이 있습니다.\n다시 한번 확인 해주세요.", "Error Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("큐브 입력에 잘못된 부분이 있습니다.\n다시 한번 확인 해주세요.", "Error Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: jongwonleee/cube_solver
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Solve_form frm = new Solve_form(fsol, side, cube, fcnt);

            frm.Show();
        }