module RubyShogi::Tactics

Constants

TACTICS

Public Class Methods

run() click to toggle source
# File lib/ruby_shogi/tactics.rb, line 16
def Tactics.run
        puts "~~~ Tactics ~~~"
        score, total = 0, 0
        TACTICS.each do |tactic|
                engine = RubyShogi::Engine.new
                engine.printinfo = false
                engine.board.fen(tactic[0])
                engine.time = 50
                result = engine.think
                total += 1
                score += 1 if tactic[1] == result
                puts "#{total}. move #{result} | " + (tactic[1] == result ? "ok" : "error")
        end
        puts "= #{score} / #{total}"
end