Sha256: 4700cd44bfb364c22c45b659c45a05843dda29a56f50748339be9a41a257a79f

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

require_relative '../shared/player'

module MM
  class ComputerPlayerExpert < Shared::Player
    def make_move(game)
      @game = game
      computer_choosing_graphic
      smart_move
    end

    def smart_move
      secret_code = current_result_partial_match_values.concat(current_result_exact_match_values)
      (4-(secret_code.size)).times do
        secret_code.push((1..6).to_a.sample)
      end
      secret_code.shuffle
    end

    def computer_choosing_graphic
      @game.computer_choosing_graphic
    end

    def current_result_partial_match_values
      @game.current_result_partial_match_values
    end

    def current_result_exact_match_values
      @game.current_result_exact_match_values
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
games_bfox-0.4.0 lib/games/mastermind/computer_player_expert.rb