module/src/ship.js
/**
 * Calculate the hittable points within a matrix by iterating
 * its values and counting those which are 1.
 * @param  {Matrix} matrix - the matrix to calculate
 * @return {number} the amount of values in the matrix whose value is 1
 */
Calculate the hittable points within a matrix by iterating
its values and counting those which are 1.
@param  {Matrix} matrix - the matrix to calculate
@return {number} the amount of values in the matrix whose value is 1
Calculate the hittable points within a matrix by iterating its values and counting those which are 1 . @param { Matrix } matrix - the matrix to calculate @return { number } the amount of values in the matrix whose value is 1
function calculateImpactArea(matrix) {
    let count = 0;
    for (let row = 0; row < matrix.rows; row++) {
        for (let column = 0; column < matrix.columns; column++) {
            const value = matrix.data[row][column];
            if (value === 1) {
                count ++;
            }
        }
    }
    return count;
}
function calculateImpactArea ( matrix ) { let count = 0 ; for ( let row = 0 ; row < matrix . rows ; row ++ ) { for ( let column = 0 ; column < matrix . columns ; column ++ ) { const value = matrix . data [ row ] [ column ] ; if ( value === 1 ) { count ++ ; } } } return count ; }
Calculate the hittable points within a matrix by iterating
 its values and counting those which are 1.
Calculate the hittable points within a matrix by iterating its values and counting those which are 1 .