2 ms·
I find the translate function, though very simple, rather elegant JS: AI.prototype.translate = function(move) { return { 0: 'up', 1: 'right',
by elwell 13y ago
I find the translate function, though very simple, rather elegant JS:
AI.prototype.translate = function(move) {
return {
0: 'up',
1: 'right',
2: 'down',
3: 'left'
}[move];
}
Ref: https://github.com/ov3y/2048-AI/blob/master/js/ai.js#L230 https://github.com/ov3y/2048-AI/blob/master/js/ai.js#L230