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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
  • 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:

  1. if a chessboard square is either black or white, given its coordinates.
  2. 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 stringBLACK”. 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.

Column: i, Expected: False, Actual: False
Column: A, Expected: True, Actual: True
Column: B, Expected: True, Actual: True
Row: 1, Expected: True, Actual: True
Row: 2, Expected: True, Actual: True
Row: 3, Expected: True, Actual: True
Transcribed Image Text:Column: i, Expected: False, Actual: False Column: A, Expected: True, Actual: True Column: B, Expected: True, Actual: True Row: 1, Expected: True, Actual: True Row: 2, Expected: True, Actual: True Row: 3, Expected: True, Actual: True
NwA sa v ∞
1
a b c d e f g h
Transcribed Image Text:NwA sa v ∞ 1 a b c d e f g h
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 7 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education