Note that there are some explanatory texts on larger screens.

plurals
  1. PO24 Game/Countdown/Number Game solver, but without parentheses in the answer
    primarykey
    data
    text
    <p>I've been browsing the internet all day for an existing solution to creating an equation out of a list of numbers and operators for a specified target number.</p> <p>I came across a lot of 24 Game solvers, Countdown solvers and alike, but they are all build around the concept of allowing parentheses in the answers.</p> <p>For example, for a target 42, using the number 1 2 3 4 5 6, a solution could be:</p> <pre><code>6 * 5 = 30 4 * 3 = 12 30 + 12 = 42 </code></pre> <p>Note how the algorithm remembers the outcome of a sub-equation and later re-uses it to form the solution (in this case 30 and 12), essentially using parentheses to form the solution <code>(6 * 5) + (4 * 3) = 42</code>.</p> <p>Whereas I'd like a solution WITHOUT the use of parentheses, which is solved from left to right, for example <code>6 - 1 + 5 * 4 + 2 = 42</code>, if I'd write it out, it would be:</p> <pre><code>6 - 1 = 5 5 + 5 = 10 10 * 4 = 40 40 + 2 = 42 </code></pre> <p>I have a list of about 55 numbers (random numbers ranging from 2 to 12), 9 operators (2 of each basic operator + 1 random operator) and a target value (a random number between 0 and 1000). I need an algorithm to check whether or not my target value is solvable (and optionally, if it isn't, how close we can get to the actual value). Each number and operator can only be used once, which means there will be a maximum of 10 numbers you can use to get to the target value.</p> <p>I found a brute-force algorithm which can be easily adjusted to do what I want (<a href="https://stackoverflow.com/questions/15293232/how-to-design-an-algorithm-to-calculate-countdown-style-maths-number-puzzle">How to design an algorithm to calculate countdown style maths number puzzle</a>), and that works, but I was hoping to find something which generates more sophisticated "solutions", like on this page: <a href="http://incoherency.co.uk/countdown/" rel="nofollow noreferrer">http://incoherency.co.uk/countdown/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload