- # first, head left of the asteroid
- for (( x=$((start_x-1)); x>=0; x-- )); do
- do_blocker_check $asteroid $x $start_y
+ # directions:
+ # -1, 0 - left
+ # 1, 0 - right
+ # 0, 1 - up
+ # 0,-1 - down
+ # -1, 1 - diagonal left down
+ # -1,-1 - diagonal left up
+ # 1, 1 - diagonal right down
+ # 1,-1 - diagonal right up
+ for direction in -1,0 1,0 0,1 0,-1 -1,1 -1,-1 1,1 1,-1; do
+ #for direction in "-1,0" "1,0" "0,1" "0,-1"; do
+ stepx=${direction%,*}
+ stepy=${direction#*,}
+ do_blocker_check $start_x $start_y $stepx $stepy