Snake and Ladder in Javascript for PhoneGap