Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bishopAndPawn(bishop, pawn)
- if bishop[0] == 'a' then
- bishop_first_value = 1
- end
- if bishop[0] == 'b' then
- bishop_first_value = 2
- end
- if bishop[0] == 'c' then
- bishop_first_value = 3
- end
- if bishop[0] == 'd' then
- bishop_first_value = 4
- end
- if bishop[0] == 'e' then
- bishop_first_value = 5
- end
- if bishop[0] == 'f' then
- bishop_first_value = 6
- end
- if bishop[0] == 'g' then
- bishop_first_value = 7
- end
- if bishop[0] == 'h' then
- bishop_first_value = 8
- end
- bishop_second_value = bishop[1].to_i
- if pawn[0] == 'a' then
- pawn_first_value = 1
- end
- if pawn[0] == 'b' then
- pawn_first_value = 2
- end
- if pawn[0] == 'c' then
- pawn_first_value = 3
- end
- if pawn[0] == 'd' then
- pawn_first_value = 4
- end
- if pawn[0] == 'e' then
- pawn_first_value = 5
- end
- if pawn[0] == 'f' then
- pawn_first_value = 6
- end
- if pawn[0] == 'g' then
- pawn_first_value = 7
- end
- if pawn[0] == 'h' then
- pawn_first_value = 8
- end
- pawn_second_value = pawn[1].to_i
- if (bishop_first_value - pawn_first_value).abs == (bishop_second_value - pawn_second_value).abs then
- return true
- else
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment