Skip to content

Instantly share code, notes, and snippets.

View EliasHasle's full-sized avatar

Elias Hasle EliasHasle

View GitHub Profile
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
%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)
%initials: column vector of initial vertical position and velocity
%k: coefficient of restitution (must be less than one)
%tt: array of times
EliasHasle /
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
#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.)