Created
October 13, 2015 03:05
-
-
Save mattheweves/bb6993eacb16afa18b7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Knight < Piece | |
def valid_move?(x, y) | |
# Knight has no concern for obstruction, only check required is valid move of spaces. | |
return true if (self.x_position - x).abs == 2 && (self.y_position - y).abs == 1 | |
return true if (self.x_position - x).abs == 1 && (self.y_position - y).abs == 2 | |
return false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment