Attempt to fix genome graph so it doesn't destroy the whole run

This commit is contained in:
Empathic Qubit 2021-04-30 04:42:55 -04:00
parent d2f7a1a5d8
commit 60511c1cc4
2 changed files with 35 additions and 5 deletions

View file

@ -83,6 +83,18 @@ local function displayGenome(genome)
if gene.enabled then
local c1 = cells[gene.into]
local c2 = cells[gene.out]
if c1 == nil then
c1 = {
x = 0,
y = 0,
}
end
if c2 == nil then
c2 = {
x = 0,
y = 0,
}
end
if gene.into > Inputs and gene.into <= config.NeatConfig.MaxNodes then
c1.x = 0.75*c1.x + 0.25*c2.x
if c1.x >= c2.x then
@ -149,6 +161,18 @@ local function displayGenome(genome)
if true then
local c1 = cells[gene.into]
local c2 = cells[gene.out]
if(c1 == nil) then
c1 = {
x = 0,
y = 0,
}
end
if(c2 == nil) then
c2 = {
x = 0,
y = 0,
}
end
local alpha = 0x20000000
if c1.value == 0 then
alpha = 0xA0000000
@ -408,11 +432,11 @@ local function mainLoop(_M, genome)
genome = _M.currentSpecies.genomes[_M.currentGenomeIndex]
if _M.drawFrame % 10 == 0 then
if not pcall(function()
--if not pcall(function()
displayGenome(genome)
end) then
message(_M, "Could not render genome graph", 0x00990000)
end
--end) then
--message(_M, "Could not render genome graph", 0x00990000)
--end
end
if _M.currentFrame%5 == 0 then

View file

@ -14,6 +14,8 @@ local function help()
text([[
Syntax: BSNES_LAUNCHER_ARGS='<arguments>' lsnes --lua=]]..base..[[/bsnes-launcher.lua
--sprite-startindex=<number> Which sprite to start at. Can be a value from 0-22
Sprite breakpoint arguments:
These will create breakpoints for all sprite slots with properties matching the
given pattern.
@ -94,10 +96,14 @@ local function bpSwitch(switchName, source, startAddress, arg, valWidth, addrWid
end
local count = 0
local startIndex = 0
for arg in os.getenv('BSNES_LAUNCHER_ARGS'):gmatch('[^ ]+') do
if arg:sub(1,20) == '--sprite-startindex=' then
startIndex = tonumber(arg:sub(21))
end
count = count + 1
for propName,offset in pairs(mem.offset.sprite) do
for i=0,22,1 do
for i=startIndex,22,1 do
local startAddress = mem.addr.spriteBase + mem.size.sprite * i + offset
bpSwitch('sprite-'..propName, 'cpu', startAddress, arg)
end