Question: For Assignment 1 , you drew a 4 x 4 checkerboard of black - and - white squares. Back then, the code to do this
For Assignment you drew a x checkerboard of blackandwhite squares. Back then, the code to do this
was rather tedious; you needed to write a call to rect for every square or maybe for every nd square,
depending on your approach on the board.
For this question, you will revisit this problem by drawing a fullsized x checkerboard on the canvas. But
this time, you will use loops to do it
Figure : An x black and white checkerboard
Your task is to draw a x black and white checkerboard in Processing that fills the entire space of a
x pixel canvas. Have the topleft most tile coloured white like in the figure. Your solution is not an
interactive program, so you wont need to use functions like setup or draw
For this question, you must use loops to draw the checkerboard. Your code itself should contain only a
single call to the rect function. Use loops and extra variables as needed to keep track of a where to
draw the current square, and b what color the current square should be black or white
Hint: When you did this question for A you may have used setting the background color to either
white or black as a shortcut to avoid extra calls to rect Now that you are using loops, you will
probably find that same shortcut just makes your logic more complicated to follow and wont make
your code any shorter anyway so you might want to avoid it Its up to you though
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
