forked from Aze-Cards/aze-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8347ec3
commit d551424
Showing
8 changed files
with
488 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
use.miden::account | ||
use.miden::note | ||
use.miden::contracts::wallets::basic->wallet | ||
|
||
const.CURRENT_TURN_INDEX=60 | ||
|
||
proc.play_fold | ||
push.CURRENT_TURN_INDEX exec.account::get_item | ||
# => [0, 0, 0, current_turn_index] | ||
|
||
drop drop drop | ||
# => [current_turn_index] | ||
|
||
push.9 | ||
# 9, current_turn_index | ||
add | ||
# => [current_turn_index + 9] | ||
dup #for getting the get item | ||
dup #for updating the turn | ||
# => [current_turn_index + 9, current_turn_index + 9, current_turn_index + 9] | ||
|
||
# getting the is_fold of player | ||
exec.account::get_item | ||
drop drop drop | ||
# => [is_fold, current_turn_index + 9, current_turn_index + 9] | ||
|
||
# making sure that is_fold is zero currently | ||
assertz | ||
# => [current_turn_index + 9, current_turn_index + 9] | ||
push.1 | ||
# => [1, current_turn_index + 9, current_turn_index + 9] | ||
|
||
swap padw drop movup.3 | ||
# => [current_turn_index + 9, 0, 0, 0, 1, current_turn_index + 9] | ||
exec.account::set_item | ||
dropw drop drop drop | ||
# => [current_turn_index + 9] | ||
|
||
# adding 4 will give the slot of next player | ||
push.4 add | ||
push.1 | ||
# => [1, next_turn_index] | ||
|
||
while.true | ||
|
||
dup push.9 add | ||
# => [next_turn_index + 9, next_turn_index] | ||
exec.account::get_item | ||
drop drop drop | ||
# => [is_fold, next_turn_index] | ||
|
||
if.true | ||
# if player has folded | ||
dup push.103 lte | ||
# => [0/1, next_turn_index] | ||
|
||
if.true | ||
push.13 add | ||
push.1 | ||
# => [1, next_turn_index + 13] | ||
else | ||
push.0 | ||
end | ||
else | ||
# checking is fold | ||
# => [next_turn_index] | ||
|
||
padw drop | ||
# => [0, 0, 0, next_turn_index] | ||
|
||
push.CURRENT_TURN_INDEX # slot of current turn | ||
# => [CURRENT_TURN_INDEX, 0, 0, 0, next_turn_index] | ||
|
||
exec.account::set_item | ||
dropw dropw | ||
# => [...] | ||
push.0 | ||
end | ||
end | ||
drop | ||
# => [...] | ||
end | ||
|
||
begin | ||
dropw | ||
|
||
call.play_fold | ||
# => [...] | ||
|
||
dropw | ||
exec.note::get_assets drop mem_loadw | ||
# => [ASSET, ...] | ||
|
||
# load the asset and add it to the account | ||
call.wallet::receive_asset | ||
# => [...] | ||
|
||
dropw | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.