Sha256: ad43d9803f0749c016579f8fc6d396430307a53d3c59ac0b148cf305f106bf0d
Contents?: true
Size: 905 Bytes
Versions: 2
Compression:
Stored size: 905 Bytes
Contents
module Linotype class Simulator attr_accessor :player_one, :player_two, :game def initialize(strategy_one, strategy_two) self.player_one = Player.new(strategy: strategy_one) self.player_two = Player.new(strategy: strategy_two) end def simulate! self.game = Game.new(player_one: player_one, player_two: player_two) puts "Let's start the simulator" while !game.over? if best_next_play = game.best_next_play puts "Player #{game.player_number(game.current_player)} will play: #{best_next_play.word}" game.play(*best_next_play.to_hash[:coordinates]) else puts "Player #{game.player_number(game.current_player)} will pass." game.play end game.print_board game.print_scores puts "---------------" end puts "Game Over!" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
linotype-0.0.6 | lib/linotype/simulator.rb |
linotype-0.0.5 | lib/linotype/simulator.rb |