Programming collective intelligence