dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit f278919bdbb899aec82af35ba4147c593490a05c
parent 08ab4c4e246d123daba5972647364732c85b37f4
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon,  4 Dec 2023 23:24:13 -0500

cleanup

Diffstat:
Mpkg/web/handlers/poker.go | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pkg/web/handlers/poker.go b/pkg/web/handlers/poker.go @@ -17,6 +17,7 @@ import ( const NbPlayers = 6 const MaxUserCountdown = 10 +const MinTimeAfterGame = 10 type Poker struct { sync.Mutex @@ -156,8 +157,8 @@ func (g *PokerGame) Deal(roomID string) { idx := 0 burnCard := func(pos int) { + card = g.Ongoing.Deck[idx] idx++ - card, g.Ongoing.Deck = g.Ongoing.Deck[0], g.Ongoing.Deck[1:] evt := PokerEvent{ ID: "card" + strconv.Itoa(idx), Name: "", @@ -171,8 +172,8 @@ func (g *PokerGame) Deal(roomID string) { } dealCard := func(pos int) { + card = g.Ongoing.Deck[idx] idx++ - card, g.Ongoing.Deck = g.Ongoing.Deck[0], g.Ongoing.Deck[1:] evt := PokerEvent{ ID: "card" + strconv.Itoa(idx), Name: card, @@ -192,8 +193,8 @@ func (g *PokerGame) Deal(roomID string) { } d := seats[i] time.Sleep(time.Second) + card = g.Ongoing.Deck[idx] idx++ - card, g.Ongoing.Deck = g.Ongoing.Deck[0], g.Ongoing.Deck[1:] name := "" left := d.Left top := d.Top @@ -260,7 +261,7 @@ func (g *PokerGame) Deal(roomID string) { waitPlayersActionFn() // Wait a minimum of X seconds before allowing a new game - time.Sleep(10 * time.Second) + time.Sleep(MinTimeAfterGame * time.Second) g.IsGameOver = true fmt.Println("GAME IS OVER") }()