diff --git a/lib/match.rb b/lib/match.rb index 3d171bc..05c357a 100644 --- a/lib/match.rb +++ b/lib/match.rb @@ -7,6 +7,8 @@ def initialize(opponent_a, opponent_b) @opponent_a = opponent_a @opponent_b = opponent_b @turns = build_turns + @fighter_a = fighter_a + @fighter_b = fighter_b end def opponents diff --git a/superfight.rb b/superfight.rb index 081a711..2efe65e 100644 --- a/superfight.rb +++ b/superfight.rb @@ -2,10 +2,58 @@ puts "What is your first fighter's name?" -fighter_a = $stdin.gets +@fighter_a = $stdin.gets puts "What is your second fighter's name?" -fighter_b = $stdin.gets +@fighter_b = $stdin.gets -match = Match.new(Fighter.new(fighter_a), Fighter.new(fighter_b)) +match = Match.new(Fighter.new(@fighter_a), Fighter.new(@fighter_b)).tap do + 13.times.map do + match = Match.new + if @fighter_a.strike == turn.winner + puts "Fighter A -- #{@fighter_a.name} -- won" + else + puts "Fighter B -- #{@fighter_b.name} -- won" + end + end +end puts "The winner of match is ....... #{match.winner.name}" + +# Moving away from random winners + +class Move + + attr_reader :strike, :block, :leg_sweep + + def initialize + @strike = strike + @block = block + @leg_sweep = leg_sweep + end + + def values + strike = 50 + block = 40 + leg_sweep = 60 + end + + def moves + move = Move.new + # test + move.values{strike: 50, block: 40, leg_sweep: 60} + puts moves.values.to_i + + end +end + +match = Match.new(Fighter.new(@fighter_a), Fighter.new(@fighter_b)) do + 13.times.map do + match = Match.new + if @fighter_a.moves > @fighter_b.moves + puts "Fighter A -- #{@fighter_a.name} -- won" + else + puts "Fighter B -- #{@fighter_b.name} -- won" + end + end +end +