Thousand Card Game: Increasing bid value!

in utopian-io •  last year

people with cards 2
Image source:

What is this project about?

This contribution is made to a gornanization/1k, gornanization/1k-table and gornanization/1k-client projects. If you would like to find more info - I strongly recommend reading this post first.



Here is a list of bugfixes / features /improvements applied within the contribution:

Fixing Firebase issues

Game state is stored in Google's Firebase Realtime Database. The problem is that this does not allow us to store empty arrays and falsy values.

Examples? Sure.

Thousand Card Game Logic specifies i.e. battlePoints which sits in players object. Initially it is assigned with an empty array, but firebase does not specifies it at all (as it's empty array). Game logic project (gornanization/1k) requires this value to be specified, so after loading state from Firebase, we have to make sure all data is well prepared before initialising the game. That's why new function extendStateWithDefaults has been specified within the contribution. It fixes many cases issues caused by lacking object properties, while computing game state.

Increasing bid value

As you might know, just before a trick starts (during the share stock phase), the bidding winner can increase his bid value. In order to provide such capability we have to create UI for it. I created options panel for it, as presented below:

Increase bid demo

After clicking Bid button, a specific action request is being sent to the server.

Cards UI updated

Suit colors was applied for better appearance, as well as general card view. Changes applied below:


Sorting cards

In order to improve overall client UX, I decided to sort cards. Cards are sorted by suit firstly (Hearts, Diamonds, Clubs, Spades) and eventually by rank (Ace first, Nine last). Whole cards list is also printed below the cards list, just as presented here:

More details? See PRs linked above.

Cheers, people!

Recent articles:

  1. Thousand Card Game: Connecting to the game table
  2. Thousand Card Game: The battle is over...
  3. Thousand Card Game: Refactoring 'Card' Object

Posted on - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

This was quite a short contribution, would be nice to see a little bit more in the next ones, maybe cram 2-3 features together in a contribution as most do these days.

You can contact us on Discord.

Hey @adasq I am @utopian-io. I have just upvoted you!


  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!


Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord