Giter Club home page Giter Club logo

fast_fives's Introduction

fast fives

A faster implementation of finding sets of 5 words of length 5 that all contain different letters from a provided list of words. See https://www.youtube.com/watch?v=_-AfhLQfb6w for more info. The algorithms presented in the video appeared optimizable.

Results

Currently this takes about ~1.3 seconds to generate the "correct" 831 words output according to the linked video on my i9-12900K @ 3.2GHz, which is admittedly a little overkill.

Technique

This primarily achieves the performance it has by:

  1. Being written in Rust, a language that compiles to machine code
  2. Using multiple threads
  3. After choosing a word, only considering words that are lexicographically after that one, trusting another iteration would capture when that appears before
  4. Compare word validity using bitstrings and bit operations

There are likely more improvements to make. But another few orders of magnitude improvement over the existing solutions is sufficient for now. :)

  1. Prune fully-checked words from initial filtering - Not successful

Installation

Install Rust https://rustup.rs/.

Clone this repository.

Run:

cargo run --release

Options

If you'd like to provide an alternate word list, you can specify the input file as an argument to the program:

cargo run --release -- your_word_file.txt

The program expects that file to be a newline separated list of words. It will only consider 5 letter words.

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.