OK here is an extract of the code
string SetupCI; // initial piece colors
string SetupSI; // initial piece status
string SetupCW; // working copy of piece colors
string SetupSW; // working copy of piece status
string Allc = "cccccccccc";
string All0 = "0000000000";
string All1 = "1111111111";
string All2 = "2222222222";
string All3 = "3333333333";
string All4 = "4444444444";
string All5 = "5555555555";
string C02_11;
string C12_21;
string C22_31;
string C32_41;
string C42_51;
string C52_61;
string S02_11;
string S12_21;
string S22_31;
string S32_41;
string S42_51;
string S52_61;
// Functions
integer CheckWin()
{
C02_11 = llGetSubString(SetupCW,2,11);
C12_21 = llGetSubString(SetupCW,12,21);
C22_31 = llGetSubString(SetupCW,22,31);
C32_41 = llGetSubString(SetupCW,32,41);
C42_51 = llGetSubString(SetupCW,42,51);
C52_61 = llGetSubString(SetupCW,52,61);
S02_11 = llGetSubString(SetupSW,2,11);
S12_21 = llGetSubString(SetupSW,12,21);
S22_31 = llGetSubString(SetupSW,22,31);
S32_41 = llGetSubString(SetupSW,32,41);
S42_51 = llGetSubString(SetupSW,42,51);
S52_61 = llGetSubString(SetupSW,52,61);
if ((C02_11 == Allc) && (S02_11 == All3))
{
return 1;
}else
if ((C12_21 == Allc) && (S12_21 == All4))
{
return 1;
}else
if ((C22_31 == Allc) && (S22_31 == All5))
{
return 1;
}else
llOwnerSay("C32_41: " + C32_41);
llOwnerSay("S32_41: " + S32_41);
llOwnerSay("Allc: " + Allc);
llOwnerSay("All0: " + All0);
if (C32_41 == Allc)
{
llOwnerSay("C32_41 = Allc"

;
}
if (S32_41 == All0)
{
llOwnerSay("S32_41 = All0"

;
}
if ((C42_51 == Allc) && (S42_51 == All1))
{
return 1;
}else
if ((C52_61 == Allc) && (S52_61 == All2))
{
return 1;
}else
{
return 0;
}
} // end of CheckWin function
Init()
{
SetupCI = "99"; // pieces 0 - 1
SetupCI += "0000000000111111111122222222223333333333"; // pieces 2 - 41
SetupCI += "4444444444555555555566666666666666666666"; // pieces 42 - 81
SetupCI += "66666666666666666666666666666666666666666"; // pieces 82 - 122
SetupSI = "zz"; // pieces 0 - 1
SetupSI += "cccccccccccccccccccccccccccccccccccccccc"; // pieces 2 - 41
SetupSI += "cccccccccccccccccccceeeeeeeeeeeeeeeeeeee"; // pieces 42 - 81
SetupSI += "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; // pieces 82 - 122
SetupCW = SetupCI; // working copy of piece colors
SetupSW = SetupSI; // working copy of piece status
} // end of Init function
// States
default
{
state_entry()
{
Init();
llListen(1234, "", NULL_KEY, ""

;
}
touch_start(integer total_number)
{
}
listen(integer channel, string name, key id, string message)
{
if (channel == 1234)
{
if (message == "Memory"

{
llOwnerSay("Free memory is " + (string)llGetFreeMemory());
}else
if (message == "Checkstate"

{
llOwnerSay("Play.Checkstate: " + SetupSW + SetupCW);
}else
if (message == "Loadstate"

{
SetupCW = "99"; // pieces 0 - 1
SetupCW += "6666666666666666666666666666660000000000"; // pieces 2 - 41
SetupCW += "6666666666666666666666666666666666660666"; // pieces 42 - 81
SetupCW += "66666666666666666666666666666666666666666"; // pieces 82 - 122
SetupSW = "zz"; // pieces 0 - 1
SetupSW += "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeecccccccccc"; // pieces 2 - 41
SetupSW += "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeceee"; // pieces 42 - 81
SetupSW += "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; // pieces 82 - 122
llOwnerSay("Loaded"

;
}else
if (message == "Checkit"

{
integer result = CheckWin();
llOwnerSay("Result: " + (string)result);
}
} // end of 1234 block
} // end of listen block
} // end of default state
put it in a box when saved execute /1234Loadstate
then /1234Checkit.
Comments accepted.