-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A lot of questions. need to go over it again #13
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,50 @@ | |
|
||
|
||
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 moves | ||
strike = 50 | ||
block = 40 | ||
leg_sweep = 60 | ||
end | ||
end | ||
|
||
match = Match.new(Fighter.new(@fighter_a), Fighter.new(@fighter_b)) do | ||
3.times.map do | ||
match = Match.new | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A match should contain 13 rounds. Each round has a move by each player Remember, when you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. what do you mean by replay instead of looping? do you mean that there should be a line where there is a rematch instead of spitting out the same result? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean that that I should be able to view the results, and then pass the match object to you, and then you view the same results. It means you have to store the rounds in an array for the match. On Thu, Dec 12, 2013 at 7:41 PM, Mike Adeleke [email protected]
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking, maybe I should make a new method called "rounds" that has an array. I also now have a "moves" method. I can call "values" on moves and pass in the values. Is that what you were thinking? |
||
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try returning a hash here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. Im not really sure what hash that would be. Should i rewatch the video?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What hash would you need to display all of the data in your "moves" method?
On Thu, Dec 12, 2013 at 7:46 PM, Mike Adeleke [email protected]
wrote:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put in a test hash but this is something where I really am unsure.