def expand_move(m)
      if match = m.match(Chess::MOVE_REGEXP)
        expand = {
          name: match[1] || 'P',    # Piece name [RNBQK]
          dis: match[2],            # Disambiguating move
          to: match[3],             # Move to
          promotion: match[4],      # Promote with
        }
        expand[:from] = match[2] if match[2] && match[2].size == 2
        return expand
      elsif m =~ SHORT_CASTLING_REGEXP
        if self.board.active_color # black king short castling
          return { name: 'K', dis: nil, from: 'e8', to: 'g8', promotion: nil }
        else # white king short castling
          return { name: 'K', dis: nil, from: 'e1', to: 'g1', promotion: nil }
        end
      elsif m =~ LONG_CASTLING_REGEXP
        if self.board.active_color # black king long castling
          return { name: 'K', dis: nil, from: 'e8', to: 'c8', promotion: nil }
        else # white king long castling
          return { name: 'K', dis: nil, from: 'e1', to: 'c1', promotion: nil }
        end
      end
      raise BadNotationError.new(m)
    end
def expand_move(m)
      if match = m.match(Chess::MOVE_REGEXP)
        expand = {
          name: match[1] || 'P',    # Piece name [RNBQK]
          dis: match[2],            # Disambiguating move
          to: match[3],             # Move to
          promotion: match[4],      # Promote with
        }
        expand[:from] = match[2] if match[2] && match[2].size == 2
        return expand
      elsif m =~ SHORT_CASTLING_REGEXP
        if self.board.active_color # black king short castling
          return { name: 'K', dis: nil, from: 'e8', to: 'g8', promotion: nil }
        else # white king short castling
          return { name: 'K', dis: nil, from: 'e1', to: 'g1', promotion: nil }
        end
      elsif m =~ LONG_CASTLING_REGEXP
        if self.board.active_color # black king long castling
          return { name: 'K', dis: nil, from: 'e8', to: 'c8', promotion: nil }
        else # white king long castling
          return { name: 'K', dis: nil, from: 'e1', to: 'c1', promotion: nil }
        end
      end
      raise BadNotationError.new(m)
    end
Expand the short algebraic chess notation string `m` in a hash like this:

     Ngxe2 ==> { name: 'N', dis: 'g', from: nil, to: 'e2', promotion: nil }