Sha256: 36e79f9a10cb4898b9944566791ce305d9c51a82118a5b04f9aabfbdcb456d82

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

module MM
  class MoveGenerator

    attr_accessor :game

    def get_player_choice(game)
      @game = game
      get_move
    end

    def get_move
      if human?
        input_helper.get_player_choice(game)
      elsif computer?
        input_helper.computer_choosing_graphic
        computer_move
      end
    end

    def computer_move
      secret_code = []
      4.times do
        secret_code.push((1..6).to_a.sample)
      end
      secret_code
    end


    def current_player
      game.current_player
    end

    def input_helper
      game.input_helper
    end

    def human?
      game.current_player_human?
    end

    def computer?
      game.current_player_computer?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
games_bfox-0.3.0 lib/games/mastermind/move_generator.rb
games_bfox-0.2.0 lib/games/mastermind/move_generator.rb