/** * Place the current cursor position * @param FieldCursor $cursor */ public function placeCursor(FieldCursor $cursor) { $currentPoints = $cursor->getCurrentPoints(); $newCurrentPoints = []; foreach ($currentPoints as $point) { $newCurrentPoints[] = clone $point; try { if (!$this->currentlyFilled($point)) { $this->fillCell($point); } } catch (OutOfFieldException $exc) { var_dump($exc->getMessage(), $point); } } $this->currentPoints = $newCurrentPoints; }
public function placeOnField(Field $field) { $iterations = 0; while (true) { $field->placeCursor($this->cursor); $this->cursor->moveLinear($this->vector, $this->factor); if ($this->endPoint->equal($this->cursor->getZeroPoint())) { $field->placeCursor($this->cursor); break; } //just debug issue if ($iterations++ > 5000) { var_dump("Max iterations!"); break; } } }