Giter VIP home page Giter VIP logo

game24-solutions's Introduction

Game24-Solutions

All possible starting quads to Game 24/Maths 24/24-Cards

Lists every single quads of four natural numbers from 0 to 9 inclusive that, once used exactly once each to add, subtract, multiply, and divide with each other, can result in 24 (as well as ones that can not).

Note that different permutations of the same four numbers are not repeated. The numbers are ordered in ascending order. For example, (2, 9, 7, 4) and (4, 2, 7, 9) are not listed —only (2, 4, 7, 9) is.

The Haskell code used to generate these quads are also given. The file generates a list of all possible expression trees produced by each quad and tests whether there is a single expression tree that evaluates to 24. If there is, the quad is considered a 'possible' one.

The generalPossibleStarts function is provided as an extra —it can be used to compute the possible quads for any 'game' given the same rule, but with a different natural number as a goal e.g. 32 instead of 24.

Currently, there is a QuickCheck test which generates random expression trees with four numbers and tests that the expression is covered by the rest of the code i.e. that it evaluates to the same value as a non-randomly generated expression tree. The quad files are only written if this test passes.

game24-solutions's People

Contributors

thanakrit-anutrakulchai avatar

Watchers

James Cloos avatar

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.