Add PGN class for writing PGN files.
[kaya.git] / lib / games / chess / main.rb
blob56035512f0e74bb94c8912c2df769fe00e30d77e
1 require 'games/games'
2 require 'games/chess/state'
3 require 'games/chess/move'
4 require 'games/chess/board'
5 require 'games/chess/policy'
6 require 'games/chess/animator'
7 require 'games/chess/validator'
8 require 'games/chess/serializer'
9 require 'games/chess/pgn'
11 module Chess
13 Game.add :chess do
14   Game.new :size => Point.new(8, 8),
15            :policy => Policy.new(Move),
16            :state_component => State,
17            :state => lambda { state_component.new(board.new, move, piece) },
18            :board_component => Board,
19            :board => lambda { board_component.new(size) },
20            :move => Move,
21            :animator => Animator,
22            :validator => Validator,
23            :piece => Piece,
24            :players => [:white, :black],
25            :serializer => lambda {|rep| 
26               Serializer.new(rep, validator, move, piece) },
27            :keywords => %w(chess),
28            :game_writer_component => PGN,
29            :game_writer => lambda { 
30               game_writer_component.new(serializer.new(:compact)) }
31 end
33 Game.add :chess5x5, [:chess] do |chess|
34   chess.extend(:size => Point.new(5, 5))
35 end
37 end