Created
July 9, 2015 10:39
-
-
Save genert/ced5e90ff32ddb2a716b to your computer and use it in GitHub Desktop.
Codwars Grid Blast Javascript Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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