Image source: pixabay.com
What is this project about?
This contribution is made to gornanization/1k-table. If you would like to find more info - I strongly recommend reading this post first.
PR:
https://github.com/gornanization/1k-table/pull/11
Details:
Recently I was writing about covering battle case. It was about throwing cards into a table. Today I would like to continue from this point.
How about a next step?
Imagine the last trick in a battle. After assigning won cards from a trick to a player, we must follow steps:
- Move all cards (won by the players) into a deck position (as it's the end of the battle).
- Show Points View to inform people about overall score obtained by the players.
- Initialise new battle by dealing cards to a player and the stock area.
- Show Bidding View.
All steps have been covered by the provided pull request. The overall result is available here: (Sorry for lagged gif)
You guys know, that I really want this game to be as flexible as possible. I want to let the game to be recreated from any point you want. Game logic (github.com/gornanization/1k) was designed in the way we can take an advantage of it. In unit tests section I provided set of cases which recreates the game from specific point. I want to something similar in the UI.
That's why game-cases.js
file has been created. It's a simple object containing predefined state, describing the starting point of the game and actions, representing set of player actions which should be performed after game recreation. Need an example?
Each entry has it's own name. REGISTERING_PLAYERS_IN_PROGRESS
in this case. What it does is reproducing player registration phase. As you can see we have already two players registered (:16 - :17). After initialising game we should see the Players View. Then we push another registration action (:31) and observe a result.
Having such defined game case, we can recreate the state by calling:
reproduceGameCase(cases.REGISTERING_PLAYERS_IN_PROGRESS);
reproduceGameCase
function is no big deal:
initializeTable
is a general file when the entire interaction between game logic and UI logic connections is managed. Within the contribution I defined 6 game cases which covers almost each part of the game. As always, for those more curious pull request is ready.
Bye, winners!
Recent articles:
Posted on Utopian.io - Rewarding Open Source Contributors
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