Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language: Python Program: Processing 3.0 I have this so far, but it doesn't look right: ##### size (300, 300) background(0) for a in range(10): for

Language: Python

Program: Processing 3.0

image text in transcribed

I have this so far, but it doesn't look right:

#####

size (300, 300) background(0)

for a in range(10): for b in range (10): rect(a*60, b*60, 30, 30)

#####

Output:

image text in transcribed

For Assignment 1, you drew a 4x4 checkerboard of black-and-white 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 2nd square depending on your approach) on the board For this question, you will revisit this problem by drawing a full-sized 8x8 checkerboard on the canvas. But this time, you will use loops to do it. Figure 1: An 8x8 black and white checkerboard Your task is to draw a 8x8 black and white checkerboard in Processing that fills the entire space of a 200x200 pixel canvas. Have the top-left most tile coloured white like in the figure. Your solution is not an interactive program, so you won't 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 A1, 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 won't make your code any shorter anyway), so you might want to avoid it It's up to you though

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions