{load_file("rgc-m01wm11.hoc")}

// normal distribution jitter for somatic location
objref rand
rand = new Random()
rand.normal(0, 1)

// deterministic grid positions
DX = 41
DY = -30
CX = 35
CY = 18
onCells = 0

// construct tile of cells
objref on[33]
proc placeCell() { local col, row
    col = $1
    row = $2
    xjit = rand.repick()
    yjit = rand.repick()
    on[onCells] = new RGCM01WM11(CX*col + DX*row + xjit, CY*col + DY*row + yjit, 0)
    // print onCells, CX*col + DX*row + xjit, CY*col + DY*row + yjit
    onCells += 1
}
for col = 0,5 {
    rand.repick()
    for row = 0,5 {
        if (row < 6) {
            if (col == 0) continue
            if (col == 0 && (row == 0 || row == 1 || row == 2 || row == 5)) continue
            if (col == 1 && (row == 0 || row == 1)) continue
            if (col == 2 && row == 0) continue
            if (col == 5 && row == 0) continue
            placeCell(col, row)
        }
    }
}
placeCell(6, 2)
placeCell(6, 3)
placeCell(6, 4)
placeCell(6, 5)
placeCell(7, 2)
placeCell(7, 3)
placeCell(7, 4)