Table of Contents

About

This script was tested and works on OpenSim version 0.7.4!

This is a chromosome shuffler system used on the science grid. It shuffles chromosome pairs such as AA,bb,CC,cc,DD and dd randomly. For example a possible configuration would be:

AA aa
bb BB
CC cc
DD dd

as well as:

aa AA
BB bb
CC cc
dd DD

The way the script works, is that each chromosome row is indexed with a number. The a pair chromosome, for example, is the first row. The main script generates a random binary string such as:

0110

and sends that string through the linkset. Each row then picks up this string and selects the digit corresponding to that row. For example, the a pair chromosome row will take the first digit 0. If that digit has the value of 0, then no shuffling will be done. If that digit has the value 1, then the row will shuffle and "AA" will exchange position with aa.

Setup

Code: Chromosome shuffle

chromosome_shuffle.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
default
{
    touch_start(integer num)
    {
        integer itra;
        list reconf;
        for(itra=0; itra<4; ++itra) {
            reconf += (string)llFloor(llFrand(2));
        }
        llMessageLinked(LINK_ALL_CHILDREN, 0, llList2CSV(reconf), "k@reconf");
    }
}

Chromosome Script

chromosome_listner.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
vector left = <.455429,1.375748,-.020874>;
vector right = <-.276947,1.375740,-.020874>;
integer row =2;
 
default
{
    link_message(integer sender_num, integer num, string str, key id)
    {
        if(id != "k@reconf") return;
        integer theDo = llList2Integer(llParseString2List(str, [","], [""]), row);
        if(!theDo) return;
 
        if(llVecDist(llGetLocalPos(), left)<.2) {
            llSetPos(right);
            return;
        }
        if(llVecDist(llGetLocalPos(), right)<.2) {
            llSetPos(left);
            return;
        }
    }
}