Git Product home page Git Product logo

chainreaction's People

Contributors

ferrisx4 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

chainreaction's Issues

Chain uniqueness not checked for final word

The check for uniqueness was not made in end cases where the last word in the chain already existed in the chain.

Ideally a solution to this would be to check if the Ending word provided in the user's argument exists in the chain at all before the chain is long enough. In this way, the algorithm would chuck out any candidate chains early before filling out the rest of the chain.

An easier solution to implement would be to simply check for uniqueness before checking for valid chain.

Alphabetize word list?

Should the word list be automatically alphabetized, including the children words of each parent?

Pros:

  • Will aid in filtering manually through chains
  • May ease search times if autocomplete functionality is offered in the future

Cons:

  • Will remove provenance of when each word was added to the list, and each child added to its parent.

This seems like an obvious decision.

Redundant actions

Several "actions" result in the same exact code being run, as follows:

array_pop($chain);
$depth -= 1;

These can be consolidated into a single action response to cut down on if statement processing.

The following actions all result in the above code firing, as well as any unhandled actions:

  • reached_chain_length_target
  • no_child
  • chain_found for some reason. This should be its own issue.
  • already_in_chain
  • premature_chain

In a few of these, decrementing depth comes before popping the array, but this probably doesn't matter.

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.