examples/itchy.rb in dcell-0.16.0 vs examples/itchy.rb in dcell-0.16.1
- old
+ new
@@ -1,24 +1,25 @@
#!/usr/bin/env ruby
require 'dcell'
-DCell.start :id => "itchy", :addr => "tcp://127.0.0.1:9001"
+DCell.start :id => "itchy"
class Itchy
include Celluloid
def initialize
puts "Ready for mayhem!"
@n = 0
end
def fight
- @n = (@n % 6) + 1
- if @n <= 3
+ @n += 1
+ if @n % 6 == 0
puts "Bite!"
else
puts "Fight!"
end
+ @n
end
end
Itchy.supervise_as :itchy
sleep