Advertisement
Guest User

(Kizim_Chika)--Bishop--

a guest
Apr 7th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. class Figure:
  2.     def __init__(self, row, col, color):
  3.         self.row = row
  4.         self.col = col
  5.         self.color = color
  6.  
  7.     def set_position(self, row, col):
  8.         self.row = row
  9.         self.col = col
  10.        
  11.     def get_color(self):
  12.         return self.color
  13.      
  14.     def correct_move(self, row, col):
  15.         return 0 <= row < 8 and 0 <= col < 8
  16.      
  17. class Bishop(Figure):
  18.     def char(self):
  19.         return 'B'
  20.  
  21.     def can_move(self, row, col):
  22.         if self.correct_move(row, col) and abs(self.row - row) == abs(self.col - col):
  23.             return True
  24.         return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement