Emergent collective intelligence from massive-agent cooperation and competition