Computer Chess Club Archives


Search

Terms

Messages

Subject: Mutator code snippet

Author: Steven Edwards

Date: 20:27:33 05/12/05

Go up one level in this thread


On May 12, 2005 at 18:14:44, Matthew Hull wrote:
>On May 12, 2005 at 17:49:14, Steven Edwards wrote:

>>*** New champion ***
>>Species: SpMAtk   MfSymCount: 20
>>BirthCycle: 111   MatchCount: 598
>>  Gene: MfAdjCheck   Weight: 0
>>  Gene: MfAdjDefenderCapture   Weight: 0
>>  Gene: MfAdjDefenderDecoy   Weight: 0
>>  Gene: MfCapture   Weight: 0
>>  Gene: MfCheck   Weight: 0
>>  Gene: MfDiscoveredCheck   Weight: 0
>>  Gene: MfDoesCheckmate   Weight: 0
>>  Gene: MfDoesMateIn2   Weight: 0.01
>>  Gene: MfDoubleCheck   Weight: 0
>>  Gene: MfFlightDecrease   Weight: 0
>>  Gene: MfFlightIncrease   Weight: 0
>>  Gene: MfForceCEInterposition   Weight: 0
>>  Gene: MfForceCEKingNoncapture   Weight: 0
>>  Gene: MfNoCheck   Weight: 0
>>  Gene: MfResponseCountEq1   Weight: 0.00990099
>>  Gene: MfResponseCountEq2   Weight: 0
>>  Gene: MfResponseCountGt4   Weight: 0
>>  Gene: MfResponseCountLe4   Weight: 0
>>  Gene: MfThreatenMateIn1   Weight: 0
>>  Gene: MfThreatenMateIn2   Weight: 0
>
>Those are some extremely sensitive weights!

Here's the mutator code:

(defun MutateOrganism (MyOrganism)
  "Mutate the given organism."
  (let*
    (
      (Gene (RandomElement (vassocq GeneList MyOrganism)))
      (Weight (vassocq Weight Gene))
      (Action (RandomElement '(add sub mul div)))
    )
    (cond
      ((eq? Action 'add) (nassocq Weight Gene (+ Weight 0.01)))
      ((eq? Action 'sub) (nassocq Weight Gene (- Weight 0.01)))
      ((eq? Action 'mul) (nassocq Weight Gene (* Weight 1.01)))
      ((eq? Action 'div) (nassocq Weight Gene (/ Weight 1.01))))
    MyOrganism))



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.