Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
define target = "METHINKS IT IS LIKE A WEASEL"
|
||||
define mutate_chance = 0.08
|
||||
define alphabet = [('A'..'Z')..., ' ']
|
||||
define C = 100
|
||||
|
||||
func fitness(str) { str.chars ~Z== target.chars -> count(true) }
|
||||
func mutate(str) { str.gsub(/(.)/, {|s1| 1.rand < mutate_chance ? alphabet.pick : s1 }) }
|
||||
|
||||
for (
|
||||
var (i, parent) = (0, alphabet.rand(target.len).join);
|
||||
parent != target;
|
||||
parent = C.of{ mutate(parent) }.max_by(fitness)
|
||||
) { printf("%6d: '%s'\n", i++, parent) }
|
||||
Loading…
Add table
Add a link
Reference in a new issue