I am trying to make a 1v1 card game where the player and computer take turns putting down 1 poker card per turn. In the first turn, the first card that is played will be the first current card. In the second turn, the current card in the previous turn becomes the new previous card and there is a new current card played. How do I do this?
My code below does not do this.
while (playerDeck.length > 0 && computerDeck.length > 0) {
currentCard = playerDeck.pop();
nextCard = computerDeck.pop();
previousCard = currentCard;
currentCard = nextCard;
}