title: Troubles with classes and inheritance in Python chess game
body: <p>Please help me to understand</p>
  <p>I have a tuple like this</p>
  <p>Board : tuple[int, list[Piece]]</p>
  <p>which contains the size of the board and objects of pieces, their coordinated and if they are True (white side or _side) or False (Black side)</p>
  <p>One of the step it is to check if there is a piece on the cell and also check if this piece belongs to the same side as it then cannot move there.</p>
  <p>Outside the functions I can create and check the objects like this R1.side_ and I can compare them, but what about inside the Class?</p>
  <p>The function is_piece_at can easily tell me if there is a piece at this location, but I cannot work out how to check the side of piece inside the Class.</p>
  <pre><code>class Piece:
      pos_x : int 
      pos_y : int
      side_ : bool #True for White and False for Black
      def __init__(self, pos_X : int, pos_Y : int, side_ : bool):
          '''sets initial values'''
          self.pos_x=pos_X 
          self.pos_y=pos_Y
          self.side_=side_ #maybe set it to True?
      def __str__(self):#
          return f&quot;{self.pos_x} {self.pos_y} {self.side_}&quot;
  </code></pre>
  <pre><code>
  class Rook(Piece):
      def __init__(self, pos_X : int, pos_Y : int, side_ : bool):
          '''sets initial values by calling the constructor of Piece'''
          super().__init__(pos_X, pos_Y, side_)
  
  
      def can_reach(self, pos_X : int, pos_Y : int, B: Board) -&gt; bool:
          '''
          checks if this rook can move to coordinates pos_X, pos_Y
          on board B according to rule [vertical and Horizontal move] and 
          [Rule4] A piece of side X (Black or White) cannot move to a location occupied by a piece of side X.] (see section Intro)
          Hint: use is_piece_at
          '''
  </code></pre>
  <pre><code>def is_piece_at(pos_X : int, pos_Y : int, B: Board) -&gt; bool:
      '''checks if there is piece at coordinates pox_X, pos_Y of board B''' 
      # B sarà del tipo [dimensione, [pezzo1, pezzo2, pezzo3, ...]]
      if (pos_X &gt; B[0] or pos_Y &gt; B[0]) :
        return False # o in alternativa un raise exception
      for piece in B[1] :
        if (piece.pos_x == pos_X and piece.pos_y == pos_Y) :
          return True
      return False
  </code></pre>
  <pre><code>
  R0=Rook(1,1,True)
  R1=Rook(2,2,False)
  R2=Rook(3,3,False)
  t.append(R0)
  t.append(R1)
  t.append(R2)
  Board=[5,t]
  Board
  </code></pre>
  <pre><code>R1.side_==R0.side_
  R1.pos_x
  
  </code></pre>