let clickable = true;
const clickButton = (event) => {
if (clickable) {
clearInterval(intervalId);
clickable = false;
const myChoice = event.target.textContent === '바위' ? 'rock'
: event.target.textContent === '가위' ? 'scissors' : 'paper';
const myScore = scoreTable[myChoice];
const computerScore = scoreTable[computerChoice];
const diff = myScore - computerScore;
if (diff === 2 || diff === -1) {
console.log('승리');
} else if (diff === -2 || diff === 1) {
console.log('패배');
} else {
console.log('무승부');
}
setTimeout(() => {
clickable = true;
intervalId = setInterval(changeComputerHand, 50);
}, 1000);
}
};