Skip to content

Instantly share code, notes, and snippets.

@robkuz robkuz/cobol.coffee
Created Dec 22, 2011

Embed
What would you like to do?
get = "get"
set = (value) -> value
class Grid
@new: (x, y, val = 0)->
item = new Grid x, y, val
(x, y) ->
(value) ->
if value == get
return item.grid[x][y]
else
item.grid[x][y] = value
constructor: (x, y, val = 0) ->
@grid = []
for a in [0...x]
@grid[a] = []
for b in [0...y]
@grid[a][b] = val
grid = Grid.new(3,3)
grid(2,1) set 3
grid(2,2) set 4
console.log grid(2,1) get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.