def possible_moves(p1, manifest, castling = false)
      return [] if manifest[p1][:type].nil?

      allowed   = []
      type      = manifest[p1][:type]
      my_color  = manifest[p1][:color]

      constants(manifest, my_color, type)

      return [] if unoccupied?(p1)

      if type == :king
        allowed += [move_lateral(p1, 1)].flatten
        allowed += [move_diagonal(p1, 1)].flatten
        allowed += [castle(p1)].flatten if castling

      elsif type == :queen
        allowed += [move_lateral(p1)].flatten
        allowed += [move_diagonal(p1)].flatten

      elsif type == :rook
        allowed += [move_lateral(p1)].flatten

      elsif type == :bishop
        allowed += [move_diagonal(p1)].flatten

      elsif type == :pawn
        allowed += [move_pawn(p1)].flatten

      elsif type == :knight
        allowed += [move_knight(p1)].flatten
      end

      allowed
    end
def possible_moves(p1, manifest, castling = false)
      return [] if manifest[p1][:type].nil?

      allowed   = []
      type      = manifest[p1][:type]
      my_color  = manifest[p1][:color]

      constants(manifest, my_color, type)

      return [] if unoccupied?(p1)

      if type == :king
        allowed += [move_lateral(p1, 1)].flatten
        allowed += [move_diagonal(p1, 1)].flatten
        allowed += [castle(p1)].flatten if castling

      elsif type == :queen
        allowed += [move_lateral(p1)].flatten
        allowed += [move_diagonal(p1)].flatten

      elsif type == :rook
        allowed += [move_lateral(p1)].flatten

      elsif type == :bishop
        allowed += [move_diagonal(p1)].flatten

      elsif type == :pawn
        allowed += [move_pawn(p1)].flatten

      elsif type == :knight
        allowed += [move_knight(p1)].flatten
      end

      allowed
    end
Calls methods below to return a list of positions which are valid moves
 for piece at index p1, given the current board layout as defined in manifest