func (jb jsonBoard) Board() *Board {
	var b Board
	b.UnusedTiles = make(map[tile.ID]tile.Tile, len(jb.Tiles))
	b.UnusedTileIDs = make([]tile.ID, 0, len(jb.Tiles))
	for _, t := range jb.Tiles {
		b.UnusedTiles[t.ID] = t
		b.UnusedTileIDs = append(b.UnusedTileIDs, t.ID)
	}
	b.UsedTiles = make(map[tile.ID]tile.Position, len(jb.TilePositions))
	b.UsedTileLocs = make(map[tile.X]map[tile.Y]tile.Tile)
	for _, tp := range jb.TilePositions {
		b.UsedTiles[tp.Tile.ID] = tp
		if _, ok := b.UsedTileLocs[tp.X]; !ok {
			b.UsedTileLocs[tp.X] = make(map[tile.Y]tile.Tile)
		}
		b.UsedTileLocs[tp.X][tp.Y] = tp.Tile
	}
	if jb.Config != nil {
		b.Config = *jb.Config
	}
	return &b
}
// Board creates a new Board from the JsonBoard.
Board creates a new Board from the JsonBoard.
// Board creates a new Board from the JsonBoard .
func (jb jsonBoard) Board() *Board {
	var b Board
	b.UnusedTiles = make(map[tile.ID]tile.Tile, len(jb.Tiles))
	b.UnusedTileIDs = make([]tile.ID, 0, len(jb.Tiles))
	for _, t := range jb.Tiles {
		b.UnusedTiles[t.ID] = t
		b.UnusedTileIDs = append(b.UnusedTileIDs, t.ID)
	}
	b.UsedTiles = make(map[tile.ID]tile.Position, len(jb.TilePositions))
	b.UsedTileLocs = make(map[tile.X]map[tile.Y]tile.Tile)
	for _, tp := range jb.TilePositions {
		b.UsedTiles[tp.Tile.ID] = tp
		if _, ok := b.UsedTileLocs[tp.X]; !ok {
			b.UsedTileLocs[tp.X] = make(map[tile.Y]tile.Tile)
		}
		b.UsedTileLocs[tp.X][tp.Y] = tp.Tile
	}
	if jb.Config != nil {
		b.Config = *jb.Config
	}
	return &b
}
func ( jb jsonBoard ) Board ( ) * Board { var b Board b . UnusedTiles = make ( map [ tile . ID ] tile . Tile , len ( jb . Tiles ) ) b . UnusedTileIDs = make ( [ ] tile . ID , 0 , len ( jb . Tiles ) ) for _ , t := range jb . Tiles { b . UnusedTiles [ t . ID ] = t b . UnusedTileIDs = append ( b . UnusedTileIDs , t . ID ) } b . UsedTiles = make ( map [ tile . ID ] tile . Position , len ( jb . TilePositions ) ) b . UsedTileLocs = make ( map [ tile . X ] map [ tile . Y ] tile . Tile ) for _ , tp := range jb . TilePositions { b . UsedTiles [ tp . Tile . ID ] = tp if _ , ok := b . UsedTileLocs [ tp . X ] ; ! ok { b . UsedTileLocs [ tp . X ] = make ( map [ tile . Y ] tile . Tile ) } b . UsedTileLocs [ tp . X ] [ tp . Y ] = tp . Tile } if jb . Config != nil { b . Config = * jb . Config } return & b }
Board creates a new Board from the JsonBoard.
Board creates a new Board from the JsonBoard .