search.rb
# Generates a representation of a move object in standard algebraic notation
Generates a representation of a move object in standard algebraic notation
Generates a representation of a move object in standard algebraic notation
def make_san(m)
    d = (m.from - m.to).abs
    if m.piece == P
      san =
        if d % 10 == 0
          "#{SQ_ID[m.to]}"
        elsif m.target == EMPTY
          "#{SQ_ID[m.from][0]}x#{SQ_ID[m.to + DIR[m.mx]]}e.p."
        else
          "#{SQ_ID[m.from][0]}x#{SQ_ID[m.to]}"
        end
      san += "=Q" if m.to > 90 || m.to < 30
      return san
    end
    return (m.to % 10 == 3) ? "O-O-O" : "O-O" if m.piece == K && d == 2
    return "#{SAN[m.piece]}x#{SQ_ID[m.to]}" unless m.target == EMPTY
    "#{SAN[m.piece]}#{SQ_ID[m.to]}"
  end
def make_san ( m ) d = ( m . from - m . to ) . abs if m . piece == P san = if d % 10 == 0 "#{SQ_ID[m.to]}" elsif m . target == EMPTY "#{SQ_ID[m.from][0]}x#{SQ_ID[m.to + DIR[m.mx]]}e.p." else "#{SQ_ID[m.from][0]}x#{SQ_ID[m.to]}" end san += "=Q" if m . to > 90 || m . to < 30 return san end return ( m . to % 10 == 3 ) ? "O-O-O" : "O-O" if m . piece == K && d == 2 return "#{SAN[m.piece]}x#{SQ_ID[m.to]}" unless m . target == EMPTY "#{SAN[m.piece]}#{SQ_ID[m.to]}" end
Generates a representation of a move object in standard algebraic notation
Generates a representation of a move object in standard algebraic notation
m
<not_specific>