Permalink
Browse files

The console runner has moved.

  • Loading branch information...
1 parent 6f2111c commit cc7e40cbb7d615152b3bd7d80443c77b6fcc75c0 @threedaymonk committed Oct 2, 2011
Showing with 1 addition and 35 deletions.
  1. +1 −1 README.md
  2. +0 −34 play.rb
View
@@ -84,7 +84,7 @@ The console runner
A console runner is provided. It can be started using:
- ruby play.rb path/to/player_a.rb path/to/player_b.rb
+ ruby bin/play.rb path/to/player_a.rb path/to/player_b.rb
Players are isolated using DRb.
View
34 play.rb
@@ -1,34 +0,0 @@
-$:.unshift(File.expand_path("../lib", __FILE__))
-$:.unshift(File.expand_path("../players/lib", __FILE__))
-require "battleship/game"
-require "battleship/console_renderer"
-require "stringio"
-
-DELAY = 0.2
-
-Dir[File.expand_path("../players/*.rb", __FILE__)].each do |path|
- load path
-end
-
-begin
- players = ARGV[0,2].map{ |s| Module.const_get(s).new }
- stderr = ""
- $stderr = StringIO.new(stderr)
-
- game = Battleship::Game.new(10, [2, 3, 3, 4, 5], *players)
- renderer = Battleship::DeluxeConsoleRenderer.new
- $stdout << renderer.render(game)
- $stdout << stderr
-
- until game.winner
- game.tick
- $stdout << renderer.render(game)
- $stdout << stderr
- sleep DELAY
- end
-
- puts "#{game.winner.name} won!"
-rescue Exception => e
- $stderr = STDERR
- raise e
-end

0 comments on commit cc7e40c

Please sign in to comment.