You will write a route finder for a few reactions. It looks at every place you can reach in one step, then in two steps, and so on, until it reaches the goal. This is a breadth-first search.
The idea. Each compound class is a place. Each reaction is an arrow, and it adds some carbons to the chain. The shortest route is the one with the fewest arrows.
Your tasks.
next_places(place) so that it returns the list of places that one reaction reaches.steps(start, goal) so that it returns the least number of reactions.carbons_added(start, goal) so that it returns the carbons added along the shortest route.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…