Programming Collective Intelligence