T-Barn: Show
- Code: Select all
procedure TransBarns(K,M,Q,v:integer); { k is writting function M is starting size v is ending size,q selectins inital cell size v is end size}
type
hold = array of integer;
base = array of numberset;
hold2 = array of RCBpeer;
var
p,S,F,C,w,j,a,b,z,lx,x,g,l,r,act,t,u,e,xn,n:integer;
xs:nums;
z1:nums;
p2,p3:numberset;
lx1:numberset;
h: hold;
step: base;
List: hold2;
begin
cellcombo;
If M = 0
then
L:= 2
else
L:=M;
repeat
begin
for C:= slist[l] to flist[l] do
if (combocell[c] <> [])
then
begin
act:=0;
for p in combocell[c]do
begin
inc(act);
if act >=L then
break;
end;
if act >=L then
for p in combocell[c] do
if (peer[p] * combocell[c] <> [] )
and ( ( (q = 1) and (nm[p] = 2))
or ((q = 2) and (nm[p] = 3))
or ((q = 0) and (nm[p] <=L)) )
then
begin
w:=0; { step count}
setlength(h,w+1);
H[w]:=19; {starting cell position}
setlength(step,(w+1)); {set the array size to w}
setlength(list,(W+1)); {sets the array size to w}
list[w]:= [Rx[p]] + [(Cy[p]+9)]+ [(Bxy[P]+18)] ; {records active sectors}
step[w]:=[p]; { keeps track of what cells are used at each step W }
repeat
for J:= h[w] downto 0 do
begin
if not (peer2[p,j] in step[w])
and ( peer2[p,j] in combocell[c])
and ( (peer[p] * (combocell[c] - step[w]) <> [] ) or (w+2 = l) )
then
begin
inc(w); {increase step count}
setlength(h,w+1); {increase lenght of step starting point array}
setlength(list,(W+1));
list[w]:=list[w-1] + [Rx[peer2[p,j]]] + [Cy[peer2[p,j]]+9] + [BXY[peer2[p,j]]+18];
H[w]:= j-1;
setlength(step,(w+1)); {set the array size to w}
step[w]:=step[w-1] + [ peer2[p,j] ] ; { keeps track of what cells are used at each step W }
end
else
dec(H[w]);
if W = (l-1)
then
begin
for a:= 0 to 25 do
if (RCBnum[a]*step[w] <> [] )
and (A in list[w] )
then
begin
for B:= a+1 to 26 do
if (B in List[w] )
then
if ( RCBnum[B] * step[w] <> [])
and (( (RCBnum[b] + RCBnum[a] ) * step[w]) = step[w])
and ( (RCBnum[a] - RCBnum[b]) * step[w] <> [] )
and ( (RCBnum[b] - RCBnum[a]) * step[w] <> [] )
then
begin
lx1:=[];
z1:=[];
for Z in comboset[c] do
if ( ( (digitrcb[a,z] * step[w] ) <> [])
or ( (digitrcb[b,z] * step[w] ) <> []) )
then
for lx in ( LIST[W] ) do
if
( ( (digitRCB[a,z] * digitRCB[lx,z] * step[w]) <> [])
or
( (digitRCB[b,z] * digitRCB[lx,z] * step[w]) <> []) )
and ( (( DigitRCB[b,z] + DigitRCB[a,z]) * digitrcb[lx,z] * step[w]) = ( (digitrcb[a,z] + digitrcb[b,z]) * step[w] ) )
then
begin
lx1:=lx1+[lx];
z1:=z1+[z];
end;
if (L - (popcnt(dword(z1)) ) = 1 ) //or ((popcnt(dword(z1)) = L ) and (Z1 = comboset[c]) )
then
begin
xs:=[];
p2:=[];
for x in (comboset[c] - z1) do
if ( (digitrcb[a,x] * step[w] ) <> [])
and ( (digitrcb[b,x] * step[w] ) <> [])
then
begin
xs:=xs+[x];
p2:= p2 + (( DigitRCB[a,x] + digitrcb[b,x] )*step[w]) ;
end;
if (p2 <> [] ) and (xs <> []) and (z1 <> []) {rule 1, peer cells visbile to all + candidates may be elimianted}
then
begin
for g in ([0..80] - step[w] ) do
if ( peer[g] * p2 = p2)
and (pm[g] * xs <> [])
then
begin
active:=true;
covered[g]:=covered[g] + xs;
end;
end;
{rule 2
when any cell that contains a RCC and contains only the + candidate and it directly sees all + candidtes; then
all cells visible to all the RCC of that number may be excluded for that number. }
if (p2 <> []) and (xs <> [])
then
for G in (p2) do
for x in z1 do
if (pm[g] = xs + [x])
and( (peer[g] * p2 ) + [g] = p2 )
then
begin
for r in ([0..80] - step[w] ) do
if (peer[r] * ((digitRcb[a,x] + digitrcb[b,x]) * (step[w] ) ) = ((digitRcb[a,x] + digitrcb[b,x]) * (step[w] ) ))
and (x in pm[r] )
then
begin
active:= true;
covered[r]:= covered[r] + [x];
end;
end;
end; {end count =1}
if (L - (popcnt(dword(z1)) ) = 1 ) //or ((popcnt(dword(z1)) = L ) and (Z1 = comboset[c]) )
then
begin
for x in (comboset[c] - z1) do
if ( (digitrcb[a,x] * step[w] ) <> [])
and ( (digitrcb[b,x] * step[w] ) <> [])
then
for t:= 0 to 26 do {base sector}
if (digitrcb[t,x] * step[w] = [])
then
for E in peerrcb[t] do
if (digitrcb[e,x] * step[w] <> [])
then
for u in (peerrcb[t]-[e]) do
if( DigitRCB[t,x] * (DigitRcb[E,x] + DigitRCB[u,x]) = DigitRCB[t,x] )
and (DigitRCB[t,x] <> [])
then
begin
{writexy(2,64,' Eliminations: ');
write(x,' @ '); }
for g in ([0..80] - (step[w] + digitrcb[t,x] ) ) do
if ( peer[g] * ((digitrcb[t,x]*digitrcb[u,x]) + ( p2 - (digitrcb[e,x]*step[w])) ) = ((digitrcb[t,x]*digitrcb[u,x]) + ( p2 - (digitrcb[e,x]*step[w])) ) )
and (x in pm[g] )
then
begin
active:=true;
covered[g]:=covered[g] + [x];
{ write(g,' ');
if G = 78
then begin
writexy(2,60,'Set A: ');
for n in (rcbnum[a]*step[w]) do write(n, ' ');
writexy(2,61,'Set b: ');
for n in (rcbnum[b]*step[w]) do write(n, ' ');
writexy(2,62,'Z: ');
write(x);
writexy(2,63,'Set T: ');
for n in (digitrcb[t,x]) do write(n, ' ');
delay(5000);
end;}
end;
if ( (digitrcb[u,x]*step[w]) + (digitrcb[e,x] * step[w]) =p2 )
then
begin
for G in (comboset[c] ) do
begin
p3:=(digitrcb[a,g]+digitrcb[b,g])*step[w];
{ writexy(2,65,'Ring Eliminations: ');
write(g,' @ '); }
for xn in ([0..80] -( step[w]{+ digitrcb[t,x]})) do
if (peer[xn] * p3 = p3 )
and (g in pm[xn] )
then
begin
covered[xn]:= covered[xn] + [g];
active:=true;
// write(xn,' ');
end;
end;
end; {ring}
end; { eliminations}
end;
if (popcnt(dword(z1)) = L ) and (Z1 = comboset[c])
then
begin
active:=true;
for G in (z1*comboset[c]) do
begin
{ write(G,' @: '); }
p2:=(digitrcb[a,g]+digitrcb[b,g])*step[w];
for x in ([0..80] - step[w]) do
if (peer[x] * p2 = p2 )
and (g in pm[x] )
then
begin
covered[x]:=covered[x] + [g];
end;
end;
end; {count = 0 }
end; {b}
end; {a}
end;
if (W = (L-1)) or (( W>0) and (H[w]= -1)) {back track sequence}
then
begin
repeat
Dec(w); {decrese step count}
setlength(h,w+1); {reduce lenght of step starting point array}
setlength(list,(w+1));
dec(h[w]);
setlength(step,(w+1)); {set the array size to w}
until (H[w]> -1) or (w=0)
end;
end;
until (h[W] = -1)
end;
end;
end;
if m = 0
then
inc(L);
until (L = m) or (L > v);
end; {Fin transport bent almost naked sets}
T-als-xz: Show
- Code: Select all
procedure transalsxz(k:integer);
var
q,xn,xn2,L,l2,J,j2,s,s2,s3,s4,f,f2,f3,f4,yn,yn2,yn3,yn4,n,z,x,ACT,ACT2,g,r,t,e,u,h:integer;
A:nums;
a2:numberset;
B:nums;
B2:numberset;
z1:nums;
lx1: rcbpeer;
p3:numberset;
begin
for xn:= 0 to 26 do
for L:= 1 to 8 do
begin
J:= l+1;
for yn:= Slist[l] to flist[l] do
begin
A:=[];
a2:=[];
ACT:=0;
lx1:=[];
for n:= 0 to 8 do
if (n in comboset2[yn] )
and (Sectorrc[xn,n] <> [])
then
begin
A:= a+ sectorRC[xn,n]; {#'s}
INC(ACT);
a2:=a2+ sectorrcb[xn,n]; {cell's}
lx1:= lx1 + peerrcb[Rsec[Rx[secset[xn,n]]]] + peerrcb[Csec[Cy[secset[xn,n]]]] + peerrcb[Bsec[Bxy[secset[xn,n]]]];
end;
if (ACT = L)
then
for yn2:= Slist[j] to Flist[j] do
if A = comboset[yn2]
then
begin
for xn2 in ( lx1) do
for L2:= 1 to l do
begin
J2:= l2+1;
for yn3:= Slist[l2] to flist[l2] do
begin
B:=[];
B2:=[];
act2:=0;
for n:= 0 to 8 do
if (n in comboset2[yn3])
AND (sectorRC[xn2,n] <> [])
then
begin
b:= b+ sectorRC[xn2,n];
inc(act2);
b2:=b2+ sectorrcb[xn2,n];
end;
if
( A2 - b2 <> [])
and ( b2 - a2 <> [])
and (act2 = l2)
then
for yn4:= Slist[j2] to Flist[j2] do
if (popcnt(dword((comboset2[yn4]*Comboset2[yn2]) ) ) >1 ) {checks that 2nd set of digits shares >=2 digits with first set}
then
if b = comboset[yn4]
then
begin
z1:=[];
for q in (peerrcb[xn] + peerrcb[xn2] ) do
for z in (comboset[yn4]*comboset[yn2] ) do
if ( ((digitrcb[xn,z] * a2) * (digitrcb[q,z])) - (a2*b2) <> [] )
and ( ((digitrcb[xn2,z] * b2) * digitrcb[q,z]) - (a2*b2) <> [] )
and ( ( digitRCB[q,z] * (a2+b2 ) - (a2*b2) ) = ( (DigitRCB[xn,z]*a2 ) + (Digitrcb[xn2,z]*b2) ) )
then
begin
z1:=z1+[z];
for R in ((comboset[yn4] * comboset[yn2]) - [z]) do
if (DigitRCB[xn,r] *A2 <> [] )
and (DigitRCB[xn2,r] * B2 <> [] )
then
begin
active:=true;
for x in [0..80] - (A2+B2) do
if (peer[x] * ( ( DigitRCB[xn,r] + DigitRCB[xn2,r] ) * (A2+B2)) = (( DigitRCB[xn,r] + DigitRCB[xn2,r] ) * (A2+B2)) )
and ( R in pm[x] )
then
begin
active:=true;
covered[x]:= covered[x] + [r];
end;
for t:= 0 to 26 do {base sector}
if (digitrcb[t,r] * ((digitrcb[xn,r]*a2)+(DigitRCB[xn2,r]*b2)) = [])
then
for E in peerrcb[t] do
if (digitrcb[e,r] * ((digitrcb[xn,r]*a2)+(DigitRCB[xn2,r]*b2)) <> [])
then
for u in (peerrcb[t]-[e]) do
if( DigitRCB[t,r] * (DigitRcb[E,r] + DigitRCB[u,r]) = DigitRCB[t,r] )
and (DigitRCB[t,r] <> [])
then
begin
for g in ([0..80] - (a2+b2 + digitrcb[t,r] ) ) do
if ( peer[g] * ((digitrcb[t,r]*digitrcb[u,r]) +
( ((digitrcb[xn,r]*a2)+(DigitRCB[xn2,r]*b2)) - (digitrcb[e,r]*((digitrcb[xn,r]*a2)+(DigitRCB[xn2,r]*b2)))) )
= ((digitrcb[t,r]*digitrcb[u,r]) + ( ((digitrcb[xn,r]*a2)+(DigitRCB[xn2,r]*b2)) - (digitrcb[e,r]*((digitrcb[xn,r]*a2)+(DigitRCB[xn2,r]*b2)))) ) )
and (r in pm[g] )
then
begin
active:=true;
covered[g]:=covered[g] + [r];
end;
// missing ring class for T-alsxz
end; { eliminations}
end;
end; {mutiple q sectors for mutiple restircted commons}
if popcnt(dword(z1)) >1 //doubly linked
then
begin
for R in ((comboset[yn4] + comboset[yn2]) - z1) do
if (DigitRCB[xn,r] *A2 <> [] )
or (DigitRCB[xn2,r] * B2 <> [] )
then
begin
active:=true;
for x in [0..80] - (A2+B2) do
begin
if (peer[x] * ( ( DigitRCB[xn,r] + DigitRCB[xn2,r] ) * (A2+B2)) = (( DigitRCB[xn,r] + DigitRCB[xn2,r] ) * (A2+B2)) )
and ( R in pm[x] )
then
begin
covered[x]:= covered[x] + [r];
end;
if (peer[x] * ( DigitRCB[xn,r] * A2) = ( DigitRCB[xn,r] * A2) )
and ( R in pm[x] )
and (DigitRCB[xn,r] * A2 <> [])
then
begin
active:=true;
covered[x]:= covered[x] + [r];
end;
if (peer[x] * ( DigitRCB[xn2,r] * b2) = ( DigitRCB[xn2,r] * B2) )
and ( R in pm[x] )
and (DigitRCB[xn2,r] * B2 <> [])
then
begin
active:=true;
covered[x]:= covered[x] + [r];
end;
end;
end;
end; {dual link elimiantions}
end; {yn4}
end;{yn3}
end;{xn2}
end; {yn2}
end; {yn}
end; {xn}
end;{fin transport als -xz rule}
T-als-xy: Show
- Code: Select all
procedure transalsxy(k:integer);
var
q,xn,xn2,xn3,L,l2,l3,J,j2,j3,s,s2,s3,s4,s5,s6,f,f2,f3,f4,f5,f6,yn,yn2,yn3,yn4,yn5,yn6,n,z,x,ACT,ACT2,act3,g,r,q2,z2,t,e,u:integer;
A:nums;
a2:numberset;
B:nums;
B2:numberset;
c:nums;
c2:numberset;
z1:nums;
lx1: rcbpeer;
lx2: rcbpeer;
begin
for xn:= 0 to 26 do
for L:= 1 to 8 do
begin
J:= l+1;
for yn:= Slist[l] to flist[l] do
begin
A:=[];
a2:=[];
ACT:=0;
lx1:=[];
for n:= 0 to 8 do
if (n in comboset2[yn] )
and (Sectorrc[xn,n] <> [])
then
begin
A:= a+ sectorRC[xn,n]; {#'s}
INC(ACT);
a2:=a2+ sectorrcb[xn,n]; {cell's}
lx1:= lx1 + peerrcb[Rsec[Rx[secset[xn,n]]]] + peerrcb[Csec[Cy[secset[xn,n]]]] + peerrcb[bsec[bxy[secset[xn,n]]]];
end;
if (ACT = L)
then
for yn2:= Slist[j] to Flist[j] do
if A = comboset[yn2]
then
begin
for xn2 in (lx1) do
for L2:= 1 to l do
begin
J2:= l2+1;
for yn3:= Slist[l2] to flist[l2] do
begin
B:=[];
B2:=[];
act2:=0;
lx2:=[];
for n:= 0 to 8 do
if (n in comboset2[yn3])
AND (sectorRC[xn2,n] <> [])
then
begin
b:= b+ sectorRC[xn2,n];
inc(act2);
b2:=b2+ sectorrcb[xn2,n];
lx2:=lx2+ peerrcb[Rsec[Rx[secset[xn2,n]]]] + peerrcb[Csec[Cy[secset[xn2,n]]]] + peerrcb[bsec[bxy[secset[xn2,n]]]];
end;
if
( A2 - b2 <> [])
and ( b2 - a2 <> [])
and (act2 = l2)
then
for yn4:= Slist[j2] to Flist[j2] do
if (popcnt(dword((comboset2[yn4]*Comboset2[yn2]) ) ) >=1 ) {checks that 2nd set of digits shares >=2 digits with first set}
then
if b = comboset[yn4]
then
begin
for q in (peerrcb[xn] + peerrcb[xn2] ) do
for z in (comboset[yn4]*comboset[yn2] ) do
if ( ((digitrcb[xn,z] * a2) * (digitrcb[q,z])) - (a2*b2) <> [] )
and ( ((digitrcb[xn2,z] * b2) * digitrcb[q,z]) - (a2*b2) <> [] )
and ( ( digitRCB[q,z] * (a2+b2 ) - (a2*b2) ) = ( (DigitRCB[xn,z]*a2 ) + (Digitrcb[xn2,z]*b2) ) )
then
begin
for xn3 in ( lx2) do
for L3:= 1 to 8 do
begin
J3:= l3+1;
for yn5:= Slist[l3] to flist[l3] do
begin
C:=[];
C2:=[];
act3:=0;
for n:= 0 to 8 do
if (n in comboset2[yn5])
AND (sectorRC[xn3,n] <> [])
then
begin
C:= C+ sectorRC[xn3,n];
inc(act3);
C2:=C2+ sectorrcb[xn3,n];
end;
if (( C2 - b2 ) <> [])
and (( C2 - A2 ) <> [] )
and (act3 = l3)
then
for yn6:= Slist[j3] to Flist[j3] do
if (popcnt(dword((comboset2[yn6]*Comboset2[yn4]) ) ) >=1 ) {checks that 2nd set of digits shares >=2 digits with 2nd set}
and (popcnt(dword((comboset2[yn6]*Comboset2[yn2]) ) ) >=1 ) {checks that 2nd set of digits shares >=2 digits with 1st set}
then
if c = comboset[yn6]
then
begin
for q2 in (peerrcb[xn2] + peerrcb[xn3]) do
for z2 in (comboset[yn6]*comboset[yn4] - [z] ) do
if ( ((digitrcb[xn3,z2] * C2) * (digitrcb[q2,z2])) - (C2*b2) <> [] )
and ( ((digitrcb[xn2,z2] * b2) * digitrcb[q2,z2]) - (C2*b2) <> [] )
and ( ( digitRCB[q2,z2] * (C2+b2 ) - (C2*b2) ) = ( (DigitRCB[xn3,z2]*C2 ) + (Digitrcb[xn2,z2]*b2) ) )
then
begin
for R in ((Comboset[yn2]*comboset[yn6]) -[z2,z] ) do
if (DigitRCB[xn,r] * A2 <> [] )
and (DigitRCB[xn3,r] * C2 <> [] )
then
begin
active:=true;
for x in [0..80] - (A2{+B2}+C2) do
if (peer[x] * ( ( DigitRCB[xn,r] + DigitRCB[xn3,r] ) * (A2+C2)) = (( DigitRCB[xn,r] + DigitRCB[xn3,r] ) * (A2+C2)) )
and ( R in pm[x] )
then
begin
active:=true;
covered[x]:= covered[x] + [r];
end;
for t:= 0 to 26 do {base sector}
if (digitrcb[t,r] * ((digitrcb[xn,r]*a2)+(DigitRCB[xn3,r]*c2)) = [])
then
for E in peerrcb[t] do
if (digitrcb[e,r] * ((digitrcb[xn,r]*a2)+(DigitRCB[xn3,r]*c2)) <> [])
then
for u in (peerrcb[t]-[e]) do
if( DigitRCB[t,r] * (DigitRcb[E,r] + DigitRCB[u,r]) = DigitRCB[t,r] )
and (DigitRCB[t,r] <> [])
then
begin
for g in ([0..80] - (a2+b2+c2 + digitrcb[t,r] ) ) do
if ( peer[g] * ((digitrcb[t,r]*digitrcb[u,r]) +
( ((digitrcb[xn,r]*a2)+(DigitRCB[xn3,r]*c2)) - (digitrcb[e,r]*((digitrcb[xn,r]*a2)+(DigitRCB[xn3,r]*c2)))) )
= ((digitrcb[t,r]*digitrcb[u,r]) + ( ((digitrcb[xn,r]*a2)+(DigitRCB[xn3,r]*c2)) - (digitrcb[e,r]*((digitrcb[xn,r]*a2)+(DigitRCB[xn3,r]*c2)))) ) )
and (r in pm[g] )
then
begin
active:=true;
covered[g]:=covered[g] + [r];
{ if g = 39 then
begin
writexy(2,60,'active:');
write(' L =', L,' J =,',j);
write(' L2 =', L2,' J2 =,',j2);
write(' L3 =', L3,' J3 =,',j3);
write(act,act2,act3);
writeln;
write(xn,' -> ',z,' @ ',Q,' -> ',xn2,' -> ',z2,' @ ',q2,' -> ',xn3);
writexy(2,62,'set A: ');
For x in a do write(x,' ');
write( '@: ');
For x in A2 do write(x,' ');
writexy(2,63,'set B: ');
For x in b do write(x,' ');
write( '@: ');
for x in B2 do write(x,' ');
writexy(2,64,'set c: ');
For x in c do write(x,' ');
write( '@: ');
for x in C2 do write(x,' ');
delay(50000);
end; }
end;
end;
end;
end; {q2 }
end; {yn6 }
end; {yn5}
end; {xn3}
end; {mutiple q sectors for mutiple restircted commons}
end; {yn4}
end;{yn3}
end;{xn2}
end; {yn2}
end; {yn}
end; {xn}
if k =0 then techdisplay(#97,u);
end;{als -xy rule}
T-xy-chain: Show
- Code: Select all
procedure Transxychain(K:integer); {also hits remote pairs}
type
hold = array of integer;
base = array of integer;
digit = array of integer;
act2 = array of numberset;
var
xn,w,p,p2,n,n2,t,e,u,g:integer;
a2:act2;
h:hold;
step: base;
z:digit;
begin
for xn:= 80 downto 0 do {startin cell}
if (nm[xn] = 2)
then
for n:= 1 to 9 do
if N in pm[xn]
then
begin
w:=0; {step count}
setlength(z,(w+1));
z[w]:=n;
setlength(h,(w+1)); {set the array size to w}
h[w]:=19; {keeps track of what peer is being used for step W }
setlength(step,(w+1)); {set the array size to w}
step[w]:=xn; { keeps track of what cells are used at each step W }
setlength(a2,w+1);
a2[w]:=[xn];
repeat
for p:= h[w] downto 0 do {iteration of peers}
if
not (peer2[step[w],p] in a2[w] )
and (nm[peer2[step[w],p]]=2) { if grid digit is not used }
and ( Z[w] in pm[peer2[step[w],p]] )
then
begin
n2:=0;
repeat
n2:=n2+1;
until ((n2 <> z[w]) and (N2 in pm[peer2[step[w],p]]));
h[w]:=h[w]-1; { advance the peer count for step w}
inc(w); {increase the step count}
setlength(z,(w+1));
z[w]:=n2;
setlength(h,(w+1));
setlength(step,(w+1)); {increse the array size to w}
setlength(a2,w+1);
a2[w]:=a2[w-1]+ [peer2[step[w-1],p]];
step[w]:=peer2[step[(w-1)],p]; {set the step cell active for the newly created step w}
h[w]:=19; {set the peer count for the new step w as 19}
break;
end
else
h[w]:=h[w]-1; {if the above is fasle then advance the peer number}
if ((h[w] < 0 ) and (w > 0)) {applies eliminations}
and (z[w] in pm[xn] ) and (z[w] <> n)
then
if (peer[xn]*peer[step[w]]) - a2[w] <> []
then
begin
active:=true;
covered2[z[w]]:= covered2[z[w]] - ((peer[xn] * peer[step[w]]) - a2[w]);
for t:= 0 to 26 do {base sector}
if (digitrcb[t,z[w]] * ([xn]+[step[w]]) = [])
then
for E in peerrcb[t] do
if (digitrcb[e,z[w]] * ([xn]+[step[w]]) <> [])
then
for u in (peerrcb[t]-[e]) do
if( DigitRCB[t,z[w]] * (DigitRcb[E,z[w]] + DigitRCB[u,z[w]]) = DigitRCB[t,z[w]] )
and (DigitRCB[t,z[w]] <> [])
then
begin
for g in ([0..80] - ([xn,step[w]] + digitrcb[t,z[w]] ) ) do
if ( (peer[g] * ((digitrcb[t,z[w]]*digitrcb[u,z[w]]) + ([xn]+[step[w]]) - (digitrcb[e,z[w]] * ([xn]+[step[w]])) ))
= ((digitrcb[t,z[w]] * digitrcb[u,z[w]])
+ (([xn]+[step[w]]) - (digitrcb[e,z[w]] * ([xn]+[step[w]] ) ) ) ) )
and (x in pm[g] )
then
begin
active:=true;
covered[g]:=covered[g] + [z[w]];
end;
if ((digitrcb[u,n]*([xn]+[step[w]])) + (digitrcb[e,n] * ([xn]+[step[w]])) = ([xn]+[step[w]]) )
then
begin
for p2:= w-1 downto 1 do
begin
active:=true;
covered2[z[p2]]:= covered2[z[p2]] + ((peer[step[p2+1]] * peer[step[p2]] ) - a2[w])
end;
end; {ring}
end; {fin eliminations}
end;
if ((h[w] < 0 ) and (w > 0))
and (z[w] in pm[xn]) and (z[w] <> n) and (step[w] in peer[xn] )
then
begin
for p2:= w-1 downto 1 do
begin
active:=true;
covered2[z[p2]]:= covered2[z[p2]] + ((peer[step[p2+1]] * peer[step[p2]] ) - a2[w])
end;
{determins if the found chains is actually a loop
elimination code is added however
it is covered by succesive runs of the chain code as is: }
end;
if ((h[w] < 0 ) and (w > 0 )) {the following resets the step to the previous state}
then
begin
w:=(w-1);
setlength(z,(w+1));
setlength(h,(w+1));
setlength(step,(w+1));
setlength(a2,w+1);
end;
until (w = 0) and (h[w] < 0)
end;
end; {trans xy-chain}
T-adds: Show
- Code: Select all
procedure transAdds(K,M,Q:integer); { k is writting function M is starting size q is ending size}
type
hold = array of integer;
base = array of numberset;
base2 = array of integer;
hold2 = array of RCBpeer;
base3 = array of array of numberset;
base4 = array of nums;
var
p,S,F,C,w,j,a,b,z,lx,x,g,l,n,act,t,e,u,xn:integer;
z1:nums;
z2:base4;
p2,lx1:numberset;
p3: base3;
h: hold;
step: base;
loc: base2;
List: hold2;
begin
cellcombo;
If M = 0
then
L:= 2
else
L:= M;
repeat
begin
for C:= slist[l] to flist[l] do
if (combocell[c] <> []) then
begin
act:=0;
for p in combocell[c]do begin
inc(act);
if act >=L then
break;
end;
if act >= L then
for p in combocell[c] do
if (peer[p] * combocell[c]<> [])
then
begin
w:=0; { step count}
setlength(h,w+1);
H[w]:=19; {starting cell position}
setlength(step,(w+1)); {set the array size to w}
setlength(list,(W+1)); {sets the array size to w}
setlength(p3,10,(w+1)); { digits cells}
setlength(loc,(w+1)); {starting cell}
setlength(z2,(w+1)); {starting cell}
list[w]:= [Rx[p]] + [(Cy[p]+9)]+ [(Bxy[P]+18)] ; {records active sectors}
step[w]:=[p]; { keeps track of what cells are used at each step W }
loc[w]:=p;
z2[w]:=[];
for n:= 1 to 9 do
begin
if n in pm[p]
then
p3[n,w]:= [p]
else
p3[n,w]:=[];
if n in pm[p]
then
z2[w]:=z2[w]+[n];
end;
repeat
for J:= h[w] downto 0 do
begin
if not (peer2[loc[w],j] in step[w])
and ( peer2[loc[w],j] in (combocell[c]))
and (( peer[peer2[loc[w],j]] * (combocell[c]-step[w]) <> []) or (w+2 = L))
then
begin
inc(w); {increase step count}
setlength(h,w+1); {increase lenght of step starting point array}
setlength(loc,(w+1)); {starting cell}
loc[w]:=peer2[loc[w-1],j];
setlength(list,(W+1));
list[w]:=list[w-1] + [Rx[peer2[loc[w-1],j]]] + [Cy[peer2[loc[w-1],j]]+9] + [BXY[peer2[loc[w-1],j]]+18];
H[w]:=19;
setlength(step,(w+1)); {set the array size to w}
step[w]:=step[w-1] + [peer2[loc[w-1],j]] ; { keeps track of what cells are used at each step W }
setlength(p3,10,(w+1)); { digits cells}
setlength(z2,(w+1)); { digits cells}
for n:= 1 to 9 do
begin
if n in pm[peer2[loc[w-1],j]]
then
p3[n,w]:= [peer2[loc[w-1],j]] + p3[n,w-1]
else
p3[n,w]:=p3[n,w-1]+p3[n,w];
if n in pm[peer2[loc[w-1],j]]
then
z2[w]:=z2[w-1]+[n] + z2[w]
else
z2[w]:=z2[w-1] + z2[w];
end;
end
else
dec(H[w]);
if (W = (l-1)) and (comboset[c] = z2[w] )
then
begin
lx1:=[];
z1:=[];
For N in comboset[c] do
for z in list[w] do
if (DigitRCB[z,n] * p3[n,w] = p3[n,w] )
then
begin
lx1:=lx1 + [z];
z1:=z1+[n];
end;
if ( L - popcnt(dword(z1)) = 1 ) and (z2[w] + z1 = comboset[c])
then
begin
for n in (comboset[c] -z1) do
for z in ([0..80] - p3[n,w] ) do
if (peer[z] * p3[n,w] = p3[n,w] )
and ( n in pm[z] )
then
begin
active:=true;
covered2[n]:= covered2[n] + [z];
end;
for n in (comboset[c] - z1) do
for t:= 0 to 26 do {base sector}
if (digitrcb[t,n] * p3[n,w] = [])
then
for E in peerrcb[t] do
if (digitrcb[e,n] * p3[n,w] <> [])
then
for u in (peerrcb[t]-[e]) do
if( DigitRCB[t,n] * (DigitRcb[E,n] + DigitRCB[u,n]) = DigitRCB[t,n] )
and (DigitRCB[t,n] <> [])
then
begin
for g in ([0..80] - (step[w] + digitrcb[t,n] ) ) do
if ( peer[g] * ( (digitrcb[t,n]*digitrcb[u,n])
+ ( p3[n,w] - (digitrcb[e,n]*p3[n,w]) ) )
= ((digitrcb[t,n]*digitrcb[u,n]) + ( p3[n,w] - (digitrcb[e,n]*p3[n,w])) ) )
and (n in pm[g] )
then
begin
active:=true;
covered[g]:=covered[g] + [n];
end;
if ((digitrcb[u,n]*p3[n,w]) + (digitrcb[e,n] * p3[n,w]) = p3[n,w] )
then
begin
for G in (z1*comboset[c]) do
begin
for xn in ([0..80] - step[w]) do
if (peer[xn] * p3[g,w] = p3[g,w] )
and (g in pm[xn] )
then
begin
covered[xn]:= covered[xn] + [g];
active:=true;
end;
end;
end; {ring}
end; { eliminations}
end;
end;
if (W = (L-1)) or (( W>0) and (H[w]= -1)) {back track sequence}
then
begin
repeat
Dec(w); {decrese step count}
setlength(h,w+1); {reduce lenght of step starting point array}
setlength(loc,(w+1)); {starting cell}
setlength(list,(w+1));
dec(h[w]);
setlength(step,(w+1)); {set the array size to w}
setlength(p3,10,(w+1));
setlength(z2,w+1);
until (H[w]> -1) or (w=0)
end;
end;
until (h[W] = -1)
end;
end;
end;
if m = 0
then
inc(L);
until (L = m) or (L > q); { change the 6 to a range of 2-9 to stop the cycles}
end; {fin transport aDDS}