Skip to content

Instantly share code, notes, and snippets.

View EliasHasle's full-sized avatar

Elias Hasle EliasHasle

View GitHub Profile
@EliasHasle
EliasHasle / Retro_SMB_Wrapper.py
Last active April 14, 2019 14:53
Retro SuperMarioBros-Nes wrapper that skips busy frames and converts to discrete action space (alpha, not thoroughly tested)
#Inspired by
#https://github.com/Kautenja/nes-py/blob/master/nes_py/wrappers/binary_to_discrete_space_env.py
#and
#https://github.com/openai/retro-baselines/blob/master/agents/sonic_util.py
#but copying directly from neither.
#Requires retro.
#Requires SuperMarioBros NES rom (USA/Japan). Once you have it, can be imported to retro:
#> python -m retro.import directory_name
#(identifies the ROM if it is there and has the .nes extension.)
@EliasHasle
EliasHasle / ball_bounce.m
Created October 7, 2017 20:58
Matlab function to calculate exact vertical position and velocity of a single bouncing ball (with given coefficient of restitution less than one) at any time or array of times
%@EliasHasle
%There probably is room for more optimization in the form of vectorization.
%You see, Matlab is not my first language.
function [ values ] = ball_bounce( initials, k, tt)
%Input:
%initials: column vector of initial vertical position and velocity
%k: coefficient of restitution (must be less than one)
%tt: array of times
%