Generate probabilities around a numpad
There’s no need for recursion here.  You have some base probability map, and you want to rotate it such that the maximum element points in some particular direction.  You could implement that fairly simply:

var INDICES = [1, 2, 3, 6, 9, 8, 7, 4];
var PROBABILITIES = [80, 60, 30, 20, 10, 20, 30, 60];

function generateProbabilities(lastNumpadDirection) {
    var lastIndexDirection = INDICES.indexOf(lastNumpadDirection);
    var shifted = PROBABILITIES.slice(PROBABILITIES.length - lastIndexDirection)
        .concat(PROBABILITIES.slice(0, PROBABILITIES.length - lastIndexDirection));
    var result = {};
    for(var i = 0, l = INDICES.length; i &lt; l; i++) {
        result[INDICES[i]] = shifted[i];
    }
    return result;
}


Much of the complexity here comes from needing to deal with directions represented as arrows on the numpad–here, I convert them to 45-degree-offsets going clockwise from northwest, shift the probabilities array, and then convert back to your desired numpad format. Illustrated: