lib/game_execution.rb
#Asks each Player to take a decision number_of_times times, and returns the results
Asks each Player to take a decision number_of_times times, and returns the results
Asks each Player to take a decision number_of_times times and returns the results
def play(number_of_times = 1)
    result = GameExecutionResult.new
    number_of_times.times {|i|
      moves = []
      strategies.each do |strategy|
        move = strategy.play
        moves << move
        result.individual_results[strategy].moves << move 
      end
      pay_offs = game.get_payoff(moves)
      strategies.each_with_index { |strategy,i|
        result.individual_results[strategy].payoffs << pay_offs[i]
      }
    }
    return result
  end
def play ( number_of_times = 1 ) result = GameExecutionResult . new number_of_times . times { | i | moves = [ ] strategies . each do | strategy | move = strategy . play moves << move result . individual_results [ strategy ] . moves << move end pay_offs = game . get_payoff ( moves ) strategies . each_with_index { | strategy , i | result . individual_results [ strategy ] . payoffs << pay_offs [ i ] } } return result end
Asks each Player to take a decision number_of_times times, and returns the results
Asks each Player to take a decision number_of_times times and returns the results
number_of_times