6 basedir=$(dirname $(readlink -f ${BASH_SOURCE}))
10 filename=${1:-$basedir/3_4_8.txt}
17 debug_line=true # default to not actually outputting any debug info
19 if [ ${DEBUG:-0} -gt 0 ]; then
28 # lets be silly and use the stuff from zap to build the lists instead
32 total_asts=${#asteroids[@]}
33 for asteroid in ${!asteroids[@]}; do
34 percent=$((100*$cur_ast_num / $total_asts))
35 printf '\r%02d%% complete' $percent
37 # get a full list of angles for each other asteroid
38 declare -A asteroid_angles
39 for asteroid2 in ${!asteroids[@]}; do
40 if [ $asteroid == $asteroid2 ]; then
44 angle=$(get_angle $asteroid $asteroid2)
45 asteroid_angles[$angle]=1
47 count=${#asteroid_angles[@]}
48 if [ $count -gt $best_count ]; then
52 asteroid[$asteroid]=${#asteroid_angles[@]}
54 cur_ast_num=$((cur_ast_num+1))
58 echo "Found $best_ast with $best_count asteroids"