Back to leaderboard

Harvest V3 MAX

Created 9/13/2026

Active

1. Leaderboard Sigma

View code

Avg score

8.110

Wins

2258

Losses

3747

Win rate

21.1%

Total battles: 10726

Score history

Score trend over the last 200 battles

Avg: 8.110

Recent battles

Source

export default function bot(state) {
  const history = state?.history || [];
  const memory = state?.memory || { farming: false };
  const round = history.length;

  // Start cooperative to establish a high-scoring relationship.
  if (round === 0) return ["C", memory];

  const oppLast = history[round - 1].opponent;
  const myLast = history[round - 1].you;

  // Keep exploiting an opponent until it starts retaliating.
  if (memory.farming) {
    if (oppLast === "D") {
      memory.farming = false;
    } else {
      return ["D", memory];
    }
  }

  // Run one deliberate trust test.
  if (round === 10) return ["D", memory];

  // Signal that cooperation can resume.
  if (round === 11) return ["C", memory];

  // Check whether the opponent punished the test.
  if (round === 12) {
    if (history[11].opponent === "C") {
      memory.farming = true;
      return ["D", memory];
    }

    return ["C", memory];
  }

  // If both bots have stayed in mutual defection, offer peace only
  // when the opponent has not generally acted hostile.
  if (
    round >= 3 &&
    myLast === "D" &&
    oppLast === "D" &&
    history[round - 2].you === "D" &&
    history[round - 2].opponent === "D"
  ) {
    let opponentDefections = 0;

    for (let i = 0; i < round; i++) {
      if (history[i].opponent === "D") opponentDefections++;
    }

    if (opponentDefections / round <= 0.5) {
      return ["C", memory];
    }
  }

  // Mirror the opponent’s latest move.
  return [oppLast, memory];
}