From 6498b4143f15c1c9d9716ae9e5409bf8883f9fb2 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 13 Jun 2018 20:18:10 +0200 Subject: [PATCH] tweak inputs: add power-up status, remove top/bottom tile rows --- gameconfig.lua | 4 ++-- main.lua | 4 +++- smb.lua | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gameconfig.lua b/gameconfig.lua index 2ba4575..a42cbb9 100644 --- a/gameconfig.lua +++ b/gameconfig.lua @@ -22,8 +22,8 @@ local function jp_buttons(s) end local gcfg = { - input_size = 60 + 4 - 19, -- TODO: let the script figure this out for us. - tile_count = 17 * 13, + input_size = 60 + 4 - 19 + 1, -- TODO: let the script figure this out for us. + tile_count = 17 * 11, ok_routines = { [0x4] = true, -- sliding down flagpole diff --git a/main.lua b/main.lua index e18e89c..b3a61ad 100644 --- a/main.lua +++ b/main.lua @@ -153,7 +153,7 @@ local function make_network(input_size) nn_tz = nn_ty 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.Relu()) -- 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 status = game.R(0x756) 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) insert(game.extra_input, vx * 16) diff --git a/smb.lua b/smb.lua index a6e0f0b..a8f46cf 100644 --- a/smb.lua +++ b/smb.lua @@ -287,7 +287,10 @@ local function handle_tiles() local tile_scroll = floor(R(0x73F) / 16) + R(0x71A) * 16 local tile_scroll_remainder = R(0x73F) % 16 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 local col = (x + tile_scroll) % 32 local t