implemented defn path-count-with-traps.