Question: In Linux terminal (using C) create a Bash script that outputs a checkerboard to the terminal. The board should be 8x8 and should alternate between

 In Linux terminal (using C) create a Bash script that outputsa checkerboard to the terminal. The board should be 8x8 and shouldalternate between the black and white tiles. It should also take in

In Linux terminal (using C) create a Bash script that outputs a checkerboard to the terminal. The board should be 8x8 and should alternate between the black and white tiles. It should also take in an optional command line flag that flips the colors (i.e. white tiles become black tiles and black tiles become white tiles). # Script 1-Checkerboard DO NOT CHANGE # Constants used TILE-BLACK-"\033[0; 40m \033 [0;0m" TILE WHITE-"\033 [0:47m \033 [0;0m" SQUARES PER LINE 8 HALF_DIVISOR-2 NUM ITERATIONS 4 ERR-"\tERROR: Invalid flag given. " USAGE-"USAGE : . /checkerboard. sh [-r]" # # # DO NOT CHANGE # DO NOT CHANGE # DO NOT CHANGE # # DO NOT DO NOT CHANGE CHANGE DO NOT D0 NOT CHANGE CHANGE rotate flag-"f" # Parse command line arguments while getopts ":r" arg $@ do case $arg in # rotation wanted r) rotate flag-"t"; # Invalid flag provided ?) echo; echo -e "$ERR"; echo "$USAGE"; exit 1: esac done # Remove parsed option flags shift $( (OPTIND 1)) # YOUR CODE STARTS BELOW # FIXME: write a function that prints one row of the checkerboard. It # should look at the argument passed in to determine if it will start # by printing a white or black square. This is an optional method, but | # will help you implement the main method function printLine { # One way to define a function main() { # Another way to define a function counter 0 if [ $rotate-flag --"t" ]; then # This line creates a loop that will run NUM-ITERATIONS times until [ $counter -eq $NUM-ITERATIONS ]; do # FIXME: Use the print functions to draw two REVERSED rows of the boa rd done else until [ $counter -eq $NUM-ITERATIONS ]; do # FIXME: Use the print functions to draw two rows of the board done fi DO NOT CHANGE= main # Calls the main function to start the script up exit 0 In Linux terminal (using C) create a Bash script that outputs a checkerboard to the terminal. The board should be 8x8 and should alternate between the black and white tiles. It should also take in an optional command line flag that flips the colors (i.e. white tiles become black tiles and black tiles become white tiles). # Script 1-Checkerboard DO NOT CHANGE # Constants used TILE-BLACK-"\033[0; 40m \033 [0;0m" TILE WHITE-"\033 [0:47m \033 [0;0m" SQUARES PER LINE 8 HALF_DIVISOR-2 NUM ITERATIONS 4 ERR-"\tERROR: Invalid flag given. " USAGE-"USAGE : . /checkerboard. sh [-r]" # # # DO NOT CHANGE # DO NOT CHANGE # DO NOT CHANGE # # DO NOT DO NOT CHANGE CHANGE DO NOT D0 NOT CHANGE CHANGE rotate flag-"f" # Parse command line arguments while getopts ":r" arg $@ do case $arg in # rotation wanted r) rotate flag-"t"; # Invalid flag provided ?) echo; echo -e "$ERR"; echo "$USAGE"; exit 1: esac done # Remove parsed option flags shift $( (OPTIND 1)) # YOUR CODE STARTS BELOW # FIXME: write a function that prints one row of the checkerboard. It # should look at the argument passed in to determine if it will start # by printing a white or black square. This is an optional method, but | # will help you implement the main method function printLine { # One way to define a function main() { # Another way to define a function counter 0 if [ $rotate-flag --"t" ]; then # This line creates a loop that will run NUM-ITERATIONS times until [ $counter -eq $NUM-ITERATIONS ]; do # FIXME: Use the print functions to draw two REVERSED rows of the boa rd done else until [ $counter -eq $NUM-ITERATIONS ]; do # FIXME: Use the print functions to draw two rows of the board done fi DO NOT CHANGE= main # Calls the main function to start the script up exit 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!