lib/games/shared/game.rb in games_bfox-0.4.0 vs lib/games/shared/game.rb in games_bfox-0.6.0
- old
+ new
@@ -1,18 +1,14 @@
-Dir[File.join(File.dirname(__FILE__), '*.rb')].each {|file| require file }
-# note the below exclude the game subclasses, because these classes inherit from this class, so if we require these before the parent class is read, an error will be generated.
-Dir[File.join(File.expand_path("..", File.dirname(__FILE__)), 'tictactoe', '*.rb')].each {|file| require file unless file == File.join(File.expand_path("..", File.dirname(__FILE__)), 'tictactoe', 'game.rb')}
-Dir[File.join(File.expand_path("..", File.dirname(__FILE__)), 'mastermind', '*.rb')].each {|file| require file unless file == File.join(File.expand_path("..", File.dirname(__FILE__)), 'mastermind', 'game.rb')}
+require File.join('games', 'tictactoe', 'computer_player_expert')
module Shared
class Game
attr_accessor :board, :board_presenter, :board_builder
attr_accessor :players, :players_factory
attr_accessor :number_of_turns_taken, :won_flag
attr_reader :io_helpers
-
def initialize(args = {})
@board_presenter = args.fetch(:board_presenter)
@io_helpers = args.fetch(:io_helpers)
@board_builder = args.fetch(:board_builder)
@@ -60,10 +56,10 @@
end
def winner
#each move is immediately proceeded by an increment to number_of_selections_made; therefore, need to rewind won to find winner
if !won?
- return nil
+ nil
end
current_player
end
def display_values