Skip to content

Instantly share code, notes, and snippets.

@genert
Created July 9, 2015 10:39
Show Gist options
  • Save genert/ced5e90ff32ddb2a716b to your computer and use it in GitHub Desktop.
Save genert/ced5e90ff32ddb2a716b to your computer and use it in GitHub Desktop.
Codwars Grid Blast Javascript Solution
// THE BATTLEFIELD GRID
// ['top left', 'top middle', 'top right',
// 'middle left', 'center', 'middle right',
// 'bottom left', 'bottom middle', 'bottom right']
//
function fire(x,y) {
var xArray = ['left', 'middle', 'right'],
yArray = ['top', 'middle', 'bottom'];
return ((x == 1 && y == 1) ? 'center' : yArray[y] + ' ' + xArray[x]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment