Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 1 0 0 Marks there are no other pieces on the board ) . A move is valid if the plece can move
Question
Marks there are no other pieces on the board A move is valid if the plece can move folls within the fol squares of the board, labeled from to horizontally and to vertically. A move from to means that the piece intends to move from the upper left corner of the board to the lower right corner.
For the purposes of testing, the order of the horizontalvertical board positions may be transposed and are equal and you must perform error checking on the input to ensure it is within the range of the board.
You should handle the following pieces in your implementation, with each piece's implementation being worth marks: King, Queen, Bishop, Rook Castle Knight Horse
Before you begin, think about valuable functions to build. Small parts of the more extensive program that you can extract that you will need for all the pieces. You should have one helper function for each piece named as you choose, with parameters of your choosing and other functions as you see fit.
The final marks will be allocated to:
checking for proper positions
controlling for alternate inputs a vs a
controlling for other incorrect inputsaaaa', hhhh
incorrect input should return False
def ismovevalidpiece:str currentlocation:str destination:str bool:
# YOUR IMPLEMENTATION
Examples of the function running should appear as follows:
ismovevalidQueenaa
True
ismovevalidqueen:
True
ismovevalidkingAC
False
ismovevalidknightAC
True
ismovevalidknightAAC # AA is an invalid position
False
ismovevalidknightAC # c is an invalid square
False
ismovevalidhammerAA # a hammer is not a piece
False
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started