#solver #game #extension #basic #24

nightly game24

24 game solver with extensions

6 releases

0.3.2 Sep 25, 2020
0.3.1 Sep 25, 2020
0.2.1 Sep 23, 2020
0.1.0 Sep 23, 2020

#173 in #solver

MPL-2.0 license

12KB
318 lines

Game24 Solver

Basic

use game24::basic::{solve, solve_all};

#[test]
fn find_one() {
    println!("{}", solve(&[1, 2, 3, 4], 24).unwrap())
}

// (1 + 2 + 3) × 4

#[test]
fn find_all() {
    for v in solve_all(&[1, 2, 3, 4], 24) {
        println!("{}", v)
    }
}

// (1 + 2 + 3) × 4
// (1 + 3) × (2 + 4)
// 1 × 2 × 3 × 4
// 2 ÷ 1 × 3 × 4

Todo list

  • Support unary op like !
  • Time Constraint
  • Search all solutions for a given deck
  • Cli/Web application
  • Meta programming instead of big function map

Dependencies

~1MB
~19K SLoC