| @@ -24,9 +24,13 @@ type Game struct { | ||||
| } | ||||
|  | ||||
| // New creates a new game started at round 1. | ||||
| func New() *Game { | ||||
| func New(dealer, challenger player.ID) *Game { | ||||
| 	g := &Game{ | ||||
| 		RNG: NewRNG(), | ||||
| 		PP: [2]Player{ | ||||
| 			{ID: dealer}, | ||||
| 			{ID: challenger}, | ||||
| 		}, | ||||
| 	} | ||||
| 	g.StartRound() | ||||
| 	return g | ||||
|   | ||||
| @@ -30,16 +30,6 @@ func (l *Lobby) Game(id GameID) *game.Game { | ||||
| 	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. | ||||
| func (l *Lobby) Finish(id GameID) { | ||||
| 	l.mu.Lock() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user