Add accelerators.
[kaya.git] / lib / plugins / games / shogi.rb
blob69d8bf89822b4620b1260917d9d3554660a20d81
1 require 'games/shogi/state'
2 require 'games/shogi/pool'
3 require 'games/shogi/move'
4 require 'games/shogi/validator'
5 require 'games/shogi/policy'
6 require 'plugins/plugin'
7 require 'games/game_actions'
9 module Shogi
11 class Game
12   include Plugin
13   include GameActions
14   
15   plugin :name => 'Shogi',
16          :id => :shogi,
17          :interface => :game,
18          :keywords => %w(shogi),
19          :depends => [:chess]
20   
21   attr_reader :size, :state, :board, :pool,
22               :policy, :move, :animator, :validator,
23               :piece, :players, :types
24               
25   def initialize
26     @size = Point.new(9, 9)
27     @state = Factory.new { State.new(board.new, pool, move, piece) }
28     @board = Factory.new { chess.board.component.new size }
29     @pool = Pool
30     @piece = chess.piece
31     @move = Move
32     @validator = Validator
33     @animator = chess.animator
34     @policy = Factory.new(Policy) { Policy.new(move, validator, true) }
35     
36     @players = [:white, :black]
37     @types = [:pawn, :lance, :horse, :silver, 
38               :gold, :bishop, :rook, :king]
39               
40     action :autopromote, 
41            :checked => true,
42            :text => '&Promote Automatically' do |value, policy|
43       policy.autopromote = value
44     end
45   end
46 end
48 end