Skip to content

Commit

Permalink
fix: add constants in notescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Created-for-a-purpose committed May 10, 2024
1 parent 824c535 commit 4d75c70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/contracts/core/game.masm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const.CURRENT_TURN_INDEX=60 # index of the player whose turn it is currently
const.CURRENT_TURN_PLAYER_PUB_KEY_INDEX=60 # need to check it's storage initially small blind public key on slot 62
const.CURRENT_PHASE=62 # whole game is divided into 4 phases
const.PLAYER_STATS_SLOTS=13
const.CARDS_SLOTS=52

# game events
# TODO: fix some storage for the value corresponding to these events
Expand Down Expand Up @@ -286,8 +287,8 @@ export.play_fold
# => [no_of_players, next_turn_index]

# Calculate last_player_index = 52 + 13 * no_of_players + 0
push.13 mul
push.52 add
push.PLAYER_STATS_SLOTS mul
push.CARDS_SLOTS add
# => [last_player_index, next_turn_index]

mem_store.0
Expand Down
5 changes: 3 additions & 2 deletions lib/contracts/notes/game/fold.masm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use.miden::contracts::wallets::basic->wallet
const.NO_OF_PLAYERS_INDEX=57
const.CURRENT_TURN_INDEX=60
const.PLAYER_STATS_SLOTS=13
const.CARDS_SLOTS=52

proc.play_fold
push.CURRENT_TURN_INDEX exec.account::get_item
Expand Down Expand Up @@ -48,8 +49,8 @@ proc.play_fold
# => [no_of_players, next_turn_index]

# Calculate last_player_index = 52 + 13 * no_of_players + 0
push.13 mul
push.52 add
push.PLAYER_STATS_SLOTS mul
push.CARDS_SLOTS add
# => [last_player_index, next_turn_index]

mem_store.0
Expand Down

0 comments on commit 4d75c70

Please sign in to comment.