Giter Club home page Giter Club logo

Comments (4)

petertseng avatar petertseng commented on June 17, 2024

wouldn't it be OK if we were using two domino sets though? see no reason why the dominoes would have to be unique

from rust.

masters3d avatar masters3d commented on June 17, 2024

I am just trying to understand the rules of this "game". I have not really played this kind of loop "chain" dominos. I'd like to add more test cases to a Swift version I am working on. My first impression is that all stones in a chain should be unique because most games with dominos are played using one one set of unique dominos. Otherwise we can have test cases like (1,1), (1,1), (1,1), (1,1), (1,1), that would be valid but don't really make sense. Plus I'd like to expand my version to check to see if a stone can be inserted into a valid chain or if a stone can be removed and still have a valid chain etc.

from rust.

petertseng avatar petertseng commented on June 17, 2024

Well, let's explain why those tests cases are there in the first place, they stop some incorrect solutions from falsely declaring a chain is possible when it isn't.

Consider the [(1, 2), (2, 1), (3, 4), (4, 3)] test case. Some solutions will falsely declare that a chain can be made of [(1, 2), (2, 1)] when this is incorrect because it hasn't used all the dominoes. Sure, it could be changed to [(1, 2), (2, 3), (1, 3), (4, 5), (5, 6), (4, 6)], but that seems unnecessary.

Similarly, [(1, 2), (2, 3), (3, 1), (2, 4), (2, 4)] is there to stop some solutions from falsely declaring that (1, 2), (2, 3), (3, 1) is a valid chain when it's clearly invalid because it hasn't used all the dominoes. Sure, it could be changed into [(1, 2), (2, 3), (3, 1), (2, 4), (4, 5), (5, 2)] but it also seems unnecessary.

Why did I say in both cases that something seems unnecessary? Becuase it over-complicates the test cases to expose simple problems. I think it should be a principle to find the simplest test case that exposes a problem.

I have no opinions about [(1, 2), (5, 3), (3, 1), (1, 2), (2, 4), (1, 6), (2, 3), (3, 4), (5, 6)] though. That was here long before my time.

Plus I'd like to expand my version to check to see if a stone can be inserted into a valid chain or if a stone can be removed and still have a valid chain etc.

You may find that those checks devolve into "is that domino of the form (x, x)?"

If the checks can affect multiple dominoes, then the checks become "are the dominoes themselves a valid chain?"

from rust.

masters3d avatar masters3d commented on June 17, 2024

I see, is more about making it a little more challenging.

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.