resolveSynchroneMove(move) {
    const m1 = this.whiteMove;
    const m2 = move;
    // For PlayOnBoard (no need for start / end, irrelevant)
    let smove = {
      appear: [],
      vanish: [
        m1.vanish[0],
        m2.vanish[0]
      ]
    };
    if ((m1.end.x != m2.end.x) || (m1.end.y != m2.end.y)) {
      // Easy case: two independant moves (which may (self-)capture)
      smove.appear.push(m1.appear[0]);
      smove.appear.push(m2.appear[0]);
      // "Captured" pieces may have moved:
      if (m1.appear.length == 2) {
        // Castle
        smove.appear.push(m1.appear[1]);
        smove.vanish.push(m1.vanish[1]);
      }
      else if (
        m1.vanish.length == 2 &&
        (
          m1.vanish[1].x != m2.start.x ||
          m1.vanish[1].y != m2.start.y
        )
      ) {
        smove.vanish.push(m1.vanish[1]);
      }
      if (m2.appear.length == 2) {
        // Castle
        smove.appear.push(m2.appear[1]);
        smove.vanish.push(m2.vanish[1]);
      }
      else if (
        m2.vanish.length == 2 &&
        (
          m2.vanish[1].x != m1.start.x ||
          m2.vanish[1].y != m1.start.y
        )
      ) {
        smove.vanish.push(m2.vanish[1]);
      }
    }
    else {
      // Collision:
      if (m1.vanish.length == 1 && m2.vanish.length == 1) {
        // Easy case: both disappear except if one is a king
        const p1 = m1.vanish[0].p;
        const p2 = m2.vanish[0].p;
        if ([p1, p2].includes(V.KING)) {
          smove.appear.push({
            x: m1.end.x,
            y: m1.end.y,
            p: V.KING,
            c: (p1 == V.KING ? 'w' : 'b')
          });
        }
      }
      else {
        // One move is a self-capture and the other a normal capture:
        // only the self-capture appears
        const selfCaptureMove =
          m1.vanish[1].c == m1.vanish[0].c
            ? m1
            : m2;
        smove.appear.push({
          x: m1.end.x,
          y: m1.end.y,
          p: selfCaptureMove.appear[0].p,
          c: selfCaptureMove.vanish[0].c
        });
        smove.vanish.push({
          x: m1.end.x,
          y: m1.end.y,
          p: selfCaptureMove.vanish[1].p,
          c: selfCaptureMove.vanish[0].c
        });
      }
    }
    return smove;
  }
// White and black (partial) moves were played: merge
White and black (partial) moves were played: merge
White and black ( partial ) moves were played : merge
resolveSynchroneMove(move) {
    const m1 = this.whiteMove;
    const m2 = move;
    let smove = {
      appear: [],
      vanish: [
        m1.vanish[0],
        m2.vanish[0]
      ]
    };
    if ((m1.end.x != m2.end.x) || (m1.end.y != m2.end.y)) {
      smove.appear.push(m1.appear[0]);
      smove.appear.push(m2.appear[0]);
      if (m1.appear.length == 2) {
        smove.appear.push(m1.appear[1]);
        smove.vanish.push(m1.vanish[1]);
      }
      else if (
        m1.vanish.length == 2 &&
        (
          m1.vanish[1].x != m2.start.x ||
          m1.vanish[1].y != m2.start.y
        )
      ) {
        smove.vanish.push(m1.vanish[1]);
      }
      if (m2.appear.length == 2) {
        smove.appear.push(m2.appear[1]);
        smove.vanish.push(m2.vanish[1]);
      }
      else if (
        m2.vanish.length == 2 &&
        (
          m2.vanish[1].x != m1.start.x ||
          m2.vanish[1].y != m1.start.y
        )
      ) {
        smove.vanish.push(m2.vanish[1]);
      }
    }
    else {
      if (m1.vanish.length == 1 && m2.vanish.length == 1) {
        const p1 = m1.vanish[0].p;
        const p2 = m2.vanish[0].p;
        if ([p1, p2].includes(V.KING)) {
          smove.appear.push({
            x: m1.end.x,
            y: m1.end.y,
            p: V.KING,
            c: (p1 == V.KING ? 'w' : 'b')
          });
        }
      }
      else {
        const selfCaptureMove =
          m1.vanish[1].c == m1.vanish[0].c
            ? m1
            : m2;
        smove.appear.push({
          x: m1.end.x,
          y: m1.end.y,
          p: selfCaptureMove.appear[0].p,
          c: selfCaptureMove.vanish[0].c
        });
        smove.vanish.push({
          x: m1.end.x,
          y: m1.end.y,
          p: selfCaptureMove.vanish[1].p,
          c: selfCaptureMove.vanish[0].c
        });
      }
    }
    return smove;
  }
resolveSynchroneMove ( move ) { const m1 = this . whiteMove ; const m2 = move ; let smove = { appear : [ ] , vanish : [ m1 . vanish [ 0 ] , m2 . vanish [ 0 ] ] } ; if ( ( m1 . end . x != m2 . end . x ) || ( m1 . end . y != m2 . end . y ) ) { smove . appear . push ( m1 . appear [ 0 ] ) ; smove . appear . push ( m2 . appear [ 0 ] ) ; if ( m1 . appear . length == 2 ) { smove . appear . push ( m1 . appear [ 1 ] ) ; smove . vanish . push ( m1 . vanish [ 1 ] ) ; } else if ( m1 . vanish . length == 2 && ( m1 . vanish [ 1 ] . x != m2 . start . x || m1 . vanish [ 1 ] . y != m2 . start . y ) ) { smove . vanish . push ( m1 . vanish [ 1 ] ) ; } if ( m2 . appear . length == 2 ) { smove . appear . push ( m2 . appear [ 1 ] ) ; smove . vanish . push ( m2 . vanish [ 1 ] ) ; } else if ( m2 . vanish . length == 2 && ( m2 . vanish [ 1 ] . x != m1 . start . x || m2 . vanish [ 1 ] . y != m1 . start . y ) ) { smove . vanish . push ( m2 . vanish [ 1 ] ) ; } } else { if ( m1 . vanish . length == 1 && m2 . vanish . length == 1 ) { const p1 = m1 . vanish [ 0 ] . p ; const p2 = m2 . vanish [ 0 ] . p ; if ( [ p1 , p2 ] . includes ( V . KING ) ) { smove . appear . push ( { x : m1 . end . x , y : m1 . end . y , p : V . KING , c : ( p1 == V . KING ? 'w' : 'b' ) } ) ; } } else { const selfCaptureMove = m1 . vanish [ 1 ] . c == m1 . vanish [ 0 ] . c ? m1 : m2 ; smove . appear . push ( { x : m1 . end . x , y : m1 . end . y , p : selfCaptureMove . appear [ 0 ] . p , c : selfCaptureMove . vanish [ 0 ] . c } ) ; smove . vanish . push ( { x : m1 . end . x , y : m1 . end . y , p : selfCaptureMove . vanish [ 1 ] . p , c : selfCaptureMove . vanish [ 0 ] . c } ) ; } } return smove ; }
White and black (partial) moves were played: merge
White and black ( partial ) moves were played : merge
// For PlayOnBoard (no need for start / end, irrelevant) // Easy case: two independant moves (which may (self-)capture) // "Captured" pieces may have moved: // Castle // Castle // Collision: // Easy case: both disappear except if one is a king // One move is a self-capture and the other a normal capture: // only the self-capture appears