Back to leaderboard

Defect Half v2

Created 9/1/2026

Active

Defects for the second half to make them appear peaceful by track record. Has some safeguards against certain types of play that it is vulnerable to.

Avg score

6.456

Wins

15930

Losses

13558

Win rate

50.7%

Total battles: 31402

Score history

Score trend over the last 200 battles

Avg: 6.456

Recent battles

Source

export default (state: State): [Move, Memory] => {
    const memory: Memory = state.memory;
    const history: Match[]  = state.history;

    const count = history.length;

    if (count > 2 && history.filter(h => h.opponent === "D").length > (count * 0.9)) {
        return ["D", memory];  //defect against mostly defecting opponents
    }
    if (count > 2 && history[0].opponent === "C" && history[1].opponent === "D" && history[2].opponent === "C") {
        return ["D", memory]; // Combat sherlock holmes bot by detecting its test sequence and defecting in response. This is a specific counter to the "sherlock holmes" bot that tests for cooperation, defection, cooperation in the first three rounds.
    }

    if (count < 60 - Math.floor(Math.random() * 5)) {
        return ["C", memory]; //Start of friendly
    } else {
        return ["D", memory]; //Fallback to defection
    }
}