detect when mario is controllable

This commit is contained in:
Connor Olding 2018-06-09 01:43:22 +02:00
parent 5f85b92b6d
commit 81d6b509d0
2 changed files with 2 additions and 3 deletions

View File

@ -5,7 +5,6 @@ however, feel free to copy any snippets of code you find useful.
TODOs: (that i can remember right now)
- normalize and/or embed sprite type inputs
- settle on a network architecture
- detect frames when Mario is in a controllable state
- compute how many input neurons the network needs instead of hardcoding
- add some detection for enemies later in the game
- fix cfg.enable_overlay (smb.lua doesn't see it being changed)

View File

@ -603,7 +603,7 @@ local function doit(dummy)
empty(game.tile_input)
empty(game.extra_input)
-- TODO: check if mario is in a playable state.
local controllable = game.R(0x757) == 0 and game.R(0x758) == 0
local x, y = game.getxy(0, 0x86, 0xCE, 0x6D, 0xB5)
local powerup = game.R(0x754)
local status = game.R(0x756)
@ -644,7 +644,7 @@ local function doit(dummy)
if cfg.decrement_reward and reward_delta == 0 then reward_delta = reward_delta - 1 end
if not ingame_paused and game.get_state() ~= 'win_walking' then
if not ingame_paused and controllable and game.get_state() ~= 'win_walking' then
-- note that we exclude points gained walking into the castle.
-- this way, we avoid adding the timer-based fireworks to our reward,
-- which are basically unwanted noise due to the way they trigger.