func (g *Game) addUnusedTiles(m message.Message) {
	tileStrings := make([]string, 0, len(m.Game.Board.UnusedTiles))
	for _, tID := range m.Game.Board.UnusedTileIDs {
		t, ok := m.Game.Board.UnusedTiles[tID]
		if !ok {
			g.log.Error(("could not add all unused tiles"))
			return
		}
		tileText := `"` + string(t.Ch) + `"`
		tileStrings = append(tileStrings, tileText)
		if err := g.board.AddTile(t); err != nil {
			g.log.Error("could not add unused tile(s): " + err.Error())
			return
		}
	}
	if m.Type != message.JoinGame {
		message := "adding unused tile"
		if len(tileStrings) == 1 {
			message += "s"
		}
		message += ": " + strings.Join(tileStrings, ", ")
		g.log.Info(message)
	}
}
// addUnusedTilesappends new tiles onto the game.
addUnusedTilesappends new tiles onto the game.
// addUnusedTilesappends new tiles onto the game .
func (g *Game) addUnusedTiles(m message.Message) {
	tileStrings := make([]string, 0, len(m.Game.Board.UnusedTiles))
	for _, tID := range m.Game.Board.UnusedTileIDs {
		t, ok := m.Game.Board.UnusedTiles[tID]
		if !ok {
			g.log.Error(("could not add all unused tiles"))
			return
		}
		tileText := `"` + string(t.Ch) + `"`
		tileStrings = append(tileStrings, tileText)
		if err := g.board.AddTile(t); err != nil {
			g.log.Error("could not add unused tile(s): " + err.Error())
			return
		}
	}
	if m.Type != message.JoinGame {
		message := "adding unused tile"
		if len(tileStrings) == 1 {
			message += "s"
		}
		message += ": " + strings.Join(tileStrings, ", ")
		g.log.Info(message)
	}
}
func ( g * Game ) addUnusedTiles ( m message . Message ) { tileStrings := make ( [ ] string , 0 , len ( m . Game . Board . UnusedTiles ) ) for _ , tID := range m . Game . Board . UnusedTileIDs { t , ok := m . Game . Board . UnusedTiles [ tID ] if ! ok { g . log . Error ( ( " " ) ) return } tileText := `"` + string ( t . Ch ) + `"` tileStrings = append ( tileStrings , tileText ) if err := g . board . AddTile ( t ) ; err != nil { g . log . Error ( " " + err . Error ( ) ) return } } if m . Type != message . JoinGame { message := " " if len ( tileStrings ) == 1 { message += " " } message += " " + strings . Join ( tileStrings , " " ) g . log . Info ( message ) } }
addUnusedTilesappends new tiles onto the game.
addUnusedTilesappends new tiles onto the game .