Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AurelianTactics/452aacc43f47059891fe82d75a38aadc to your computer and use it in GitHub Desktop.
Save AurelianTactics/452aacc43f47059891fe82d75a38aadc to your computer and use it in GitHub Desktop.
reward_by_max_trajectory
prev_step_max = 0
-- reward that allows backtracking, only rewarded by getting max trajectory
function reward_by_max_trajectory()
frame_count = frame_count + 1
local level_done = calc_progress(data)
local temp_progress = calc_trajectory_progress(data)
--local reward = reward_by_ring(data) --optional, modify reward by ring behavior
local reward = 0
if (temp_progress ~= nil and temp_progress > prev_step_max) then
reward = (temp_progress/level_dict_len - prev_step_max/level_dict_len) * 9000
reward = clip(reward,-400.1,400.1)
prev_step_max = temp_progress
end
if level_done >= 1 then
reward = reward + (1 - clip(frame_count/frame_limit, 0, 1)) * 1000
end
return reward
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment