From 4d75c702ea0f451da488921f17127cfafa337f56 Mon Sep 17 00:00:00 2001 From: Rachit Chahar <202151123@iiitvadodara.ac.in> Date: Fri, 10 May 2024 22:09:35 +0530 Subject: [PATCH] fix: add constants in notescript --- lib/contracts/core/game.masm | 5 +++-- lib/contracts/notes/game/fold.masm | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/contracts/core/game.masm b/lib/contracts/core/game.masm index 2430e60..88c51d5 100644 --- a/lib/contracts/core/game.masm +++ b/lib/contracts/core/game.masm @@ -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 @@ -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 diff --git a/lib/contracts/notes/game/fold.masm b/lib/contracts/notes/game/fold.masm index 2b8220c..1f4a4ce 100644 --- a/lib/contracts/notes/game/fold.masm +++ b/lib/contracts/notes/game/fold.masm @@ -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 @@ -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