Question: write a program that displays a chess board. You will prompt the user for input. You will ask for the starting location (x, y) and
write a program that displays a chess board. You will prompt the user for input. You will ask for the starting location (x, y) and a height and width of the board. You will use this information to draw the chessboard (just a single chessboard). Keep in mind that it may not be a square. The user must enter the location, but if they do not enter a value for height or width you will use a default value of 250. Note, that input() returns an empty string() if the user just hits enter without giving input. Here is some code that you must use in your program. It should be placed in a main() function.
if width == "" and height == "":
drawChessboard(startX, startY)
elif height == "":
drawChessboard(startX, startY, width=eval(width))
elif width == "":
drawChessboard(startX, startY, height=eval(height))
else:
drawChessboard(startX, startY, eval(width), eval(height))
Make sure to read the rubric to see the additional requirements. Rubric 5 pts: SoftwareDevelopment Lifecycle Plan (see assn #6 for description) 5 pts: Get input properly from users. You may assume the users give valid input 5 pts: main() is the only function defined in assn9.py, which also calls main() 10 pts: Create a module called chessboard.py. This contains all of the functions associated with drawing the board 10 pts: Define drawChessboard() with appropriate parameters This should draw the board outline, then call drawAllRectangles() 15 pts: Define drawAllRectangles() with appropriate parameters This should handle drawing all of the black rectangles by calling drawRectangle() NOTE: It may be easiest to call this function twice, but not required 15 pts: Define drawRectangle() with appropriate parameters This should draw a single black rectangle (This will be called many times by a loop!) 10 pts: A grid of 8x8 rectangles is properly drawn with alternating black/whites rectangles Really this means to draw the black rectangles 20 pts: Proper output for any location, height and width values Height and width can be different and can be blank (then use default) Note: The location should be the bottom-left corner of the chessboard 5 pts: Follow proper coding conventions Python 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
