start games with player ids

Fixes #1.
This commit is contained in:
Branden J Brown 2024-01-21 04:15:03 -06:00
parent 4f6e00bd3d
commit bc1685d5ee
2 changed files with 5 additions and 11 deletions

View File

@ -24,9 +24,13 @@ type Game struct {
} }
// New creates a new game started at round 1. // New creates a new game started at round 1.
func New() *Game { func New(dealer, challenger player.ID) *Game {
g := &Game{ g := &Game{
RNG: NewRNG(), RNG: NewRNG(),
PP: [2]Player{
{ID: dealer},
{ID: challenger},
},
} }
g.StartRound() g.StartRound()
return g return g

View File

@ -30,16 +30,6 @@ func (l *Lobby) Game(id GameID) *game.Game {
return l.games[id] return l.games[id]
} }
// Start starts a new game in the lobby.
func (l *Lobby) Start() GameID {
id := uuid.New()
g := game.New()
l.mu.Lock()
defer l.mu.Unlock()
l.games[id] = g
return id
}
// Finish removes a game from the lobby. // Finish removes a game from the lobby.
func (l *Lobby) Finish(id GameID) { func (l *Lobby) Finish(id GameID) {
l.mu.Lock() l.mu.Lock()