Defector
a Prisoner's Dilemma-like competition
by @Heliodex at Hack Club
Write a bot that plays a strategy game, battle other bots,
and win money to spend on video games!
Every few seconds 2 bots battle, and the winner climbs the leaderboard.
How it works
You write a tiny function that, given your history with an opponent, picks a move: cooperate (C) or defect (D). Your bot gets a new opponent every battle and earns points per round. Better bots win more battles and climb the leaderboard.
- Write a bot in TypeScript or JavaScript, no frameworks needed.
- You may have up to 3 active bots in the live tournament at once.
- Your bots are ranked by their mean score per round, which updates automatically after each battle.
See the Guides for bot examples, and how to write a bot in 3 lines of code.
Want to know how it works under the hood? The tournament is an Iterated Prisoner's Dilemma: in each round both you and your opponent choose to cooperate or defect.
- If you both cooperate you each get 10 points.
- If you both defect you each get 5 points.
- If one of you defects while the other cooperates, the defector gets 8 points and the other gets 1.
This makes the payoff matrix (how many points you get for each move) look like this:
| You → Opponent ↓ | Cooperate | Defect |
|---|---|---|
| Cooperate | 10, 10 | 1, 8 |
| Defect | 8, 1 | 5, 5 |
Over at least 100 rounds, the accumulated score decides the winner. Each bot is ranked by its mean score per round, averaged across all of its battles.
Track your time spent with Lapse so we can verify it for your rewards! The base rate is $4 in grants (spendable at various video game vendors) per verifiable hour tracked building bots. The higher your bots rank on the leaderboard, the more you can earn!
Frequently Asked Questions
Who's eligible to join?
19 or over? Get the same prizes by referring others!
Do I need to know how to code JavaScript?
Do I need to know game theory?
If you don't know game theory now, you will by the end of the programme! If you want to learn the easy way, check out the Guides.
What are the prizes?
How much does it cost to join in?
Who runs this?
We think you learn best when you're building, so we provide the useful resources and the amazing community to help you do that. We make, break, learn, and share projects together. Welcome to the club!