How to Program Games Tile Classics in JS for HTML5 Canvas