Created
March 30, 2016 21:54
-
-
Save pshushereba/3aa5abf89fc112138a3709ba3865a706 to your computer and use it in GitHub Desktop.
Revisions
-
pshushereba revised this gist
Mar 30, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,6 @@ def distance(destination_row, destination_col) return (destination_col - current_column_index).abs # destination_col - current_row_index else puts "Invalid Input" end end -
pshushereba created this gist
Mar 30, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ def distance(destination_row, destination_col) if self.vertical?(destination_row, destination_col) return (destination_row - current_row_index).abs elsif self.horizontal?(destination_row, destination_col) return (destination_col - current_column_index).abs elsif self.diagonal?(destination_row, destination_col) return (destination_col - current_column_index).abs # destination_col - current_row_index else puts "Invalid Inputs" end end