UL UP UR LT ** RT DL DN DR Moving on a grid in the directions shown above in text (token is at **) Looking to have only 0, 45, 90, 135, 180, 225, 270, 315 or back to 0. Passing the token rotation (angle) that might be -32.222 or 634.333 (or whatever.) fixAngle = function(angle) { angle = angle % 360; angle = (angle + 360) % 360; angle = Math.round(angle / 45) * 45; angle = Math.round(angle); if(360 === angle){ angle = 0;} return angle; }, I have read Javascript: The Good Parts... and even talked to Douglas Crockford on Skype. He says this is good, just wondering if I have this correct.