-
-
Notifications
You must be signed in to change notification settings - Fork 525
[WIP] add dominoes #424
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
[WIP] add dominoes #424
Conversation
def can_chain?(dominoes_list = []) | ||
result = false | ||
return true if dominoes_list.length == 0 | ||
result |
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.
Is this the same as returning dominoes_list.length == 0
?
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.
Note: Ruby defines the zero?
method on numbers:
% irb
irb(main):001:0> 1.zero?
=> false
irb(main):002:0> 0.zero?
=> true
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.
Ah this is true, but I do not believe and of the solutions beyond the base cases are dependent on length. I just wanted to get the base cases out of the way.
My suspicion is that I need to frame finding the generic solution as a graph, and then figure out how to traverse the graph to see if at least one solution exists..
"Serena Sees Her Footprints on the Moon" is on sale now @ iTunes!
https://itun.es/us/CnX6bb.l
It's the story of a girl who imagines a trip to the Moon, where she interacts with some of the objects left behind up there by the astronauts from the Apollo missions.
No iPad or iPhone? No problem!
Get the book here: https://gum.co/softcover
On Aug 28, 2016, at 6:10 PM, Tute Costa notifications@github.com wrote:
In exercises/dominoes/dominoes.rb:
@@ -0,0 +1,8 @@
+class Dominoes
+
- def can_chain?(dominoes_list = [])
- result = false
- return true if dominoes_list.length == 0
- result
Note: Ruby defines the zero? method on numbers:% irb
irb(main):001:0> 1.zero?
=> false
irb(main):002:0> 0.zero?
=> true
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
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, you are correct of course. Will do that as I get into refactoring..
"Serena Sees Her Footprints on the Moon" is on sale now @ iTunes!
https://itun.es/us/CnX6bb.l
It's the story of a girl who imagines a trip to the Moon, where she interacts with some of the objects left behind up there by the astronauts from the Apollo missions.
No iPad or iPhone? No problem!
Get the book here: https://gum.co/softcover
On Aug 28, 2016, at 6:10 PM, Tute Costa notifications@github.com wrote:
In exercises/dominoes/dominoes.rb:
@@ -0,0 +1,8 @@
+class Dominoes
+
- def can_chain?(dominoes_list = [])
- result = false
- return true if dominoes_list.length == 0
- result
Is this the same as returning dominoes_list.length == 0?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
went back to before I left thoughtbot This reverts commit 5470ce0.
|
||
def self.deep_copy(domino) | ||
Domino.new(domino.left, domino.right) | ||
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.
Is this the same as https://ruby-doc.org/core-2.3.1/Object.html#method-i-clone? If so, can we use the Ruby method?
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, I believe I can use clone method. Need to investigate differences between using clone and dup in this context when I have a minute.
Are you still working on this? |
hey, sorry, I got busy with work. I still want to do it, and I believe I know how. though if someone else wants it immediately I will defer. |
@seanreed1111 still busy with work? It would be good to be able to merge this in. |
Ugh. Ok, final countdown! Is that OK?
|
That sounds fine, good luck! |
Closing in favour of: #484 which is being actively worked on. |
working on dominoes