SEclone tagging basic


We have covered the list of new “class” in use in the range 6.2 7.0 of the rating.

The last task is to make the appropriate assemble of the described stuff.



The main assembly functions are located in the file jdk_chaines.cpp located in the subdirectory /c1.

The general lay out for that function Chaining()  is


 . Prepare tagging, loading strong links

 . Tag the candidates

 . Look for intra_layer eliminations

 . Add weak links

 . Look for the relevant eliminations depending on the base level reached






/* main routine to process chains

   entry at a specific basic value for min rating

   process is cancelled as soon as a solution is found with a shorter rating

   all chain with the minimum rating  are stored


// chain call 1=biv 2= cell_bivalue 4=nishio 8 dynamic 16=multi_chain


void JDK::Chaining(int opt ,int level,int base)

{TaggingInit(); tchain.SetMaxLength(base);

 int ir=0;  

 zl.opy=(opt&1)?0:1;// set y option for searh within a layer

 E$.E("entree chaining opt=");E$.E( opt);

 E$.E(" base=");E$.E( base); E$.E(" level=");E$.Enl( level);


 if(opt&1)BiValues(); // insert all strong links "digit" in "zl"

 if(opt&2) GenCellBivalues(); // insert all strong links "cells" in "zl"

 //if((opt&3)==2) GenYBivalues();//if Y, add bivalues if only pairs


     // if level apply potential add rules if equivalence links to find

 if (level ) {}

  zl.Marquer();   // tagging





 zpln.Impossible(base) ;//check first what comes immediatly from tagging

 if(tchain.IsOK(base) )return;

 if(opt&2) zpln.ConflitsCase();  // now start generation of weak links


 zcf.InitD();                    // full expansion



  // if level   add authorized  rules to create relevant weak links

 if (level ) {}


 switch (base)

 {case 65:if(tchain.IsOK(base) ) break; // here stop as soon as possible

          if(!(opt&2))zpln.Xcycle(); // elimination thru a layer nice loop

                if(tchain.IsOK(base) ) break;

          zcf.Aic_Cycle(opt&1);     // several tags

                if(tchain.IsOK(base) ) break;

         zcf.h.dp.Loop_Layer();    //indirect cleaning thru a loop within a layer


 case 66:if(opt&1) zcf.Aic_Chain(); break; // provisoire

 case 70:zcf.Aic_Chain(); break;





Rating_end()  is the function called to check whether the chains piled in TCHAIN can be used



//========= end of a rating step, check if done or still to be searched


   /* next is the next rating to be searched.

      the search is over if a <= rating has been found.

      likely <= next+1 due to the minimum length adjustment

      except for aligned triplet */



int JDK::Rating_end(int next)

{if(!tchain.IsOK(next) )return 0;

o$.Step((SolvingTechnique)tchain.rating); if(o$.ir)return 0;

return tchain.Clean();}



A specific function is written to prepare the task , call Chain and close the task

These functions are located in jdk_chaines2.cpp that file contains also functions called by chain




void JDK::TaggingInit()

