title: Row number in 0x88 chess board representation.
body: <p>I'm making a function that returns True if a move is pseudo legal. The problem is that, in order to find out if the pawn is at it's starting position, i have to loop all the squares in this row and see if the square the pawn is at, is in that range. Is there a better way to do this ? Can i somehow calculate the row number at which the pawn is on or something ? </p>
  
  <pre><code># Pawn.
      if piece == PAWN:
          if not from_piece &amp; 8: # White pawn.
              if start_point &lt; end_point: # Can't move backwards.
                  return False
              elif diff == 32 and start_point in range(96, 104) and not board[start_point - 16] and not board[end_point]:
                  pass # Valid case, skip next elif statement. Can move 2 spaces at the starting position. 
              elif diff != 16:
                  return False 
  
          else: # Black pawn.
              if start_point &gt; end_point: # Can't move backwards.
                  return False
              elif diff == 32 and start_point in range(16, 24) and not board[end_point + 16] and not board[end_point]:
                  pass # Valid case, skip next elif statement. Can move 2 spaces at the starting position. 
              elif diff != 16:
                  return False 
  
          if diff == 16 and board[end_point]: # Can't move ahead one square if there's already a piece.
              return False 
          elif (diff == 15 or diff == 17) and board[end_point]: # Can't move one step diagonal when there's no enemy piece. 
              return False
  return True 
  </code></pre>
  
  <p>I made the program so that white pawn has the value 1 and black pawn has the value 9. Empty square is represented by 0. </p>
  
  <p>Thank you very much. </p>