-
Notifications
You must be signed in to change notification settings - Fork 34
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
Queues - Cara Comfort - stacks-queues #37
base: master
Are you sure you want to change the base?
Conversation
end | ||
|
||
def pop | ||
raise ArgumentError.new("Cannot pop an empty stack") if @store.empty? #OR self.empty? |
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.
good!
# seekers_left = job_seekers - jobs_available | ||
((jobs_available + 1)..job_seekers).each do |worker| | ||
@waiting.enqueue("Worker ##{worker}") | ||
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.
yes! nice!
@waiting.enqueue("Worker ##{worker}") | ||
end | ||
|
||
@roll |
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.
Remove this as it's not needed here
end | ||
|
||
def cycle | ||
roll |
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.
Just put the rolling method body here - it's only one line, so no need for a new method for it
|
||
# fire workers specified by the roll, removing them from the hired list | ||
# and adding them to the waiting list | ||
(1..@roll).each do |
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 think this would read cleaner if you did @roll.times
instead
Stacks and QueuesWhat We're Looking For
OPTIONAL JobSimulation
This looks really good! I put in to add any new methods as private, which is maybe why you made that |
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation