wes d2a2ba9e15 first commit | před 4 roky | |
---|---|---|
.. | ||
README.md | před 4 roky | |
code.cpp | před 4 roky | |
unitTest.cpp | před 4 roky |
by Matt tags: games, logic, algorithms, validation
Create a function that takes the name of a chess piece, its position and a target position. The function should return true if the piece can move to the target and false if it can't. The possible inputs are "Pawn", "Knight", "Bishop", "Rook", "Queen" and "King". Examples canMove("Rook", "A8", "H8") ➞ true canMove("Bishop", "A7", "G1") ➞ true canMove("Queen
Create a function that takes the name of a chess piece, its position and a target position. The function should return true
if the piece can move to the target and false
if it can't.
The possible inputs are "Pawn", "Knight", "Bishop", "Rook", "Queen" and "King".
canMove("Rook", "A8", "H8") ➞ true
canMove("Bishop", "A7", "G1") ➞ true
canMove("Queen", "C4", "D6") ➞ false