{"size": 1117, "ext": "js", "max_stars_repo_path": "code/index.js", "max_stars_repo_name": "HenrikeW/gamebalancer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "code/index.js", "max_issues_repo_name": "HenrikeW/gamebalancer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "code/index.js", "max_forks_repo_name": "HenrikeW/gamebalancer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.2708333333, "max_line_length": 73, "alphanum_fraction": 0.6857654432}
let playerOneTime = 0;
let playerTwoTime = 0;

let playerOneInterval;
let playerTwoInterval;

// Handle player one's buttons

const startPlayerOneTurn = () => {

  const countPlayerOneTime = () => {
    if (playerTwoTime > 0) {
      playerTwoTime = playerTwoTime - 1;
      document.getElementById("playerTwoTime").innerHTML = playerTwoTime;
    } else {
      playerOneTime += 1,
      document.getElementById("playerOneTime").innerHTML = playerOneTime;
    }
  }
  
  playerOneInterval = setInterval(countPlayerOneTime, 1000);
}

const stopPlayerOneTurn = () => {
  clearInterval(playerOneInterval);
}

// Handle player two's buttons

const startPlayerTwoTurn = () => {

  const countPlayerTwoTime = () => {
    if (playerOneTime > 0) {
      playerOneTime = playerOneTime - 1;
      document.getElementById("playerOneTime").innerHTML = playerOneTime;
    } else {
      playerTwoTime += 1,
      document.getElementById("playerTwoTime").innerHTML = playerTwoTime;
    }
  }
  
  playerTwoInterval = setInterval(countPlayerTwoTime, 1000);
}

const stopPlayerTwoTurn = () => {
  clearInterval(playerTwoInterval);
}
