lib/basketball/drafting/cli.rb in basketball-0.0.4 vs lib/basketball/drafting/cli.rb in basketball-0.0.5

- old
+ new

@@ -44,19 +44,23 @@ io.puts('Status') if engine.done? io.puts('Draft is complete!') else + current_round = engine.current_round + current_round_pick = engine.current_round_pick + current_front_office = engine.current_front_office + io.puts("#{engine.remaining_picks} Remaining pick(s)") - io.puts("Up Next: Round #{engine.current_round} pick #{engine.current_round_pick} for #{engine.current_team}") + io.puts("Up Next: Round #{current_round} pick #{current_round_pick} for #{current_front_office}") end write(engine) log(engine) - rosters(engine) + league(engine) query(engine) self end @@ -73,11 +77,11 @@ o.integer '-s', '--simulate', 'Number of picks to simulate (default is 0).', default: 0 o.bool '-a', '--simulate-all', 'Simulate the rest of the draft', default: false o.array '-p', '--picks', 'Comma-separated list of ordered player IDs to pick.', delimiter: ',' o.integer '-t', '--top', 'Output the top rated available players (default is 0).', default: 0 o.string '-q', '--query', "Filter TOP by position: #{Position::ALL_VALUES.join(', ')}." - o.bool '-r', '--rosters', 'Output all team rosters.', default: false + o.bool '-r', '--rosters', 'Output all front_office rosters.', default: false o.integer '-x', '--skip', 'Number of picks to skip (default is 0).', default: 0 o.bool '-l', '--log', 'Output event log.', default: false o.on '-h', '--help', 'Print out help, like this is doing right now.' do io.puts(o) @@ -86,23 +90,23 @@ end.to_h end def load_engine if opts[:input].to_s.empty? - io.puts('Input path was not provided, generating fresh teams and players') + io.puts('Input path was not provided, generating fresh front_offices and players') generate_draft else io.puts("Draft loaded from: #{opts[:input]}") read end end def generate_draft - teams = 30.times.map do |i| - Team.new( + front_offices = 30.times.map do |i| + FrontOffice.new( id: "T-#{i + 1}", name: Faker::Team.name ) end players = 450.times.map do |i| @@ -113,21 +117,17 @@ position: Position.random, overall: (0..100).to_a.sample ) end - Engine.new(players:, teams:) + Engine.new(players:, front_offices:) end - def rosters(engine) + def league(engine) return unless opts[:rosters] io.puts - io.puts('Rosters') - - engine.rosters.each do |roster| - io.puts(roster) - end + io.puts(engine.to_league) end def log(engine) return unless opts[:log]