-
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
Make it possible to uniquely identify cards #4
Comments
While UUID is not a bad option, it would probably not make sense for us, considerng there are only 108 possible options. And we'd need to save this information somewhere. Instead we could use a certain scheme so that the id itself encodes some information, so something like red-skip, blue-reverse, green-2 |
@kuv2707 Could you please suggest what sort of unique-id should we prefer to assign to the cards |
#14 Provides a viable solution. The problem with uuids is that they would be a little slow, and since we only have a very bounded and predictable set of 108 cards, it makes sense to use a simpler id generation scheme. Also, it saves us from adding a dependency. |
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes #4
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4 backend:deck.ts This commit involves one preperatory commit : adding wild color to CardColors Added deck generation function to initialize the deck according to given constraints The function generates cards and push them the deck array generating cards of each color and also wild cards Also have checked the deck composition with jest tests Fixes :shivansh-bhatnagar18#1
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4
Added wild color for wild cards like colchange and draw4 cards these changes are made in types.d.ts backend:deck.ts This commit involves one preperatory commit : adding wild color to CardColors Added deck generation function to initialize the deck according to given constraints The function generates cards and push them the deck array generating cards of each color and also wild cards Also have checked the deck composition with jest tests Fixes :shivansh-bhatnagar18#1 deck: Assigned unique id to each card. - Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4
- Globally exposed the GameEngine type. - Declared types pertaining to game events. api: Implement server side of long polling. This commit adds a handler for GET /events which stores the response object for the client for emitting events in the future. engine: Implement structure for game event handling. Created a module to deal with executing events on the game object. prettier: Use LF for line endings. deck: Assigned unique id to each card. - Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4 deck: Implemented Fisher-Yates shuffling algorithm to shuffle the deck Fixes: shivansh-bhatnagar18#2 lint: Fix prettier and eslint conflict. The two systems conflicted over indentations in switch case. typescript: Add some compiler options.
- Created an ID in the format `card-type-color-value`. - Added a `sameCardCount` array to uniquely identify cards of the same type and color. - Generated a unique ID using the format `card-type-color-value-sameCardCount[id]`. Fixes shivansh-bhatnagar18#4
Description
The
makeCard
function indeck.js
should assign a unique id to each card to ensure each card can be uniquely identified.Current Code Snippet
Expected Output
Each card object returned by makeCard should include a unique id property.
Some discussion is needed on the type of unique identification used. We can choose from UUID, random numbers etc.
Please propose your approach here and you will be assigned accordingly.
Notes
The text was updated successfully, but these errors were encountered: