Created
October 3, 2013 23:07
-
-
Save tbeseda/6818489 to your computer and use it in GitHub Desktop.
Given a number of rows and columns generate spreadsheet style coordinates.
i.e. [A1, B1, C1...BJ9, BK9, BL9]
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
generate_coordinates = (rows, columns) -> | |
generated_coordinates = [] | |
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('') | |
for i in [1..rows] | |
for n in [0..(columns-1)] | |
a = if n < 26 then alphabet[n] else alphabet[Math.floor(n/26)-1] + alphabet[n%26] | |
generated_coordinates.push(a + i) | |
coordinates = generate_coordinates(8, 63) | |
console.log(coordinates.length + ' coords generated!') # 504 coords generated! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://en.wikipedia.org/wiki/Hexavigesimal maybe something interesting at the bottom there?