Sha256: 2447d8f8dfa4bd4f2f6480b5e9a057c7abbf82b36a35fe63951160c0c22164b3
Contents?: true
Size: 1013 Bytes
Versions: 9
Compression:
Stored size: 1013 Bytes
Contents
# frozen-string-literal: true module Bioshogi class Player module PressureMethods # 圧力レベル def soldiers_pressure_level soldiers.sum(&:pressure_level) end # 圧力レベル(デバッグ用) def pressure_report rows = [] rows += soldiers.collect { |e| {"盤上" => e, "勢力" => e.pressure_level} } rows += piece_box.collect { |piece_key, count| piece = Piece[piece_key] { "勢力" => "#{piece.standby_level} * #{count}", "持駒" => "#{piece}#{count}", } } rows += [{"勢力" => "合計 #{pressure_level}"}] rows += [{"勢力" => "終盤率 #{pressure_rate}"}] rows += [{"勢力" => "序盤率 #{1.0 - pressure_rate}"}] rows end def pressure_level soldiers_pressure_level + piece_box.pressure_level end def pressure_rate(max = 16) pressure_level.clamp(0, max).fdiv(max) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems