Javascript implementation for calculating dynamics of 2x2 games