Sha256: 5efa8d46539f58c24bf090b7e02ba2495e88eaf083c31ed9605ced556895df6d
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
# -*- compile-command: "rake v" -*- module Bioshogi module Analysis class TacticValidator def call @rows = TacticInfo.all_elements.flat_map do |e| e.reference_files.collect do |file| SingleValidator.new(e, file).call end end puts tp @rows puts success? ? "OK" : "ERROR" tp errors end def errors @errors ||= @rows.find_all { |e| e["合致"] == "ERROR" } end def success? errors.none? end private class SingleValidator def initialize(item, file) @item = item @file = file end def call row = { "合致" => "", key: @item.key } if @file row[:file] = @file.basename.to_s str = @file.read info = Parser.parse(str) info.formatter.container_run_once info.formatter.container.players.each do |player| keys = player.skill_set.list_of(@item).normalize.collect(&:key) row[player.location.key] = keys end info.formatter.container.players.each do |player| if row[player.location.key].include?(@item.key) row["合致"] += player.location.mark end end end if row["合致"].blank? row["合致"] = "ERROR" end print row["合致"] == "ERROR" ? "E" : "." row end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bioshogi-0.0.15 | lib/bioshogi/analysis/tactic_validator.rb |
bioshogi-0.0.14 | lib/bioshogi/analysis/tactic_validator.rb |