Implementation of libpuzzle in javascript using HTML5 canvas