{zl.Init();      // strong links

 zgs.ReInit();   // 81 bits patterns in use

 zcf.Init();     // elementary weak links

 zcx.Init();     // sets (choices) in use






void JDK::GenCellBivalues()

{for(int i=0;i<81;i++)   // gen cell bi values

  {P81 p8=T81t[i];if(p8.v.ncand-2) continue;

   CB9CH c9w=p8.v.cand; int il=0;  short int l[2];

   for(int k=0;k<9;k++)   if(c9w.On(k)) l[il++]=iptl.GetPoint(i,k);





//==================================== gen digit bi vamues

void JDK::BiValues(){ for(int i=0;i<9;i++)BiValues(i);}

void JDK::BiValues(USHORT ch)

{ for(int i=0;i<27;i++)

  {OBBITD * cw=&aztob.tchbit.el[i].eld[ch];if(cw->n-2) continue;

   CB9CH c9w=cw->b; int il=0; short int l[2];

   for(int k=0;k<9;k++)   if(c9w.On(k))

   { int ri8=divf.el81[i][k];  l[il++]=iptl.GetPoint(ri8,ch);} 






// chain call 1=biv 2= cell_bivalue 4=nishio 8dynamic 16=multi_chain


// this includes the search for x or y cycle

int JDK::Rating_base_65()

{Chaining(1,0,65);// x cycle 

 if( Rating_end(65)) return 1;

 Chaining(2,0,65);// y cycle 

return Rating_end(66);}





// this includes the search for x or y cycle

int JDK::Rating_base_66()

{Chaining(1,0,66);// x  forcing chain

if( Rating_end(66)) return 1;

Chaining(2,0,66);// y  forcing chain

return Rating_end(70);}




// this includes the search for x or y cycle

int JDK::Rating_base_70()

{Chaining(3,0,70);// xy  forcing chain or loop

return Rating_end(75);}




// this includes the search for aligned triplet and nishio

int JDK::Rating_base_75()

{Chaining(1+2+4,0,75);// xy cycle and forcing chain

 return Rating_end(80);}



Aligned exclusion  thru tagging


As mentioned earlier, aligned pair have been  redefined using the tagging process.


Aligned pair


We are looking for a candidate in conflict with a “cell set” 

 . Either thu a direct weak link

 . Or thru a cell bivalue (and one only)


And this is the code located in the file c1/jdk_alignedpair with the option tri=0.


int JDK::AlignedPair(int tri)

{if(o$.ot){ E$.E(" aligned pair tri= ");E$.Enl( tri);}

 TaggingInit();    GenCellBivalues();

 zl.Marquer();   // tagging

 zcx.Init();  T81->GenereChoixCases(); // cells sets

 zpln.ConflitsChiffres(); // weak links candidate/candidate

 zcf.InitD(1+tri); // only one step if pair exclusion

 int ir=zcx.InterditChoixSeul(tri) ;

 return ir;}


Aligned triplet


This is not so easy. Moreover, having no clear definition of an aligned triple, I worked on pattern.


One pattern is an extension of Aligned pair with longer chains. This is done setting in the above function the parameter “tri” to “1”;


 The second one uses derived weak links to simulate the “third cell”.

2 steps of derivation are made to cove found examples.


That process should be validated, nothing proves that it fits 100% to SE rating.

It covered the sample file in my tests.


int JDK::AlignedTriplet()

{if(o$.ot){ E$.Enl(" aligned triplet ");}

 TaggingInit(); GenCellBivalues();

 zl.Marquer();  // tagging

 zcx.Init();  T81->GenereChoixCases(); // cells sets

 zpln.ConflitsChiffres(); // weak links candidate/candidate

 //   create pseudo cells to process three cells sharing 2 digits same R/C/B

 for(int el=0;el<27;el++) //each R/C/B

  for(int i1=0;i1<7;i1++)

   {USHORT i81=divf.el81[el][i1];

       UNP v1=T81t[i81].v; if(v1.typ) continue;

       if(v1.ncand<3||v1.ncand>5) continue;

    CB9CH wch=v1.cand;

       for(int i2=i1+1;i2<8;i2++)

     {USHORT i82=divf.el81[el][i2];

         UNP v2=T81t[i82].v; if(v2.typ) continue;

           if(v2.ncand<3 ||v2.ncand>5) continue;

        wch&=v2.cand; if(wch.QC()<2) continue;

       for(int i3=i2+1;i3<9;i3++)

        { USHORT i83=divf.el81[el][i3];

                UNP v3=T81t[i83].v; if(v3.typ) continue;

             if(v3.ncand<3||v3.ncand>5) continue;

          wch&=v3.cand; if(wch.QC()-2) continue;

                // we have a pattern seen by SE create a pseudo cell

                // with other digits if 2 or 3 extra digits

         CB9CH wou=v1.cand | v2.cand | v3.cand; if(wou.QC()>5) continue;

         USHORT nm=0,tm[18],n=v1.ncand+v2.ncand+v3.ncand-6;   

            for(int j=0;j<9;j++) if(wch.Off(j))


                  {int ix=zpln.GetPoint(i81,j); tm[nm+n]=ix; tm[nm++]=zpln.zp[ix].m;}


                  {int ix=zpln.GetPoint(i82,j); tm[nm+n]=ix; tm[nm++]=zpln.zp[ix].m;}


                  {int ix=zpln.GetPoint(i83,j); tm[nm+n]=ix; tm[nm++]=zpln.zp[ix].m;}


         zcx.Charge(tm,nm,0,i81); // on prend le premier







 zcf.InitD(5); // enough steps for derived weak links


 zcx.AddSyuTriplet(); // derived weak links on triplets


 zcf.InitD(5); // redo it after derived weak links

 // do it twice to catch all SE triplet exclusion


  zcx.AddSyuTriplet(); // derived weak links on triplets


 zcf.InitD(5); // redo it after derived weak links

// zpln.Liste(); zcf.ListeConflits();

// zcx.ListeLiens();

int ir=zcx.InterditChoixSeul(1) ;

return ir;}