Skip to content

A React app that solves the Countdown Numbers Game.

Notifications You must be signed in to change notification settings

matsagad/countdown-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Countdown Solver

Demo Video

A React app that finds and displays the best answer to the Countdown Numbers Game. The given solution conforms to the Countdown rules (i.e. integers as answers, no fractional intermediate steps, basic operations only, and all numbers need not be used). If no exact answer is found, the closest one is provided. Try it out here.

Algorithm

A dynamic programming strategy is done by: splitting the numbers into two groups, finding all unique values a group could evaluate to (with their corresponding expressions), and recording all possible results when two groups are combined. Pairs of numbers are first considered, then, successively, every combination is solved until a combination of all the numbers is reached.

Initially, as in OldBoard.js, all valid polish notation expressions were evaluated by considering all the number permutations and choices for operations. In hindsight, this was inefficient in that for every permutation, the next to consider often only swaps two values. This means, apart from the non-commutative operations, everything else evaluates the same. By considering each individual combination instead, we eliminate the redundancy of recording values that the other numbers can make up.

Other

Color palette used is Cyber Ping Pong by sukinapan.

About

A React app that solves the Countdown Numbers Game.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published