function changePlayer() {
  if (counterInPlay == "X") {
    counterInPlay = "Y";
    counterOpposition = "X"
  } else if (counterInPlay == "Y") {
    counterInPlay = "X";
    counterOpposition = "Y";
  }

  kingPlayer = counterInPlay.concat(counterInPlay)

  //Change the turn of the player in the server
  fetch('/changeTurn', {
      method: 'POST',
      headers: new Headers({
        'Content-Type': 'application/json'
      }),
      body: JSON.stringify({
        counterInPlay,
        counterOpposition,
        kingPlayer
      })
    })
    .catch(err => console.log(err));

  resetTurn()
}
/**
 * @function changePlayer - Change the player when their turn has ended.
 */
@function changePlayer - Change the player when their turn has ended.
@function changePlayer - Change the player when their turn has ended .
function changePlayer() {
  if (counterInPlay == "X") {
    counterInPlay = "Y";
    counterOpposition = "X"
  } else if (counterInPlay == "Y") {
    counterInPlay = "X";
    counterOpposition = "Y";
  }
  kingPlayer = counterInPlay.concat(counterInPlay)
  fetch('/changeTurn', {
      method: 'POST',
      headers: new Headers({
        'Content-Type': 'application/json'
      }),
      body: JSON.stringify({
        counterInPlay,
        counterOpposition,
        kingPlayer
      })
    })
    .catch(err => console.log(err));
  resetTurn()
}
function changePlayer ( ) { if ( counterInPlay == "X" ) { counterInPlay = "Y" ; counterOpposition = "X" } else if ( counterInPlay == "Y" ) { counterInPlay = "X" ; counterOpposition = "Y" ; } kingPlayer = counterInPlay . concat ( counterInPlay ) fetch ( '/changeTurn' , { method : 'POST' , headers : new Headers ( { 'Content-Type' : 'application/json' } ) , body : JSON . stringify ( { counterInPlay , counterOpposition , kingPlayer } ) } ) . catch ( err => console . log ( err ) ) ; resetTurn ( ) }
@function changePlayer - Change the player when their turn has ended.
@function changePlayer - Change the player when their turn has ended .
//Change the turn of the player in the server