private void computeBitLocations ( ) { int N = numRows ; int row = N - 1 ; int col = N - 1 ; int direction = - 1 ; while ( col > 0 ) { if ( col == 6 ) col -= 1 ; if ( ! get ( row , col ) ) { bits . add ( new Point2D_I32 ( col , row ) ) ; } if ( ! get ( row , col - 1 ) ) { bits . add ( new Point2D_I32 ( col - 1 , row ) ) ; } row += direction ; if ( row < 0 || row >= N ) { direction = - direction ; col -= 2 ; row += direction ; } } }
Snakes through and specifies the location of each bit for all the code words in the grid .