Method: Tasks::Task.task_988
- Defined in:
- lib/tasks.rb
.task_988(horse_num:) ⇒ Object
407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/tasks.rb', line 407 def task_988(horse_num:) horse_num = horse_num.to_i return 'incorrect value' unless (1..3).cover? horse_num finish = 500 horses_run = [] 3.times { horses_run.push(rand(1..100)) } while horses_run.max < finish horses_run.map! { |x| x + rand(1..100) } end horse_place(run: horses_run, horse_num: horse_num) end |