Overview
We are going to test this particular betting flow. These tests should suffice, then you can add your other arbitrary tests, if any.
What do I do?
See this betting flow, it should be tested:
On Start
- This is a bet between, say, four players...
- Initialize the game, and the game starts
Pass Criteria: The small_blind SHOULD BE DEDUCTED FROM THE PLAYER NEXT TO THE DEALER AUTOMATICALLY. (say player i)
- The next player should be set, so
player i should try playing again... it should panic
- Now play a random bet between the
small_blind amount and the big_blind amount with player i + 1, this should panic.
- Play any amount >= the
big_blind with player i + 1, it should go through, and the next_player should be set. Test this for amount = big_blind and amount greater > big_blind... meaning that the call should deduct the big blind, and raise should deduct greater. Make sure both goes through
- Test the raise, and the raise should panic on any
amount <= big_blind.
In addition to the above
Say, all players have different amounts, now I want to feign an all in...
Anytime a player goes all_in, the player remains in the betting round, doesn't matter if the player has funds to stake, because, of course, the player just went all in, it's not the player's fault not to have funds to keep betting at that point in time.
player 1 to player 3 have equalled their bets, say 50 each, and player 4 raises to a bigger amount, say 70. Here, the betting round continues because all four players bets are not matched.
player 1 "calls" this amount, player 2 raises to 90, and player 3 goes all in of 55.
- The pot must be adjusted accordingly in the game. Continue the betting round, and assert that player 3's eligible pots is
1 and the rest are 2
- Continue the betting round, match all bets, and start a new betting round
- For the above, when it after player2 plays, you must check the game's
next_player. The value should not be player3.
- Try playing with player 3, it should panic
- Nevertheless, you must assert that
player3.in_round && player3.is_in_game(game_id) returns true
- Your task ends here
This task involves gameplay, so you must initialize a scenario to start the gameplay, or you use the default setup in setup.cairo, and add one more player. As it involves gameplay, please all repeated code must be extracted into reusable functions. VERY NECESSARY.
May the force be with you ☪️⛩️
Furthermore?
- The target branch is the v1 branch.
- Please when applying, state whether you’re new to the whole language and all. If you are, I could help you steadily (Though it’ll stress me out)… if you aren’t, better for me… I’ll leave everything in your hands 😌, and you won’t be permitted to paste errors in my dm.
- Your code must be strongly typed for better readability please 🙏🏻
- Please use all available traits possible at your disposal
- Document your code please, in a professional manner. Please avoid using too many small comments as you should know, only comment on hard to understand logic, and maybe some explanations on how and why it works
- When done, @ your username in a comment on top of the function you touched. If there's one there already, append with a comma and a space. (
// @ExistingUsername, @YourUsername, etc)... It's cooler to leave your signature behind, yes? 😋
- Each
// should be accompanied by a space, before typing, lock in.
- Please avoid code repitition. There may be lines of codes that would be reused, please extract them into a separate function. Lock in your good PR quality please 🙏🏻
- May the force be with you ☪️✋🏻
- Ofcourse, if you have any questions (Which I bet you'd have, one billion per cent), you can branch here or here. Happy Hacks 😊💙
Help?
"I made it here, and I will guide this passage all the way to the farthest ends of the earth. The stormiest seas will not stop me." --Pirate Gol D. Roger.
Overview
We are going to test this particular betting flow. These tests should suffice, then you can add your other arbitrary tests, if any.
What do I do?
See this betting flow, it should be tested:
On Start
Pass Criteria: The small_blind SHOULD BE DEDUCTED FROM THE PLAYER NEXT TO THE DEALER AUTOMATICALLY. (say
player i)player ishould try playing again... it should panicsmall_blindamount and thebig_blindamount withplayer i + 1, this should panic.big_blindwithplayer i + 1, it should go through, and thenext_playershould be set. Test this foramount = big_blindand amountgreater > big_blind... meaning that thecallshould deduct the big blind, andraiseshould deduct greater. Make sure both goes throughamount <= big_blind.In addition to the above
Say, all players have different amounts, now I want to feign an
all in...Anytime a player goes
all_in, the player remains in the betting round, doesn't matter if the player has funds to stake, because, of course, the player just went all in, it's not the player's fault not to have funds to keep betting at that point in time.player 1toplayer 3have equalled their bets, say 50 each, andplayer 4raises to a bigger amount, say 70. Here, the betting round continues because all four players bets are not matched.player 1"calls" this amount, player 2 raises to 90, and player 3 goes all in of 55.1and the rest are2next_player. The value should not be player3.player3.in_round && player3.is_in_game(game_id)returnstrueThis task involves gameplay, so you must initialize a scenario to start the gameplay, or you use the default setup in
setup.cairo, and add one more player. As it involves gameplay, please all repeated code must be extracted into reusable functions. VERY NECESSARY.May the force be with you ☪️⛩️
Furthermore?
// @ExistingUsername, @YourUsername, etc)... It's cooler to leave your signature behind, yes? 😋//should be accompanied by a space, before typing, lock in.Help?
"I made it here, and I will guide this passage all the way to the farthest ends of the earth. The stormiest seas will not stop me." --Pirate Gol D. Roger.