function seatsInArrayAreAlreadyTaken(circuitState, dtos, ignoreStep = null, ignoreQubits = []) {
  for (let i = 0; i < dtos.length; i++) {

    let qbits = dtos[i]["targets"];
    let step = dtos[i]["step"];

    for (let j = 0; j < qbits.length; j++){
      let qbit = qbits[j];
      if (ignoreStep == step && ignoreQubits.includes(qbit)) continue;
      if (seatIsTaken(circuitState, qbit, step)) return true;
    }

    if (Object.prototype.hasOwnProperty.call(dtos[i], "controls")) {
      let controls = dtos[i]["controls"];
      for (let j = 0; j < controls.length; j++){
        let control = controls[j];
        if (ignoreStep == step && ignoreQubits.includes(control)) continue;
        if (seatIsTaken(circuitState, control, step)) return true;
      }
    }
  }
  return false;
}
// other control gate or between target and target2 qbits for a two qubit gate. 
other control gate or between target and target2 qbits for a two qubit gate.
other control gate or between target and target2 qbits for a two qubit gate .
function seatsInArrayAreAlreadyTaken(circuitState, dtos, ignoreStep = null, ignoreQubits = []) {
  for (let i = 0; i < dtos.length; i++) {
    let qbits = dtos[i]["targets"];
    let step = dtos[i]["step"];
    for (let j = 0; j < qbits.length; j++){
      let qbit = qbits[j];
      if (ignoreStep == step && ignoreQubits.includes(qbit)) continue;
      if (seatIsTaken(circuitState, qbit, step)) return true;
    }
    if (Object.prototype.hasOwnProperty.call(dtos[i], "controls")) {
      let controls = dtos[i]["controls"];
      for (let j = 0; j < controls.length; j++){
        let control = controls[j];
        if (ignoreStep == step && ignoreQubits.includes(control)) continue;
        if (seatIsTaken(circuitState, control, step)) return true;
      }
    }
  }
  return false;
}
function seatsInArrayAreAlreadyTaken ( circuitState , dtos , ignoreStep = null , ignoreQubits = [ ] ) { for ( let i = 0 ; i < dtos . length ; i ++ ) { let qbits = dtos [ i ] [ "targets" ] ; let step = dtos [ i ] [ "step" ] ; for ( let j = 0 ; j < qbits . length ; j ++ ) { let qbit = qbits [ j ] ; if ( ignoreStep == step && ignoreQubits . includes ( qbit ) ) continue ; if ( seatIsTaken ( circuitState , qbit , step ) ) return true ; } if ( Object . prototype . hasOwnProperty . call ( dtos [ i ] , "controls" ) ) { let controls = dtos [ i ] [ "controls" ] ; for ( let j = 0 ; j < controls . length ; j ++ ) { let control = controls [ j ] ; if ( ignoreStep == step && ignoreQubits . includes ( control ) ) continue ; if ( seatIsTaken ( circuitState , control , step ) ) return true ; } } } return false ; }
other control gate or between target and target2 qbits for a two qubit gate.
other control gate or between target and target2 qbits for a two qubit gate .