static IsGoodPosition(position) {
    if (position.length == 0) return false;
    const rows = position.split("/");
    if (rows.length != V.size.x) return false;
    for (let row of rows) {
      let sumElts = 0;
      for (let i = 0; i < row.length; i++) {
        if (V.PIECES.includes(row[i].toLowerCase())) sumElts++;
        else {
          const num = parseInt(row[i], 10);
          if (isNaN(num) || num <= 0) return false;
          sumElts += num;
        }
      }
      if (sumElts != V.size.y) return false;
    }
    return true;
  }
// Do not check kings (TODO: something more subtle!)
Do not check kings (TODO: something more subtle!)
Do not check kings ( TODO : something more subtle! )
static IsGoodPosition(position) {
    if (position.length == 0) return false;
    const rows = position.split("/");
    if (rows.length != V.size.x) return false;
    for (let row of rows) {
      let sumElts = 0;
      for (let i = 0; i < row.length; i++) {
        if (V.PIECES.includes(row[i].toLowerCase())) sumElts++;
        else {
          const num = parseInt(row[i], 10);
          if (isNaN(num) || num <= 0) return false;
          sumElts += num;
        }
      }
      if (sumElts != V.size.y) return false;
    }
    return true;
  }
static IsGoodPosition ( position ) { if ( position . length == 0 ) return false ; const rows = position . split ( "/" ) ; if ( rows . length != V . size . x ) return false ; for ( let row of rows ) { let sumElts = 0 ; for ( let i = 0 ; i < row . length ; i ++ ) { if ( V . PIECES . includes ( row [ i ] . toLowerCase ( ) ) ) sumElts ++ ; else { const num = parseInt ( row [ i ] , 10 ) ; if ( isNaN ( num ) || num <= 0 ) return false ; sumElts += num ; } } if ( sumElts != V . size . y ) return false ; } return true ; }
Do not check kings (TODO: something more subtle!)
Do not check kings ( TODO : something more subtle! )