Skip to content

Commit

Permalink
engine: resolved temporary eslint error
Browse files Browse the repository at this point in the history
  • Loading branch information
RashiJyotishi committed Jun 2, 2024
1 parent 4470090 commit 1d23196
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions backend/uno-game-engine/deck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export function makeCard(
* Time complexity: O(n)
*/
// elint-disable-next-line
export function shuffle(deck: Array<any>) {
//todo: Implement a generic shuffling algorithm
[deck[0], deck[1]] = [deck[1], deck[0]];
export function shuffle(deck: Array<UNOCard>) {
// Fisher-Yates shuffle algorithm to shuffle card deck
for (let i = deck.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * i);
[deck[i], deck[j]] = [deck[j], deck[i]];
}
}

0 comments on commit 1d23196

Please sign in to comment.