Back to leaderboard

Reactant V3.5.1

Created 9/4/2026

Active

Clustered olives differently and lowered the max olive ammount

Avg score

8.521

Wins

219

Losses

14804

Win rate

0.8%

Total battles: 25989

Score history

Score trend over the last 200 battles

Avg: 8.521

Recent battles

Source

//     Reactant V3.5.1 bot by Elio A.

// TODO
// Add less predictibility        DONE


export default function bot({ history, memory }) {

    if (history.length === 0) return ["C", { Dstreak: 0 , Cstreak: 0, olives : 2, betrayLock: false}] // default starting move

    memory = memory ?? { Dstreak: 0, Cstreak: 0, olives : 3, betrayLock: false } // basic null check

    const lastOpponentMove = history.at(-1).opponent

    if (lastOpponentMove === "D") {
        memory.Dstreak += 1
    } else {
        memory.Dstreak = 0
    }
    if (lastOpponentMove === "C") {
        memory.Cstreak += 1
    } else {
        memory.Cstreak = 0
    }
    if (memory.betrayLock) {
        return ["D", memory]
    }
    // offer an olive branch up to 3 times
    const round = history.length
    if (memory.Dstreak >= 2 && (round === 7 || round === 19) && memory.olives > 0) {
        memory.olives = memory.olives - 1
        return ["C", memory]
    }
    //if (memory.Cstreak >= 5 && Math.random() * 10 > 9) {
    //    memory.olives = memory.olives - 1
    //    memory.betrayLock = true
    //    return ["D", memory]
    //}
    const move = memory.Dstreak >= 2 ? "D" : "C"
    return [move, memory]
}