File names: color_square.py, chessboard.py, test_squares.py Positions on a chess board are identified by a letter and a number. The letter identifies the column; the number identifies the row. See the image below. You will provide the functions that allow us to determine: if a chessboard square is either black or white, given its coordinates. If the row/column is valid or not for the standard chessboard For example, if we pass in “d” for the column and 4 for the row, your function that determines color should return the string: “BLACK”. If we pass in "k" for the column to your function that validates columns, that function should return the boolean False. Requirements: Your function for validating the column should be able to accept upper or lowercase strings as parameters. Your functions for validating the row should be able to accept integers or strings as parameters. Your function that determines black-or-white may assume that the input has been validated prior to us calling it (that is a precondition) and should return the string "BLACK" or "WHITE" based on the row/column values passed in You must provide three “helper functions”. Two of those functions: check_valid_row( row ) and check_valid_column( column ) must be defined in the file chessboard.py: The third function: black_or_white(row, column) must be defined in the file color_square.py check_valid_row and check_valid_column both return a boolean – True if the row or column passed in is valid, False if not. Remember to define these functions in a chessboard.py. We will run auto-tests on these functions, so be sure to name them properly and place them in the correct files. You must write test function for check_valid_row() and check_valid_column(). Your test functions should validate a few "normal" scenarios as well as one or two "out of bounds" situations for the rows and columns. You may name your test functions whatever you wish, but you must define them in a file named test_squares.py. In this same file, also include a function called test_squares() that acts as the "test driver" and calls your two test functions. Our auto-grader will use this function to interact with your test suite. You have flexibility in how you present your test results, but conciseness and ease-of-readability (or lack thereof) will influence your grade. Here's an example of what you might consider producing: ... Your grade for this part of the assignment will be based on your solution code, your test functions provided and our own test suite, as well as manual inspection of your solution code for other rubric items (documentation, efficiency, etc.). No main() is required for this assignment. NO FLOWCHART is required. Of course, you are writing the test suite, so you'll need to think through the test cases. Resources: You might find the built-in ord() and chr() functions, as well as an ASCII table of characters helpful for this part of the assignment.
- File names: color_square.py, chessboard.py, test_squares.py
Positions on a chess board are identified by a letter and a number. The letter identifies the column; the number identifies the row. See the image below.
You will provide the functions that allow us to determine:
- if a chessboard square is either black or white, given its coordinates.
- If the row/column is valid or not for the standard chessboard
For example, if we pass in “d” for the column and 4 for the row, your function that determines color should return the string: “BLACK”. If we pass in "k" for the column to your function that validates columns, that function should return the boolean False.
Requirements:
- Your function for validating the column should be able to accept upper or lowercase strings as parameters.
- Your functions for validating the row should be able to accept integers or strings as parameters.
- Your function that determines black-or-white may assume that the input has been validated prior to us calling it (that is a precondition) and should return the string "BLACK" or "WHITE" based on the row/column values passed in
- You must provide three “helper functions”. Two of those functions:
- check_valid_row( row ) and
- check_valid_column( column )
must be defined in the file chessboard.py:
The third function: black_or_white(row, column) must be defined in the file color_square.py
- check_valid_row and check_valid_column both return a boolean – True if the row or column passed in is valid, False if not.
Remember to define these functions in a chessboard.py. We will run auto-tests on these functions, so be sure to name them properly and place them in the correct files. - You must write test function for check_valid_row() and check_valid_column(). Your test functions should validate a few "normal" scenarios as well as one or two "out of bounds" situations for the rows and columns. You may name your test functions whatever you wish, but you must define them in a file named test_squares.py. In this same file, also include a function called test_squares() that acts as the "test driver" and calls your two test functions. Our auto-grader will use this function to interact with your test suite.
You have flexibility in how you present your test results, but conciseness and ease-of-readability (or lack thereof) will influence your grade. Here's an example of what you might consider producing:
...
Your grade for this part of the assignment will be based on your solution code, your test functions provided and our own test suite, as well as manual inspection of your solution code for other rubric items (documentation, efficiency, etc.).
No main() is required for this assignment.
NO FLOWCHART is required. Of course, you are writing the test suite, so you'll need to think through the test cases.
Resources: You might find the built-in ord() and chr() functions, as well as an ASCII table of characters helpful for this part of the assignment.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 7 images