tujikawa - 2012-12-16

The piece selection algorithm is abstracted to the interface class PieceSelector class. By default, BitTorrent download uses the subclass RarestPieceSelector which selects the rarest pieces among others. You can implement the new algorithm in the new sublcass and hook it up to DefaultPieceStorage.
I think it would be good to add the option to choose the algorithm by the user.

What kind of the piece selection algorithm do you want to implement?
If it is just select the piece with smallest index, then it is very easily accomplished.