コード例 #1
0
 private void results_Load(object sender, EventArgs e)
 {
     m_Maze               = new MazeSolver(OptimalMaze);
     m_iMaze              = m_Maze.GetMaze;
     pictureBox1.Size     = new System.Drawing.Size(m_iColDimensions * m_iSize + 3, m_iRowDimensions * m_iSize + 3);
     pictureBox1.Location = new Point((370 - (m_iColDimensions * m_iSize + 3)) / 2, ((370 - (m_iRowDimensions * m_iSize + 3)) / 2) + 5);
     pictureBox2.Size     = new System.Drawing.Size(m_iColDimensions * m_iSize + 3, m_iRowDimensions * m_iSize + 3);
     pictureBox2.Location = new Point((370 - (m_iColDimensions * m_iSize + 3)) / 2, ((370 - (m_iRowDimensions * m_iSize + 3)) / 2) + 5);
     int[,] iSolvedMaze   = m_Maze.FindPath(iSelectedY, iSelectedX, iY, iX);
     if (iSolvedMaze != null)
     {
         m_iMaze = iSolvedMaze;
     }
     pictureBox2.Refresh();
     for (int i = 0; i < m_iRowDimensions; i++)
     {
         for (int j = 0; j < m_iColDimensions; j++)
         {
             if (m_iMaze[i, j] == 100)
             {
                 OptimalCount++;
             }
         }
     }
     label4.Text = "Кол-во клеток:" + Convert.ToString(StudentCount);
     label5.Text = "Кол-во клеток:" + Convert.ToString(OptimalCount);
     if (ExitFind && (StudentCount == OptimalCount))
     {
         Result     = "Лабиринт пройден! Ваш путь оптимален!";
         StatResult = "Путь оптимален";
     }
     if (ExitFind && (StudentCount != OptimalCount))
     {
         Result     = "Лабиринт пройден, но ваш путь не оптимален.";
         StatResult = "Путь не оптимален";
     }
     if (!ExitFind)
     {
         if (labyrinth.GiveUp == true)
         {
             Result     = "Вы сдались.";
             StatResult = "Ученик сдался";
         }
         else
         {
             Result     = "Лабиринт не пройден!";
             StatResult = "Время закончилось";
         }
     }
     label6.Text = Result;
     label2.Text = Familiya + " " + Imya + " " + Otchestvo;
     UpdateTimerText();
     if (!labyrinth.IsTeacher)
     {
         SQLHelper.AddResult(id, labyrinth.method, labyrinth.style, m_iRowDimensions, labyrinth.defminutes, labyrinth.defseconds, OptimalCount, StudentCount, minutes, seconds, StatResult);
     }
 }
コード例 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     timer1.Stop();
     minutes = defminutes;
     seconds = defseconds;
     mz      = new Maze(100, 100);
     mz.Generate(height, width, method);
     int[,] mzmatrix2 = mz.Getmaze(style, false);
     m_Maze           = new MazeSolver(mzmatrix2);
     m_iMaze          = m_Maze.GetMaze;
     this.Refresh();
     CheckStartAndEnd();
     UpdateTimerText();
     timer1.Start();
 }
コード例 #3
0
 private void Labyrinth_Load(object sender, EventArgs e)
 {
     if (IsTeacher)
     {
         button2.Enabled = true;
         button3.Enabled = true;
         button4.Enabled = true;
     }
     groupBox1.Text = labname;
     mz             = new Maze(100, 100);
     mz.Generate(height, width, method);
     int[,] mzmatrix2     = mz.Getmaze(style, false);
     m_Maze               = new MazeSolver(mzmatrix2);
     pictureBox1.Size     = new System.Drawing.Size(m_iColDimensions * m_iSize + 3, m_iRowDimensions * m_iSize + 3);
     pictureBox1.Location = new Point((660 - (m_iColDimensions * m_iSize + 3)) / 2, ((538 - (m_iRowDimensions * m_iSize + 3)) / 2) + 5);
     m_iMaze              = m_Maze.GetMaze;
     CheckStartAndEnd();
     if (!IsTeacher)
     {
         SQLHelper.AddResult(id, method, style, m_iColDimensions, defminutes, defseconds, 0, StudentCount, minutes, seconds, "Ошибка прохождения");
     }
     UpdateTimerText();
     timer1.Start();
 }