Skip to content

Instantly share code, notes, and snippets.

@tbeseda
Created October 3, 2013 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbeseda/6818489 to your computer and use it in GitHub Desktop.
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]
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!
@alexmcpherson
Copy link

http://en.wikipedia.org/wiki/Hexavigesimal maybe something interesting at the bottom there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment