-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deck: Implemented Fisher-Yates shuffling algorithm to shuffle the deck #31
Conversation
2e3e179
to
4e7c032
Compare
@sethdivyansh Please resolve merge conflicts. |
4e7c032
to
df497a0
Compare
@kuv2707 i have resolved the conflicted. |
I suggest you write a test for this in deck.test.ts Its not exactly required, but it would give you a chance to write unit tests for your logic. We use the 'jest' library for testing. The test should be in the same commit. |
df497a0
to
1c1b883
Compare
@kuv2707 i have added the shuffle deck test in deck.test.ts |
1c1b883
to
721eeb9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done!
const orderChanged = deck.some( | ||
(card, index) => card !== originalDeck[index] | ||
); | ||
expect(orderChanged).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work detecting order change!
Merged, thanks @sethdivyansh ! |
Fixes: #2
Description
Shuffled the deck using Fiesher-Yates algorithm
Checklist