src/game/personalities.ts (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
// The opponents are not different intelligences — they are different settings of
// the same engine: how strong it plays, how long it thinks, and how often it slips.
export interface Personality {
id: string;
face: string;
name: string;
blurb: string;
skill: number; // Stockfish Skill Level, 0–20
movetime: number; // ms the engine is allowed to think
think: [number, number]; // min/max delay before the move lands, ms
blunderChance: number; // chance of playing a random legal move instead
multipv: number; // how many candidate moves to weigh when softening
contempt: number; // >0 leans toward keeping tension, <0 toward trades
}
export const PERSONALITIES: Personality[] = [
{
id: "beginner",
face: "🌱",
name: "The Beginner",
blurb: "Plays slowly and makes clear mistakes.",
skill: 0,
movetime: 120,
think: [700, 1400],
blunderChance: 0.28,
multipv: 4,
contempt: 0,
},
{
id: "patient",
face: "🐢",
name: "The Patient",
blurb: "Defensive, avoids risks, trades when it can.",
skill: 4,
movetime: 200,
think: [800, 1500],
blunderChance: 0.1,
multipv: 3,
contempt: -30,
},
{
id: "trickster",
face: "🦊",
name: "The Trickster",
blurb: "Hunts for forks, traps and quick attacks.",
skill: 8,
movetime: 300,
think: [600, 1200],
blunderChance: 0.06,
multipv: 2,
contempt: 40,
},
{
id: "guardian",
face: "🛡️",
name: "The Guardian",
blurb: "Values safety and a solid structure.",
skill: 12,
movetime: 400,
think: [700, 1300],
blunderChance: 0.03,
multipv: 1,
contempt: -20,
},
{
id: "aggressor",
face: "🔥",
name: "The Aggressor",
blurb: "Attacks early and accepts sacrifices.",
skill: 15,
movetime: 500,
think: [500, 1100],
blunderChance: 0.02,
multipv: 1,
contempt: 80,
},
{
id: "master",
face: "👁️",
name: "The Master",
blurb: "Strong and precise. Shows no mercy.",
skill: 20,
movetime: 1000,
think: [500, 900],
blunderChance: 0,
multipv: 1,
contempt: 0,
},
];
export function getPersonality(id: string): Personality {
return PERSONALITIES.find((p) => p.id === id) ?? PERSONALITIES[0];
}
|