search.rb
# Creates data used from the stump of the move tree, flags illegal moves
Creates data used from the stump of the move tree, flags illegal moves
Creates data used from the stump of the move tree flags illegal moves
def make_root
    @ply, @mv_n, @root = 1, 1, 1
    generate_moves(false)
    @root_n = @mv_n
    @mv_fen, @mv_san, @mv_type = Array.new(@root_n) { '' }, Array.new(@root_n) { '' }, Array.new(@root_n) { '' }
    @mv_legal = Array.new(@root_n) { true }
    fen_history = @history.first(6).map { |m| m.split.first }
    1.upto(@root_n - 1) do |i|
      @root, @on_mv[1] = @mv_idx[i], @mv_idx[i]
      if make_move
        @mv_fen[@root], @mv_san[@root] = make_fen(@root), make_san(@mv[@root])
        @mv_type[@root] = make_type(@mv_san[@root])
        unmake_move
        @mv_legal[@root] = false if fen_history.count(@mv_fen[@root].split.first) > 1 || @mv[@root].half_moves > 50
      else
        @mv_legal[@root] = false
      end
    end
    nil
  end
def make_root @ply , @mv_n , @root = 1 , 1 , 1 generate_moves ( false ) @root_n = @mv_n @mv_fen , @mv_san , @mv_type = Array . new ( @root_n ) { '' } , Array . new ( @root_n ) { '' } , Array . new ( @root_n ) { '' } @mv_legal = Array . new ( @root_n ) { true } fen_history = @history . first ( 6 ) . map { | m | m . split . first } 1 . upto ( @root_n - 1 ) do | i | @root , @on_mv [ 1 ] = @mv_idx [ i ] , @mv_idx [ i ] if make_move @mv_fen [ @root ] , @mv_san [ @root ] = make_fen ( @root ) , make_san ( @mv [ @root ] ) @mv_type [ @root ] = make_type ( @mv_san [ @root ] ) unmake_move @mv_legal [ @root ] = false if fen_history . count ( @mv_fen [ @root ] . split . first ) > 1 || @mv [ @root ] . half_moves > 50 else @mv_legal [ @root ] = false end end nil end
Creates data used from the stump of the move tree, flags illegal moves
Creates data used from the stump of the move tree flags illegal moves