Back to leaderboard

RanBot3006

Created 9/5/2026

Active

Bot that randomly moves if the opponent isnt predictable

Avg score

4.808

Wins

6839

Losses

15115

Win rate

29.1%

Total battles: 23538

Score history

Score trend over the last 200 battles

Avg: 4.808

Recent battles

Source

export default function bot({ history, memory }) {
    if (!memory) {
        memory = {};
    }
    if (history.length === 0) {
        return ['C', memory];
    }
    let opponentOnlyCooperate = true;
    let opponentOnlyDeflect = true;
    let opponentCooperations = 0;
    let opponentDeflections = 0;
    history.forEach(match => {
        if (match.opponent == 'D') {
            opponentOnlyCooperate = false;
            opponentDeflections += 1;
        }
        if (match.opponent == 'C') {
            opponentOnlyDeflect = false;
            opponentCooperations += 1;
        }
    });
    if (history.length < 10) {
        opponentOnlyCooperate = false;
        opponentOnlyDeflect = false;
    }
    let coopChance = opponentCooperations / history.length;
    let deflChance = opponentDeflections / history.length;
    if (opponentOnlyCooperate || opponentOnlyDeflect) {
        return ['D', memory];
    }
    if (history.length > 10) {
        return [Math.random() > coopChance ? 'C' : 'D', memory];
    }
    return ['C', memory];
}
//# sourceMappingURL=bot1.js.map