MHB Logo - Help the turtle escape the room

  • Thread starter Thread starter Yankel
  • Start date Start date
  • Tags Tags
    Escape
AI Thread Summary
In the Logo programming language scenario, a turtle is confined within a circle and programmed to move forward while turning right by 135 degrees upon nearing the white background. This behavior prevents the turtle from escaping the circle. The discussion centers on whether there exists a starting position for the turtle or its heading that would enable it to escape. It is concluded that if the turtle begins within a distance of half the square root of 2 from the center, it cannot escape. However, if positioned beyond this distance and directed towards a point at an angle of 135 degrees or less, the turtle can successfully escape the circle.
Yankel
Messages
390
Reaction score
0
Hello all,

I have a question, would like to have your opinion on the matter.

In the Logo programming language, I draw a red blue circle and put a turtle in it. I have specified that the turtle will move forward constantly, but, when approaching a white background (the page's background), it will turn right by 135 degrees. As a result, every time the turtle comes to exit the circle, it turns around and moved forward another way, staying in the circle. In this way the turtle never escapes the circle.

The question is: Is there a starting position (for the turtle itself and/or his head) that will allow him to escape?

Thank you !

View attachment 7237
 

Attachments

  • turtle.JPG
    turtle.JPG
    4.3 KB · Views: 110
Technology news on Phys.org
Yankel said:
Hello all,

I have a question, would like to have your opinion on the matter.

In the Logo programming language, I draw a red blue circle and put a turtle in it. I have specified that the turtle will move forward constantly, but, when approaching a white background (the page's background), it will turn right by 135 degrees. As a result, every time the turtle comes to exit the circle, it turns around and moved forward another way, staying in the circle. In this way the turtle never escapes the circle.

The question is: Is there a starting position (for the turtle itself and/or his head) that will allow him to escape?

Thank you !

Without loss of generality we can assume that the turtle escapes at the top.

\begin{tikzpicture}[>=stealth,shorten >=2pt,,shorten <=2pt]
\fill[cyan!50] circle (2);
\draw[help lines] (-3,-3) grid (3,3);
\draw circle (2);
\fill (0,2) circle (0.07);
\draw (2,0) -- (-1,3);
\draw[->, thick] (2,0) -- (0,2);
\draw[->, thick] (0,2) -- (2,2);
\draw[->] (0,2) +(62.5:0.7) node {$135^\circ$} +(135:1) arc (135:0:1);
\fill (0,0) circle (0.07);
\draw[<->] (0,0) -- node[below, xshift=4] {\small$\frac 12\sqrt 2$} (1,1);
\end{tikzpicture}

If the turtle starts somewhere on the first vector, or in the area that's above it, and moves to the top, it will escape.
And it's not possible to escape in 2 hits or more.

More generally, if the turtle is within distance $\frac 12 \sqrt 2$ of the center, it cannot escape.
And otherwise, it can escape, but only if it is directed at a point where the given angle is $135^\circ$ or less.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top