Sha256: d424513098f61bd4830801ed1b9fe20680afebd33ade7f40ceb45b9fbefef68e

Contents?: true

Size: 625 Bytes

Versions: 10

Compression:

Stored size: 625 Bytes

Contents

module BoardEvaluation
  def evaluate
    material_evaluation + piece_location_evaluation
  end

  def material_evaluation
    white_evaluation = friendly_pieces(:white).map(&:value).sum
    black_evaluation = -friendly_pieces(:black).map(&:value).sum

    white_evaluation + black_evaluation
  end

  def piece_location_evaluation
    white_evaluation = friendly_pieces(:white).map(&:location_value).sum
    black_evaluation = -friendly_pieces(:black).map(&:location_value).sum

    white_evaluation + black_evaluation
  end

  def evaluate_move(move, color)
    provisional(move, color) do
      evaluate
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sapphire-chess-1.1.7 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.1.6 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.1.5 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.1.4 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.1.3 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.1.2 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.1.1 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.1.0 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.0.1 lib/sapphire-chess/board/board_evaluation.rb
sapphire-chess-1.0.0 lib/sapphire-chess/board/board_evaluation.rb