What is this project about?
This contribution is made to gornanization/1k. If you would like to find more info - I strongly recommend reading this post first.
PR:
https://github.com/gornanization/1k/pull/34
Details:
I just realised, that bidding process should be extended. Why? It's not entirely true, that a player can make a bid only during BIDDING_IN_PROGRESS
phase...
Imagine case, when player wins bidding process. When we have bidding process done, game logic makes a transition from BIDDING_IN_PROGRESS
into BIDDING_FINISHED
. Then through stock cards management and finally into BATTLE_START
. But, during this transition, player who have won bidding might still increase his bid value. It is not allowed now, so within this contribution I want to fix it.
What should we do?
I was thinking about extending bid
action. But I have realised quickly, that it might overcomplicate this validator, so preparing separated action for it seemd to be better option.
I have chosen name for it, increaseBid
. What is does is basically the same as bid
. It puts another entry into bid
array.
As its totally separated action, we have to create appropriate validator for it, canIncreaseBid
. Its logic is way complicated comparing to action itself. A couple of things should be considered before allowing player to increase bid:
- Is it allowed phase (we can increase bid only at phases:
BIDDING_FINISHED
,SHARE_STOCK
,ASSIGN_STOCK
,BATTLE_START
,TRICK_START
orTRICK_IN_PROGRESS
)? - Is bid value valid?
- Has the player already won bidding phase?
- Is bid value higher than last one?
- If bid value is more than 120 points, has the player have a trump pair?
- Is it a first trick, without any card thrown into the table?
If so, we can increase bid value. Within the contribution I have also provided public API unit tests to check whether it works as designed from API user perspective...
More details in pull request.
That's it for today, dear players!
See you soon!
Posted on Utopian.io - Rewarding Open Source Contributors
Congratulations @adasq! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the total payout received
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @adasq I am @utopian-io. I have just upvoted you!
Achievements
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 https://discord.gg/Pc8HG9x
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit