I have this problem.

A basic wooden railway set contains the pieces shown in Figure 3.32.

enter image description here

The task is to connect these pieces into a railway that has no overlapping tracks and no loose ends where a train could run off onto the floor.

a. Suppose that the pieces fit together exactly with no slack. Give a precise formulation of the task as a search problem.

b. Identify a suitable uninformed search algorithm for this task and explain your choice.

I know I have to use a DFS for this problem. But how do I know all the pieces are connected. The last one and the first one are connected.

Can someone help me with some tips on how to solve this problem and implement it (in Python)?

  • 2
    $\begingroup$ Hi and welcome to AI! Can you provide a more descriptive title? Put your main question in the title! $\endgroup$
    – nbro
    May 10, 2020 at 13:46
  • $\begingroup$ Also, note that if you're asking us to write code, your question is likely off-topic here. Programming questions are off-topic. See ai.stackexchange.com/help/on-topic for more details. I suggest you revise your post to ask a question that is on-topic. $\endgroup$
    – nbro
    May 10, 2020 at 13:54
  • $\begingroup$ Where did you take this exercise from? Which book? $\endgroup$
    – nbro
    May 10, 2020 at 14:04
  • $\begingroup$ I'm not asking for you to write code, just to help me write it with some tips. I don't exactly know which book, the professor gave us this assignment in a PDF, but I think I can find the book on google. $\endgroup$
    – rucarr
    May 10, 2020 at 14:07
  • $\begingroup$ ARTIFICIAL INTELLIGENCE: A MODERN APPROACH, THIRD EDITION, I think that's it. $\endgroup$
    – rucarr
    May 10, 2020 at 14:09


This site is temporarily in read-only mode and not accepting new answers.

Browse other questions tagged .