Eulerian Path by Turtle

Draw house in one stroke line.

Use the 4 buttons Forward, Back, Left and Right to control the movement of the turtle robot.
Note: In the graph theory, Eulerian path is a trail in a graph which visits every edge exactly once. Leonard Euler (1707-1783) proved that a necessary condition for the existence of Eulerian circuits is that all vertices in the graph have an even degree, and stated without proof that connected graphs with all vertices of even degree have an Eulerian circuit. Hopkins, B., R. J. Wilson, R. J. The Truth about Königsberg, In: The college Mathematics Journal, Vol 35, No 3, p 198–207. 2004.

Fleury's algorithm

At each step it chooses the next edge in the path to be one whose deletion would not disconnect the graph, unless there is no such edge, in which case it picks the remaining edge left at the current vertex. animation