Skip to content

Commit

Permalink
fixing last bet info
Browse files Browse the repository at this point in the history
  • Loading branch information
ardan-bkennedy committed Oct 3, 2024
1 parent f86fbcf commit cbc8e12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
12 changes: 7 additions & 5 deletions app/cli/liars/board/draw.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ func (b *Board) drawBoard(status engine.State) {
}

// Last Bets.
if cup.LastBet.Number != 0 {
bet := fmt.Sprintf("%d %-10s", cup.LastBet.Number, words[cup.LastBet.Suit])
b.print(betX, addrY, bet)
} else {
b.print(betX, addrY, " ")
for i := len(status.Bets) - 1; i >= 0; i-- {
bet := status.Bets[i]
if bet.AccountID == cup.AccountID {
betStr := fmt.Sprintf("%d %-10s", bet.Number, words[bet.Suit])
b.print(betX, addrY, betStr)
break
}
}

// Balance Column.
Expand Down
7 changes: 3 additions & 4 deletions app/services/engine/handlers/gamegrp/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ func toAppBet(bet game.Bet) appBet {
}

type appCup struct {
Player common.Address `json:"account"`
Dice []int `json:"dice"`
LastBet appBet `json:"lastBet"`
Outs int `json:"outs"`
Player common.Address `json:"account"`
Dice []int `json:"dice"`
Outs int `json:"outs"`
}

func toAppCup(cup game.Cup, dice []int) appCup {
Expand Down

0 comments on commit cbc8e12

Please sign in to comment.