Skip to content

Commit

Permalink
Latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ujh committed Feb 11, 2025
1 parent 51bc72d commit c007187
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions evolve/evolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ SOFTWARE.
#include <time.h>

#include "evolve.h"
#include "genann.h"

pcg32_random_t rng;

Expand Down Expand Up @@ -113,6 +114,9 @@ genann *child_from_mutation(genann **nns) {

genann *mutate(genann *parent) {
genann *child = genann_copy(parent);
// Hacky way to also have a slight chance of no mutation at all.
if (GENANN_RANDOM() < 0.01) return child;

float mutation_rate = 0.0004; // 1/2500
for (int i = 0; i < child->total_weights; i++)
{
Expand Down
6 changes: 3 additions & 3 deletions ruby/run_generation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ def clean_up_generation(g)
GNUGO10 = { 'name' => 'GnuGoLevel10', 'command' => 'gnugo --level 10 --mode gtp' }
EXTERNAL_PLAYERS = [
*(1..5).map { |i| BROWN.merge('name' => BROWN['name'] + i.to_s) },
*(1..5).map { |i| AMIGO.merge('name' => AMIGO['name'] + i.to_s) },
GNUGO0,
GNUGO10
*(1..10).map { |i| AMIGO.merge('name' => AMIGO['name'] + i.to_s) },
*(1..2).map { |i| GNUGO0.merge('name' => GNUGO0['name'] + i.to_s) },
*(1..2).map { |i| GNUGO10.merge('name' => GNUGO10['name'] + i.to_s) }
]

def setup_tournament
Expand Down
4 changes: 2 additions & 2 deletions stats
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
$stats = File.exist?('stats.json') ? JSON.load_file('stats.json') : {}
$starting = true

TO_COMBINE = %w[Brown AmiGo]
TO_COMBINE = %w[Brown AmiGo GnuGoLevel0 GnuGoLevel10]

def stats_for(generation)
return $stats[generation] if $stats[generation]
Expand Down Expand Up @@ -142,7 +142,7 @@ loop do
gens = if options[:csv]
generations[0..-2]
else
generations[0..-2].reverse.take(40).reverse
generations[0..-2].reverse.take(50).reverse
end

if gens.empty?
Expand Down

0 comments on commit c007187

Please sign in to comment.