Skip to content

iliaparvanov/find-sequence-for-target-num

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

find-sequence-for-target-num

This webpage uses a simple genetic algorithm to find a string of 0s and 1s which evaluates to the given target number.

Decoding rules

A gene consists of a combination of four 0s or 1s. Every gene is either a number or an operator. The whole chromosome is evaluated form left to right without priority of operations.
0: 0000
1: 0001
2: 0010
3: 0011
4: 0100
5: 0101
6: 0110
7: 0111
8: 1000
9: 1001
+: 1010
-: 1011
*: 1100
/: 1101

Any genes which don't conform to the pattern 'number -> operator -> number ...' are ignored.
E.g.
0110 1010 0101 1100 0100 1101 0010 1010 0001
6 + 5 * 4 / 2 + 1
Which, in the end, evaluates to 23.

About

This webpage uses a simple genetic algorithm to find a string of 0s and 1s which evaluates to the given target number.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published