for ( int col = 0; col < size; col++ ) {
cells[row][col] = new Cell( Cell.DEAD, row, col );
handles[row][col] = session.insert( cells[row][col] );
if ( row >= 1 && col >= 1 ) {
// northwest
session.insert( new Neighbor( cells[row - 1][col - 1],
cells[row][col] ) );
session.insert( new Neighbor( cells[row][col],
cells[row - 1][col - 1] ) );
}
if ( row >= 1 ) {
// north
session.insert( new Neighbor( cells[row - 1][col],
cells[row][col] ) );
session.insert( new Neighbor( cells[row][col],
cells[row - 1][col] ) );
}
if ( row >= 1 && col < (size - 1) ) {
// northeast
session.insert( new Neighbor( cells[row - 1][col + 1],
cells[row][col] ) );
session.insert( new Neighbor( cells[row][col],
cells[row - 1][col + 1] ) );
}
if ( col >= 1 ) {
// west
session.insert( new Neighbor( cells[row][col - 1],
cells[row][col] ) );
session.insert( new Neighbor( cells[row][col],
cells[row][col - 1] ) );
}
}
}