Skip to content
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

Day 2 Homework #2

Closed
wants to merge 2 commits into from
Closed

Day 2 Homework #2

wants to merge 2 commits into from

Conversation

nullthreat
Copy link

So i know i didn't do this like the others. I had planned on doing the extra credit tonight so I started refactoring it in ways it would be easer to add the planned features later. I added a private fight! method that will run all 13 rounds and add the winner to an array. To decide who won the match i search the array for the number of times that fighters name is in the winner array.

I look forward to seeing how some of the other, more proficient developers solve this problem.


def fight!
round_num = 1
@turns.select do |turn|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You used a #select here ... I think an #each would work better... A select is used to reduce the array down by returning true/false to use again later.

@jwo
Copy link
Member

jwo commented May 3, 2012

I think you have a good start here.... The only thing I'd recommend is rather than "puts" out the result, I'd like to be able to replay them again.... So be able to do (after you've fought)

match.turns.each do |turn|
  puts turn.result
end

Or something similar

@jwo jwo closed this Aug 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants