MarkZH / Genetic_Chess

An amateur attempt at breeding a chess-playing AI.
MIT License
10 stars 2 forks source link

Resignation gene #148

Open MarkZH opened 1 month ago

MarkZH commented 1 month ago

If the scores of a move are less than S for M consecutive moves, then resign. M and S are subject to mutation.

Expectation: If the gene is too eager to resign, that gene will fade away as it always loses. If it never resigns, then it goes away at the first loss or with a 50% chance on every non-checkmate result.

MarkZH commented 1 month ago

Perhaps this will put more pressure on other genes to attain correct values to pick the correct moment to resign.

MarkZH commented 1 month ago

Will need to add a method for players to resign--probably by attaching the message to the Move class or copying python-chess and making a Play_Result class that will hold Move move; bool resigned;.

MarkZH commented 1 month ago

The scores in the PGN are in units of pawn values. The Board Score Floor is in internal scoring units. The scores should be normalized to pawn values before writing to a genome file.

MarkZH commented 1 month ago

AIs are only resigning when checkmate is inevitable. This is why the floor is so low and the max streak is less than one. This is expected behavior (in retrospect) since resigning gives a better reproductive result than losing by checkmate.

Idea: Only allow resignations on finite scores (checkmate loss is scored as -infinity). Idea 2: Resignations when checkmate is inevitable count as a checkmate loss during a gene pool. This way, the AI can resign during a non-gene-pool game when checkmate is inevitable.

MarkZH commented 1 month ago

Went with Idea 2. Should probably start the resignation gene with more intrusive values (higher score and lower max streak) to put pressure on the gene.