tweak inputs: add power-up status, remove top/bottom tile rows

This commit is contained in:
Connor Olding 2018-06-13 20:18:10 +02:00
parent 6fa042eda5
commit 6498b4143f
3 changed files with 9 additions and 4 deletions

View file

@ -22,8 +22,8 @@ local function jp_buttons(s)
end end
local gcfg = { local gcfg = {
input_size = 60 + 4 - 19, -- TODO: let the script figure this out for us. input_size = 60 + 4 - 19 + 1, -- TODO: let the script figure this out for us.
tile_count = 17 * 13, tile_count = 17 * 11,
ok_routines = { ok_routines = {
[0x4] = true, -- sliding down flagpole [0x4] = true, -- sliding down flagpole

View file

@ -153,7 +153,7 @@ local function make_network(input_size)
nn_tz = nn_ty nn_tz = nn_ty
if cfg.reduce_tiles then if cfg.reduce_tiles then
nn_tz = nn_tz:feed(nn.Reshape{13, 17 * 2}) nn_tz = nn_tz:feed(nn.Reshape{11, 17 * 2})
nn_tz = nn_tz:feed(nn.DenseBroadcast(5)) nn_tz = nn_tz:feed(nn.DenseBroadcast(5))
nn_tz = nn_tz:feed(nn.Relu()) nn_tz = nn_tz:feed(nn.Relu())
-- note: due to a quirk in Merge, we don't need to flatten nn_tz. -- note: due to a quirk in Merge, we don't need to flatten nn_tz.
@ -561,6 +561,8 @@ local function doit(dummy)
local powerup = game.R(0x754) local powerup = game.R(0x754)
local status = game.R(0x756) local status = game.R(0x756)
game.mark_sprite(x + 8, y + 24, -powerup - 1) game.mark_sprite(x + 8, y + 24, -powerup - 1)
-- TODO: this will have to do until sprite type embed is added:
insert(game.extra_input, (status - 1) * 256)
local vx, vy = game.S(0x57), game.S(0x9F) local vx, vy = game.S(0x57), game.S(0x9F)
insert(game.extra_input, vx * 16) insert(game.extra_input, vx * 16)

View file

@ -287,7 +287,10 @@ local function handle_tiles()
local tile_scroll = floor(R(0x73F) / 16) + R(0x71A) * 16 local tile_scroll = floor(R(0x73F) / 16) + R(0x71A) * 16
local tile_scroll_remainder = R(0x73F) % 16 local tile_scroll_remainder = R(0x73F) % 16
extra_input[#extra_input+1] = tile_scroll_remainder extra_input[#extra_input+1] = tile_scroll_remainder
for y = 0, 12 do -- for y = 0, 12 do
-- afaik the bottom row is always a copy of the second to bottom,
-- and the top is always air, so drop those from the inputs:
for y = 1, 11 do
for x = 0, 16 do for x = 0, 16 do
local col = (x + tile_scroll) % 32 local col = (x + tile_scroll) % 32
local t local t