Skip to content

Commit

Permalink
now prints change in mean for each generation
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaGupta1 committed Sep 30, 2018
1 parent af5e37e commit 7f6db16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# WarI-O
# WarI/O
A genetic algorithm to play Super Mario Bros, inspired by SethBling's MarI/O project
13 changes: 12 additions & 1 deletion WarIO.lua
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,21 @@ function newGenome(oldGenome)
mutationRate = baseMutationRate
end

local deltaMean = mean - lastMean
if (deltaMean > 0) then
deltaMean = "+" .. deltaMean
else if (deltaMean == 0) then
deltaMean = "-"
end

newGenome = breed(newGenome, #oldGenome)
print("====================")
print("generation " .. generation)
print("mean = " .. mean)
if (generation == 1) then
printf("mean = " .. mean)
else
print("mean = " .. mean .. " (" .. deltaMean .. ")")
end
print("====================")
for i = 1, speciesPerGenome * percentToBreed do
print(newGenome[i].fitness)
Expand Down

0 comments on commit 7f6db16

Please sign in to comment.