Skip to content

[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

Closed
wants to merge 13 commits into from
Closed

Conversation

seanreed1111
Copy link

working on dominoes

def can_chain?(dominoes_list = [])
result = false
return true if dominoes_list.length == 0
result
Copy link

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?

Copy link

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

Copy link
Author

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.

Copy link
Author

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.


def self.deep_copy(domino)
Domino.new(domino.left, domino.right)
end
Copy link

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?

Copy link
Author

@seanreed1111 seanreed1111 Sep 1, 2016

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.

@Insti
Copy link
Contributor

Insti commented Sep 28, 2016

Are you still working on this?

@seanreed1111
Copy link
Author

seanreed1111 commented Sep 28, 2016

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.

@Insti
Copy link
Contributor

Insti commented Oct 17, 2016

@seanreed1111 still busy with work? It would be good to be able to merge this in.

@seanreed1111
Copy link
Author

Ugh. Ok, final countdown!
Either I will finish this by Wednesday at 11:59pm or you can close it down and let someone else do it. It's been sitting too long.

Is that OK?

On Oct 17, 2016, at 2:52 PM, Geoff Hubbard notifications@github.com wrote:

@seanreed1111 still busy with work? It would be good to be able to merge this in.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@Insti
Copy link
Contributor

Insti commented Oct 17, 2016

That sounds fine, good luck!
(And we're here to help.)

@Insti
Copy link
Contributor

Insti commented Nov 8, 2016

Closing in favour of: #484 which is being actively worked on.

@Insti Insti closed this Nov 8, 2016
@kotp kotp removed the abandoned? label Nov 8, 2016
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.

4 participants