dkforest

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

commit 8cac9623e4bcffd0c884f78a720f4e4c8a4048fb
parent 0bbdf4d61013ed946e60e7dd343fc522810b49bd
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 18 Dec 2023 05:41:51 -0500

round half to even

Diffstat:
Mpkg/web/handlers/poker/poker.go | 3++-
Mpkg/web/public/views/pages/poker.gohtml | 2+-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -11,6 +11,7 @@ import ( "github.com/chehsunliu/poker" "github.com/labstack/echo" "github.com/sirupsen/logrus" + "math" "math/rand" "net/http" "sort" @@ -1191,7 +1192,7 @@ func processPot(winners []GameResult, mainPot, pokerTableMinBet database.PokerCh if collectRake { maxRake := pokerTableMinBet * 15 - rake = database.PokerChip(rakePct * float64(mainPot)) + rake = database.PokerChip(math.RoundToEven(rakePct * float64(mainPot))) rake = utils.MinInt(rake, maxRake) // Max rake mainPot -= rake } diff --git a/pkg/web/public/views/pages/poker.gohtml b/pkg/web/public/views/pages/poker.gohtml @@ -14,7 +14,7 @@ </div> 1 <small>XMR</small> == {{ .Data.XmrPrice }}<br /> 0.01 <small>XMR</small> == 1,000 <small>chips</small><br /> - rake is max 4.5% (rounded down)<br /> + rake is max 4.5% (round half to even)<br /> rake is capped at 15*big_blind<br /> 2 confirmations needed for deposits under 0.2 XMR (~4min)<br /> 10 confirmations needed for deposits over 0.2 XMR (~20min)<br />