Thanks to visit codestin.com
Credit goes to github.com

Skip to content

It started as a Game of 24 (24 Game) solver. Now it can solve any variants on this, reaching any arbitrary number by combining at most 17 numbers if memory permits.

License

Notifications You must be signed in to change notification settings

wiebemarten/gamemn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

The Game of M Solver, using N numbers

It started as a Game of 24 (also known as the 24 Game)solver. The program was enhanced: Now it can solve any variants on this game, reaching any arbitrary number by combining at most 17 numbers if memory permits.

The program outputs a list of all possible solutions to the given goal M and the number set with length n. An option to stop after finding just one solution is also created.

About

This code was created for Introduction to Computing Science at the University of Groningen in 2014.

More information about this project can be found in the report: http://wmcode.nl/cs/gameofmnReport.pdf

Running Time

The complexity of this problem quickly rises, which can be seen when analysing the number of possibilities:

P(n) = C(n-1) * n! * 4^(n-1) (Where C(n) is the Catalan Number function, and n! is the factorial of n)

Thus, the time it takes to list all solution increases rapidly.

n P(n) = C(n-1) * n! * 4^(n-1)
1 1
2 8
3 192
4 7680
5 430080
6 30965760
7 2724986880
8 283398635520
9 34007836262400
10 4625065731686400
11 703009991216332800
12 118105678524343910400
13 21731444848479279513600
14 4346288969695855902720000
15 938798417454304874987520000
16 217801232849398730997104640000
17 54014705746650885287281950720000
18 14259882317115833715842434990080000
(See [Integer Sequence A052734](http://oeis.org/A052734) )

This means that the program, while working with larger collections of numbers, will run for a very long time. Also, although the program tries to limit memory use, still a significant amount of memory needs to be reserved, namely C(n-1). (See Integer Sequence A000108 )

However, it should be very possible to paralellize this algorithm and run it on a supercomputer.

About

It started as a Game of 24 (24 Game) solver. Now it can solve any variants on this, reaching any arbitrary number by combining at most 17 numbers if memory permits.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages