示例#1
0
 public static function parsMoving($s)
 {
     $error = "Неверно заданы команды для ровера!<br>";
     $s = strtoupper(trim($s));
     $commands = str_split($s);
     // получаем массив команд
     foreach ($commands as $value) {
         if (Moving::checkMove($value)) {
             Moving::moveTo($value);
             if (Position::checkPos(Polygon::getSizeX(), Polygon::getSizeY(), Position::getPosX(), Position::getPosY()) == false) {
                 echo "Ровер выехал за пределы полигона! (" . Position::getPosX() . " " . Position::getPosY() . " " . Orientation::getSide() . ")<br>";
                 break;
             }
             //echo "-Измененная позиция ровера: ". Position::getPosX()  . " " . Position::getPosY() . " " . Orientation::getSide() ."<br>";
         } else {
             echo $error;
             echo $value . "<br>";
             break;
         }
     }
     echo "Измененная позиция ровера: " . Position::getPosX() . " " . Position::getPosY() . " " . Orientation::getSide() . "<br>";
 }
示例#2
0
 public static function parsMoving($s, $n)
 {
     $error = "Неверно заданы команды для ровера №" . $n . "!<br>";
     $success = true;
     // По умолчанию надеемся, что ф-ция отбработает успешно
     $s = strtoupper(trim($s));
     $commands = str_split($s);
     // получаем массив команд
     foreach ($commands as $value) {
         if (Moving::checkMove($value)) {
             Moving::moveTo($value);
             if (Position::checkPos(Polygon::getSizeX(), Polygon::getSizeY(), Position::getPosX(), Position::getPosY()) == false) {
                 echo "Ровер " . $n . " выехал за пределы полигона! (" . Position::getPosX() . " " . Position::getPosY() . " " . Orientation::getSide() . ")<br>";
                 break;
             }
             //echo "-Измененная позиция ровера: ". Position::getPosX()  . " " . Position::getPosY() . " " . Orientation::getSide() ."<br>";
         } else {
             echo $error;
             //echo $value . "<br>";
             $success = false;
             break;
         }
     }
     return $success;
 }
示例#3
0
 /**
  * Registers the student for the given career.
  *
  * @param Career $career
  * @param Orientation $orientation
  * @param integer $start_year
  */
 public function registerToCareer(Career $career, Orientation $orientation = null, SubOrientation $sub_orientation = null, $start_year, $con = null)
 {
     if ($con == null) {
         $con = Propel::getConnection(StudentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $career_student = new CareerStudent();
     $career_student->setCareerId($career->getId());
     if ($orientation) {
         $career_student->setOrientationId($orientation->getId());
     }
     if ($sub_orientation) {
         $career_student->setSubOrientationId($sub_orientation->getId());
     }
     $career_student->setStudentId($this->getId());
     $career_student->setStartYear($start_year);
     SchoolBehaviourFactory::getInstance()->setStudentFileNumberForCareer($career_student, $con);
     $career_student->save($con);
     SchoolBehaviourFactory::getInstance()->createStudentCareerSubjectAlloweds($career_student, $start_year, $con);
 }