General purpose memory game in javascript