Skip to content

Commit

Permalink
Nicer rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
clowder committed Sep 15, 2011
1 parent 5930be6 commit c4cac1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/battleship/console_renderer.rb
@@ -1,6 +1,6 @@
module Battleship
class ConsoleRenderer
RESET = "\e[2J"
RESET = "\e[H\e[2J"

def initialize(output=$stdout)
@output = output
Expand Down
4 changes: 2 additions & 2 deletions play_100.rb
Expand Up @@ -9,15 +9,15 @@
winners = {}
move_counts = []

100.times do
100.times do |i|
players = ARGV[0,2].map{ |s| Module.const_get(s).new }

game = Battleship::Game.new(10, [2, 3, 3, 4, 5], *players)
until game.winner
game.tick
end

print '.'
puts "\e[H\e[2J" + "#{i + 1}"

winners[game.winner.name] ||= 0
winners[game.winner.name] += 1
Expand Down

0 comments on commit c4cac1a

Please sign in to comment.