Back to leaderboard

Opportunist

Created 9/13/2026

Active

Plays nice by default, forgives the occasional betrayal so grudges don't spiral, cuts off anyone who's clearly hostile and quietly tests soft targets to see if they'll let it get away with defecting for good.

Avg score

6.044

Wins

5573

Losses

3959

Win rate

52.9%

Total battles: 10528

Score history

Score trend over the last 199 battles

Avg: 6.044

Recent battles

Source

export default function bot({ history, memory }) {
	memory = memory ?? { oppD: 0, confidence: 0, probing: false, nextProbe: 8 }
	const round = history.length

	if (round === 0) return ["C", memory]

	const last = history.at(-1)
	if (last.opponent === "D") memory.oppD++

	if (memory.probing) {
		memory.probing = false
		if (last.opponent === "D") {
			memory.confidence = 0
			memory.nextProbe = round + 20
		} else {
			memory.confidence++
			memory.nextProbe = round + Math.max(2, 6 - memory.confidence)
		}
	}

	if (memory.confidence >= 6) return ["D", memory]

	const rate = memory.oppD / round
	if (round >= 10 && rate > 0.75) return ["D", memory]

	if (last.opponent === "D") {
		return [Math.random() < 0.1 ? "C" : "D", memory]
	}

	if (round >= memory.nextProbe) {
		memory.probing = true
		return ["D", memory]
	}

	return ["C", memory]
}