Skip to content

Ran350/make10

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a00dc0a · Jan 2, 2022

History

23 Commits
Jan 2, 2022
Jan 2, 2022
Jan 2, 2022
Jan 2, 2022
Jan 2, 2022
Dec 29, 2021
Jan 2, 2022
Dec 1, 2021
Jan 2, 2022
Jan 2, 2022
Jan 2, 2022

Repository files navigation

make10

GitHub version Code Check

the npm library that solving Make 10 Puzzle

Make 10 Puzzle is the game that making 10 through using only 4 numbers and +-×÷.

Demo

You can play it in this web app.

Install

yarn add @ran350/make10
or
npm install @ran350/make10

Run the following command, if it gives the error such as error https://npm.pkg.github.com/download/@ran350/make10/(VERSION)/(HASH): Integrity checked failed for "@ran350/make10" (none of the specified algorithms are supported).

yarn add @ran350/make10 --update-checksums

Example

import { make10 } from "@ran350/make10";

console.log(make10(["1", "2", "3", "4"]));
// -> [ "((1+2)+3)+4", "((1+2)+4)+3", "(3+4)+(1+2)",
//      ... 51 more items
//    ]

console.log(make10(["1", "1", "9", "9"]));
// -> ["((1/9)+1)*9"]

console.log(make10(["2", "5"]));
// -> ["2*5"]

console.log(make10(["1", "2", "4"]));
// -> ["(1+4)*2"]

console.log(make10(["5", "9", "9", "9", "9"]));
// -> ["((9/9)+(9/9))*5"]

Algorithm

See here.