Skip to content

Commit

Permalink
Remove redundant updates to hands_played and hands_left
Browse files Browse the repository at this point in the history
  • Loading branch information
DivvyCr committed Aug 18, 2024
1 parent 2fed466 commit 6b92972
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions Mods/DVSimulate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ DV.SIM = {
orig = {
--- Table to store game data that gets modified during simulation:
random_data = {}, -- G.GAME.pseudorandom
hands_played = 0, -- G.GAME.current_round.hands_played
hands_left = 0, -- G.GAME.current_round.hands_left
hand_data = {} -- G.GAME.hands
},

Expand Down Expand Up @@ -192,26 +190,18 @@ function DV.SIM.manage_state(save_or_restore)

if save_or_restore == "SAVE" then
DVSO.random_data = copy_table(G.GAME.pseudorandom)
DVSO.hands_played = G.GAME.current_round.hands_played
DVSO.hands_left = G.GAME.current_round.hands_left
DVSO.hand_data = copy_table(G.GAME.hands)
return
end

if save_or_restore == "RESTORE" then
G.GAME.pseudorandom = DVSO.random_data
G.GAME.current_round.hands_played = DVSO.hands_played
G.GAME.current_round.hands_left = DVSO.hands_left
G.GAME.hands = DVSO.hand_data
return
end
end

function DV.SIM.update_state_variables()
-- Increment hands played this round:
G.GAME.current_round.hands_played = G.GAME.current_round.hands_played + 1
G.GAME.current_round.hands_left = G.GAME.current_round.hands_left - 1

-- Increment poker hand played this run/round:
local hand_info = G.GAME.hands[DV.SIM.env.scoring_name]
hand_info.played = hand_info.played + 1
Expand Down

0 comments on commit 6b92972

Please sign in to comment.