Add licence and installation instructions.
[kaya.git] / lib / ics / icsplayer.rb
blob10abdb7ba662072cc77678f87b4484207e1b36f5
1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 require 'interaction/match'
10 module ICS
12 class ICSPlayer
13   include Player
14   include Observer
15   
16   attr_reader :color, :name
17   
18   # create a new ICS player playing with
19   # the given color and using the given
20   # output channel to send moves
21   def initialize(out, color, serializer, name)
22     @color = color
23     @out = out
24     @serializer = serializer
25     @name = name
26   end
28   def on_move(data)
29     text = @serializer.serialize(data[:move], data[:old_state])
30     @out[text]
31   end
32 end
34 end