Double posts probably aren't allowed, but I just wanted to share with you guys something I've done, i've figured out how we need to add a sprite to the Input array, but i'm afraid to inform you that it will come at a massive cost to performance without some changes. We need to modify the sigmoid function in order for the performance not to kill us, though i'm not sure how we should do it to get what we want. Basically from what I can tell is that the sigmoid function takes the activation of a neuron, * the 'weight' of that neuron and then averages that out to be between -1 or 1 no matter what.
That, or I'll have to increase the size of the input array from 169 inputs to 14,656 inputs + 169 + any extra inputs we want to add. This would decrease performance by... a factor of 86 times.
That's only getting the 6 by 6 tile range that mario can 'see' already.
http://www.smwiki.net/wiki/Sprite
function getSprites()
local sprites = {}
for slot= 0, SMW.sprite_max - 1 do
local status = memory.readbyte(0x14C8+slot)
if status > 7 then -- 228 + 5320
spritex = memory.readbyte(0xE4+slot) + memory.readbyte(0x14E0+slot)*256 --5344
spritey = memory.readbyte(0xD8+slot) + memory.readbyte(0x14D4+slot)*256
spriteNo = u8(WRAM.sprite_number + slot)
sprites[#sprites+1] = {["number"]= spriteNo, ["x"]=spritex, ["y"]=spritey}
end
end
return sprites
end
This would allow him to interact better with the world, and to interact directly with these sprites.
The sigmoid function is here:
function sigmoid(x)
return 2/(1+math.exp(-4.9*x))-1
end
I'm not sure if what I want to do is possible though, because afaict a neuron is either firing or it isn't.
EDIT: I'm wrong, in that the number of input neurons does not have to be that much higher. I can convert the hex values into a binary array where each digit represents a neuron. Then, I can be sure that the section of memory actually turns out to be only 8 extra inputs (0 - FF)