def _get_pieces(tiles, ports, players_opts, pieces_opts):
if pieces_opts == Opt.empty:<EOL><INDENT>return dict()<EOL><DEDENT>elif pieces_opts == Opt.debug:<EOL><INDENT>players = catan.game.Game.get_debug_players()<EOL>return {<EOL>(hexgrid.NODE, <NUM_LIT>): catan.pieces.Piece(catan.pieces.PieceType.settlement, players[<NUM_LIT:0>]),<EOL>(hexgrid.EDGE, <NUM_LIT>): catan.pieces.Piece(catan.pieces.PieceType.road, players[<NUM_LIT:0>]),<EOL>(hexgrid.NODE, <NUM_LIT>): catan.pieces.Piece(catan.pieces.PieceType.settlement, players[<NUM_LIT:1>]),<EOL>(hexgrid.EDGE, <NUM_LIT>): catan.pieces.Piece(catan.pieces.PieceType.road, players[<NUM_LIT:1>]),<EOL>(hexgrid.NODE, <NUM_LIT>): catan.pieces.Piece(catan.pieces.PieceType.settlement, players[<NUM_LIT:2>]),<EOL>(hexgrid.EDGE, <NUM_LIT>): catan.pieces.Piece(catan.pieces.PieceType.road, players[<NUM_LIT:2>]),<EOL>(hexgrid.EDGE, <NUM_LIT>): catan.pieces.Piece(catan.pieces.PieceType.road, players[<NUM_LIT:3>]),<EOL>(hexgrid.TILE, <NUM_LIT>): catan.pieces.Piece(catan.pieces.PieceType.robber, None),<EOL>}<EOL><DEDENT>elif pieces_opts in (Opt.preset, ):<EOL><INDENT>deserts = filter(lambda tile: tile.terrain == catan.board.Terrain.desert, tiles)<EOL>coord = hexgrid.tile_id_to_coord(list(deserts)[<NUM_LIT:0>].tile_id)<EOL>return {<EOL>(hexgrid.TILE, coord): catan.pieces.Piece(catan.pieces.PieceType.robber, None)<EOL>}<EOL><DEDENT>elif pieces_opts in (Opt.random, ):<EOL><INDENT>logging.warning('<STR_LIT>'.format(pieces_opts))<EOL><DEDENT>
Generate a dictionary of pieces using the given options.

pieces options supported:
- Opt.empty -> no locations have pieces
- Opt.random ->
- Opt.preset -> robber is placed on the first desert found
- Opt.debug -> a variety of pieces are placed around the board

:param tiles: list of tiles from _generate_tiles
:param ports: list of ports from _generate_ports
:param players_opts: Opt
:param pieces_opts: Opt
:return: dictionary mapping (hexgrid.TYPE, coord:int) -> Piece