5 filename="${1:-small-example-p1_10.txt}"
11 while read -u 3 line; do
15 # we actually want it to go both ways, so we'll
17 if [ "${links[$a]+abc}" ]; then
23 if [ "${links[$b]+abc}" ]; then
35 local -a previous_points=("$@")
36 local -a new_previous_path=()
39 local -A __previous_points
41 for temp_point in "${previous_points[@]}"; do
42 __previous_points[$temp_point]=1
45 path="${previous_points[@]}"
47 if [ "${point}" == "${point,,}" ]; then
48 # if it's lower case, and we've already been there
50 if [ "${__previous_points[$point]+abc}" ]; then
55 if [ "${point}" == "end" ]; then
57 if [ ! "${paths[$path]+abc}" ]; then
61 new_previous_path=("${previous_points[@]}")
62 new_previous_path+=($point)
63 for new_point in ${links[$point]}; do
64 do_path $new_point "${new_previous_path[@]}"
69 # start at start and then work through all possible paths
70 for thing in ${links["start"]}; do
74 for path in "${!paths[@]}"; do
75 echo "Got path: $path"
78 echo "Total paths: ${#paths[@]}"