X-Git-Url: https://git.sommitrealweird.co.uk/advent-of-code-2019.git/blobdiff_plain/6db27abe8665a8a34ce1590cfe1a667bf843d7ad..7d2ab2bc1f8f0a8eb3f50644a1de5f4d3ad938d2:/day11/run2.sh diff --git a/day11/run2.sh b/day11/run2.sh index 9520560..2a650d5 100755 --- a/day11/run2.sh +++ b/day11/run2.sh @@ -14,10 +14,14 @@ base_dir=$(dirname $(readlink -f $BASH_SOURCE)) . computer.sh . robot.sh -# start the computer as a coproc coproc computer (run_program data) -while ( kill -0 $computer_PID >/dev/null 2>&1 ); do +reset_robot +set_robot_start_on_white 1 + +check_pid=$computer_PID + +while ( kill -0 $check_pid > /dev/null 2>&1 ); do get_robot_paint_colour >&${computer[1]} read -u ${computer[0]} direction read -u ${computer[0]} colour @@ -28,8 +32,5 @@ done # just incase the spinner is still about echo -n $'\r'" "$'\r' -# we've done all the painting, now lets display it +echo "Part 2:" draw_panel - -echo -echo "Painted: $(get_robot_paint_count) panels at least once"