MHB Logo - Help the turtle escape the room

  • Thread starter Thread starter Yankel
  • Start date Start date
  • Tags Tags
    Escape
Click For 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: 117
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.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 30 ·
2
Replies
30
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 40 ·
2
Replies
40
Views
3K
Replies
3
Views
2K
  • · Replies 40 ·
2
Replies
40
Views
4K
Replies
3
Views
2K
  • · Replies 0 ·
Replies
0
Views
5K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K