コード例 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            kt = new KnightsTourGraph(tam, tam);

            if (x == -1 && y == -1)
            {
                MessageBox.Show("Selecione o inicio", "KnightsTour", MessageBoxButtons.OK);
            }

            else if (i > 0 && j > 0)
            {
                for (int z = 0; z < i; z++)
                {
                    kt.AddObstacle(obsX[z], obsY[z]);
                }
                MessageBox.Show("Programa iniciado nas coordenadas: " + "[" + x + "]" + "[" + y + "]", "KnightsTour", MessageBoxButtons.OK);
                kt.GenerateSumObs();
                int[,] resp = kt.GetSolution(x, y);
                mostraSolucaoObs(resp);
                jogar = true;
            }
            else
            {
                timer1.Start();
                MessageBox.Show("Programa iniciado nas coordenadas: " + "[" + x + "]" + "[" + y + "]", "KnightsTour", MessageBoxButtons.OK);

                int[,] resp = kt.GetSolution(x, y);
                mostraSolucao(resp);
                jogar = true;
            }
        }
コード例 #2
0
 private void button3_Click_1(object sender, EventArgs e)
 {
     Application.Restart();
     kt = new KnightsTourGraph(tam, tam);
     quadro.Columns.Clear();
 }
コード例 #3
0
 private void reiniciarToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Application.Restart();
     kt = new KnightsTourGraph(tam, tam);
     quadro.Columns.Clear();
 }