fork download
  1. road(durango,redville).
  2. road(redville,durango).
  3. road(redville,hardwick).
  4. road(hardwick,redville).
  5. road(hardwick,newton).
  6. road(newton,hardwick).
  7. road(newton,burr).
  8. road(burr,newton).
  9. road(newton,hallsburg).
  10. road(hallsburg,newton).
  11. road(newton,burlington).
  12. road(burlington,newton).
  13. road(hallsburg,burlington).
  14. road(burlington,hallsburg).
Success #stdin #stdout 0.02s 6204KB
stdin
that returns all the cities that can be visited in "two hops" if you begin your trip from burr.
road(burr, First), road(First, Second), format('~w can be visited in two hops from burr.\n', Second), fail.
stdout
hardwick can be visited in two hops from burr.
burr can be visited in two hops from burr.
hallsburg can be visited in two hops from burr.
burlington can be visited in two hops from burr.