Skip to content

Commit

Permalink
Update memory.fg
Browse files Browse the repository at this point in the history
  • Loading branch information
cl4cnam authored Jul 29, 2023
1 parent 459b8ad commit b1c0b11
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion memory.fg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def makeCardDeck(p_numberOfCopy):
def shuffleCards(p_cardDeck):
# shuffle the deck
js (p_cardDeck):
p_cardDeck.sort(() => Math.random() - 0.5);
//~ copied from https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
for (let i = p_cardDeck.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[p_cardDeck[i], p_cardDeck[j]] = [p_cardDeck[j], p_cardDeck[i]];
}

def distributeCards(p_cardDeck):
# place all the cards face downward onto the game table
Expand Down Expand Up @@ -90,6 +94,8 @@ while not isNovalue(anyCard):
#----------------------
if allEqual(anyClickedCard.face):
print('OK')
js (anyClickedCard):
anyClickedCard.cardElement.classList.add('OK')
anyCard := valuesFrom(anyCard, 'butNotFrom', anyClickedCard)
else:
print('Missed')
Expand Down

0 comments on commit b1c0b11

Please sign in to comment.