Code for the apprenticeship tutorials on HTML5 canvas