###################################################################### ## RingRing.txt Save this file as RingRing.txt to use it, # # stay in the # ## same directory, get into Maple (by typing: maple ) # ## and then type: read RingRing.txt # ## Then follow the instructions given there # ## # ## Written by Doron Zeilberger, Rutgers University , # ## DoronZeil at gmail dot com # ###################################################################### print(`First Written: June 2021: tested for Maple 2018 `): print(`Version : June 2021: `): print(): print(`This is RingRing.txt, A Maple package to solve and generate Ring Ring puzzles as appearing (starting June 2021) in the New York Times magazine`): print(`created by Prasanna Seshadri`): print(`accompanying Shalsoh B. Ekhad's book `): print(`Fifty Ring Ring puzzles `): print(` `): print(): print(`The most current version is available on WWW at:`): print(` http://sites.math.rutgers.edu/~zeilberg/tokhniot/RingRing.txt .`): print(`Please report all bugs to: DoronZeil at gmail dot com .`): print(): print(`For general help, and a list of the MAIN functions,`): print(` type "ezra();". For specific help type "ezra(procedure_name);" `): print(`For a list of the supporting functions type: ezra1();`): print(): ezraDB:=proc() if args=NULL then print(`The prec-computed datab-base procedures are`): print(` DB66, DB77, DB88, NYT`): else ezra(args): fi: end: ezra1:=proc() if args=NULL then print(`The SUPPORTING procedures are`): print(` CP, FindNewRecs, IniReg, Kids, MakePuz1, PeriE, PeriV, Rec, RecCov`): else ezra(args): fi: end: ezra:=proc() if args=NULL then print(` RingRing.txt: A Maple package for solving and creating RingRing puzzles`): print(`The MAIN procedures are`): print(` MakePuzBook, MakePuzSol, PlotPuz, PlotSol, RingRing `): elif nargs=1 and args[1]=CP then print(`CP(S): given a set of lattice points, S, finds the point [i,j] such that i is as small as possible and for that i, j is as small as possible . Try:`): print(`CP({[0,0],[1,0],[2,0],[2,2],[-2,-5]});`): elif nargs=1 and args[1]=CP then print(`CP(S): given a set of lattice points, S, finds the point [i,j] such that i is as small as possible and for that i, j is as small as possible . Try:`): print(`CP({[0,0],[1,0],[2,0],[2,2],[-2,-5]});`): elif nargs=1 and args[1]=DB66 then print(`DB66(): a list of 50 pre-computed Ring Ring 6 by 6 puzzles and their solutions. Try:`): print(`P:=DB66()[1]: S:=RingRing(6,6,P[1]): evalb(nops(S)=1); evalb(P[2]=S[1]); PlotSol(6,6,op(P)); `): elif nargs=1 and args[1]=DB77 then print(`DB77(): a list of 50 pre-computed Ring Ring 7 by 7 puzzles and their solutions. Try:`): print(`P:=DB77()[1]: S:=RingRing(7,7,P[1]): evalb(nops(S)=1); evalb(P[2]=S[1]); PlotSol(7,7,op(P)); `): elif nargs=1 and args[1]=DB88 then print(`DB88(): a list of 50 pre-computed Ring Ring 8 by 8 puzzles and their solutions. Try:`): print(`P:=DB88()[1]: S:=RingRing(8,8,P[1]): evalb(nops(S)=1); evalb(P[2]=S[1]); PlotSol(8,8,op(P)); `): elif nargs=1 and args[1]=NYT then print(`NYT(): a list of Ring Ring puzzles (so far 8) on a 10 by 10 grid, that appeared in the New York Times created by Prasanna Seshadri`): print(`P:=NYT()[1]: S:=RingRing(10,10,P): evalb(nops(S)=1); PlotSol(10,10,P,S[1]); `): elif nargs=1 and args[1]=FindNewRecs then print(`FindNewRecs(a,b,S,FE): given positive integers a and b, a set of already occupied lattice points S`): print(`and a set of already-used edges, FE`): print(`outputs the set all legal new rectangles followed by the new occupied set, and the new set of used edges`): print(`FindNewRecs(4,4,{},{});`): elif nargs=1 and args[1]=IniReg then print(`IniReg(a,b,S): inputs positive integers a and b and a subset of lattice points S, outputs the set of all`): print(`sets of rectangles that solve the Ring Ring puzzle where the region to be covered is`): print(`the rectangle [0,a-1]x[0,b-1] minus the set S. For example, for the puzzle of New Times magazine (created by Prassana Seshadri) Sunday, June 20, 2021, type:`): print(`IniReg(8,8,{[7,0],[3,1],[4,1],[0,2],[7,4],[5,5],[1,6],[2,6]});`): elif nargs=1 and args[1]=Kids then print(`KidS(St): Inputs a state St=[NeverUsed,UsedOnce,ForbiddenEdges] outputs the set of pairs [R,St1] obtained by inserting legally a rectangle, R, that is a subset of NeverUsed union UsedOnce`): print(`followed by the new state where the vertices of R intersect NeverUsed get moved to UsedOnce, the vertices of $ intersect UsedOnce are removed, and the new edges of Rec are joined to`): print(`ForbiddenEdges. Try:`): print(`Kids([IniReg(8,8,{[7,0],[3,1],[4,1],[0,2],[7,4],[5,5],[1,6],[2,6]}),{},{}]);`): elif nargs=1 and args[1]=MakePuzBook then print(`MakePuzBook(a,b,K,M): Creates a list of M RingRing puzzles along with their solution for an a by b rectangle by calling MakePuzSol(a,b,K) M times. Try:`): print(`MakePuzBook(6,6,100,10);`): elif nargs=1 and args[1]=MakePuzSol then print(`MakePuzSol(a,b,K): Makes a random puzzle and its unique solution for an a by b rectangle but trying out MakePusSol1(a,b) K times. If it does not find anything, it returns FAIL.Try:`): print(`MakePuzSol(6,6,100);`): elif nargs=1 and args[1]=MakePuzSol1 then print(`MakePuzSol1(a,b): Makes a random puzzle and its solution for an a by b rectangle if there is no unique solution or or takes more than 2 seconds, it returns FAIL. try:`): print(`MakePuzSol1(6,6);`): elif nargs=1 and args[1]=PeriE then print(`PeriE(pt,a,b): The set of edges in perimeter of an a by b rectangle whose bottom left vertex is the lattice point pt. In other words [0,a-1]x[0,b-1]+pt`): print(`Try:`): print(`PeriE([2,3],3,2):`): elif nargs=1 and args[1]=PeriV then print(`PeriV(pt,a,b): The set of vertices in perimeter of an a by b rectangle whose bottom left vertex is the lattice point pt. In other words [0,a-1]x[0,b-1]+pt`): print(`Try: `): print(`PeriV([2,3],[3,2]):`): elif nargs=1 and args[1]=PlotPuz then print(`PlotPuz(a,b,S): plots the puzzle (a,b,S)`): print(``): print(`Try`): print(`PlotPuz(8,8,{[7,0],[3,1],[4,1],[0,2],[7,4],[5,5],[1,6],[2,6]});`): print(`PlotPuz(8,8,{[5,0],[6,0],[7,0],[2,2],[5,3],[0,4],[2,4],[3,5],[3,7],[7,7]});`): print(``): print(`For the puzzle of mid June, 2021 type:`): print(`PlotPuz(8,8,{[7,0],[7,1],[0,2],[1,2],[4,2],[7,2],[0,3],[4,6],[3,7],[4,7]});`): print(``): print(`For the puzzle of June 27, 2021 type:`): print(`PlotPuz(10,10,{[5,1],[6,1],[5,2],[4,3],[5,3],[4,4],[1,5],[8,5],[3,6],[4,6],[6,6],[2,7],[3,7],[9,9]});`): elif nargs=1 and args[1]=PlotSol then print(`PlotSol(a,b,S,SOL): plots the solution SOL of the Ring Ring puzzle (a,b,S). You need to enter S as well. `): print(``): print(`Try: `): print(`S:= {[7,0],[3,1],[4,1],[0,2],[7,4],[5,5],[1,6],[2,6]}; PlotSol(8,8,S,RingRing(8,8,S));`): print(``): print(`S:={[5,0],[6,0],[7,0],[2,2],[5,3],[0,4],[2,4],[3,5],[3,7],[7,7]} ; PlotSol(8,8,S,RingRing(8,8,S));`): print(`For the puzzle of mid June, 2021 type:`): print(`S:={[7,0],[7,1],[0,2],[1,2],[4,2],[7,2],[0,3],[4,6],[3,7],[4,7]} ; PlotSol(8,8,S,RingRing(8,8,S));`): print(``): print(`For the puzzle of June 27, 2021 type:`): print(`S:={[5,1],[6,1],[5,2],[4,3],[5,3],[4,4],[1,5],[8,5],[3,6],[4,6],[6,6],[2,7],[3,7],[9,9]}; PlotSol(10,10,S,RingRing(10,10,S));`): elif nargs=1 and args[1]=Rec then print(`Rec(a,b): The rectangle [0,a-1]x[0,b-1]. Try:`): print(`Rec(8,8);`): elif nargs=1 and args[1]=RecCov then print(`RecCov(St): The set of coverings of St[1] that obey the rules and avoid Forbidden Edges`): elif nargs=1 and args[1]=RingRing then print(`RingRing(a,b,S): inputs a Ring Ring puzzle in the rectangle [0,a-1]x[0,b-1] with the lattice points of S deleted, outputs the set of solutions to a Ring Ring puzzle. Try:`): print(`RingRing(8,8,{[7,0],[3,1],[4,1],[0,2],[7,4],[5,5],[1,6],[2,6]});`): print(`RingRing(8,8,{[5,0],[6,0],[7,0],[2,2],[5,3],[0,4],[2,4],[3,5],[3,7],[7,7]});`): print(``): print(`For the puzzle of mid June, 2021 type:`): print(`RingRing(8,8,{[7,0],[7,1],[0,2],[1,2],[4,2],[7,2],[0,3],[4,6],[3,7],[4,7]});`): print(``): print(`For the puzzle of June 27, 2021 type:`): print(`RingRing(10,10,{[5,1],[6,1],[5,2],[4,3],[5,3],[4,4],[1,5],[8,5],[3,6],[4,6],[6,6],[2,7],[3,7],[9,9]});`): print(``): print(`For the puzzle of July 4, 2021 type:`): print(`P:={[1,1],[6,1],[7,1],[8,1],[1,2],[8,2],[1,3],[1,4],[2,4],[3,5],[4,5],[5,5],[3,6],[6,6],[6,7],[6,8],[7,8],[8,8]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); print(``): print(`For the puzzle of July 11, 2021 type:`): print(`P:={[3,0],[8,1],[0,2],[8,2],[5,3],[7,4],[0,5],[3,5],[6,5],[7,5],[2,6],[3,6],[6,6],[2,7],[4,8],[9,9]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); print(``): print(`For the puzzle of July 18, 2021 type:`): print(`P:={[2,0],[3,0],[6,0],[9,2],[1,3],[3,4],[6,4],[0,6],[3,6],[6,6],[1,8],[4,8],[7,8],[8,8]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); print(``): print(`For the puzzle of July 25, 2021 type:`): print(`P:={[0,0],[1,0],[2,0],[4,2],[5,2],[4,4], [4,5],[6,5],[7,5],[1,6],[2,6],[7,6],[0,8], [7,8],[8,8],[0,9],[3,9],[4,9]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); print(``): print(`For the puzzle of Aug. 1, 2021 type:`): print(`P:={[0,0],[1,0],[4,0],[8,1],[1,2],[5,2],[6,2],[8,2],[5,3],[6,3],[2,4],[3,4],[6,4],[7,4], [2,5],[3,5],[0,6],[3,6],[4,6],[3,8], [5,8],[5,9]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); print(``): print(`For the puzzle of Aug. 8, 2021 type:`): print(`P:={[6,0],[1,1],[2,1],[6,1],[8,1],[8,2],[2,3],[4,3],[5,3],[8,3],[4,5],[5,5],[0,6],[4,7],[5,7],[7,7],[4,9],[5,9]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); print(``): print(`For the puzzle of Aug. 15, 2021 type:`): print(`P:={[4,2],[4,3],[5,4],[5,5],[0,6],[2,6],[3,7],[6,7],[3,9],[6,9]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); print(``): print(`For the puzzle of Aug. 29, 2021 type:`): print(`P:={[3,0],[6,0],[1,3],[3,3],[4,3],[5,3],[6,3],[3,4],[6,4],[9,4],[3,6],[6,6],[4,7],[5,7],[1,8],[4,9],[5,9],[9,9]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); print(``): print(`For the puzzle of Sept. 5, 2021 type:`): print(`P:={[0,0],[0,1],[6,1],[9,2],[3,3],[4,3],[3,4],[4,4],[9,6],[0,7],[8,7],[9,7],[0,8],[1,8],[6,8],[0,9],[1,9],[2,9],[5,9],[6,9]};`): print(`SOL:=RingRing(10,10,P);`): print(`nops(SOL);`): print(`PlotSol(10,10,P,SOL[1]);`); else print(`There is no such thing as`, args): fi: end: with(plots): #start pre-computed puzzles and solutions #DB66(): A pre-computed list of 50 5 by 6 Ring Ring puzzles DB66:=proc(): [[{[0, 0], [1, 4], [2, 2], [2, 4], [4, 1], [4, 2]}, {[[0, 1], [4, 5]], [[1, 0], [5, 4]], [[4, 4], [2, 2]]}], [{[0, 0], [0, 1], [0, 2], [0, 5], [1, 5], [3, 4], [4, 1], [4, 4]}, {[[0, 3], [2, 2]], [[1, 0], [2, 3]], [[2, 3], [4, 3]], [[3, 0] , [3, 3]]}], [{[0, 0], [0, 1], [1, 4], [2, 1], [3, 5], [4, 5], [5, 0], [5, 5]}, {[[0, 2], [3, 4]], [[1, 0], [4, 4]], [[3, 1], [3, 4]]}], [{[0, 0], [0, 4], [0, 5], [2, 4], [3, 1], [3, 4], [5, 0], [5, 1], [5, 4], [5, 5]}, {[[0, 1], [3, 3]], [[1, 0], [4, 6]], [[3, 2], [3, 2]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [2, 5], [3, 2], [3, 5], [4, 5], [5, 4], [5, 5]}, {[[0, 4], [2, 2]], [[1, 0], [5, 4]], [ [2, 1], [3, 4]]}], [{[0, 0], [0, 1], [0, 5], [1, 5], [2, 2], [3, 0], [3, 4], [4 , 0], [4, 4], [5, 0]}, {[[0, 2], [2, 3]], [[1, 0], [2, 2]], [[2, 3], [4, 3]], [ [3, 1], [3, 2]]}], [{[0, 2], [2, 0], [2, 1], [3, 0], [4, 0], [4, 3], [5, 0], [5 , 1], [5, 2], [5, 3]}, {[[0, 0], [2, 2]], [[0, 3], [4, 3]], [[1, 2], [2, 3]], [ [3, 1], [2, 2]], [[4, 4], [2, 2]]}], [{[0, 0], [0, 5], [1, 3], [1, 5], [3, 0], [4, 0], [4, 4], [5, 0]}, {[[0, 1], [4, 4]], [[1, 0], [2, 3]], [[2, 3], [4, 3]], [[4, 1], [2, 2]]}], [{[0, 0], [1, 0], [1, 4], [4, 0], [5, 0], [5, 1], [5, 4], [ 5, 5]}, {[[0, 1], [5, 5]], [[1, 2], [5, 2]], [[2, 0], [2, 5]]}], [{[0, 0], [0, 4], [0, 5], [2, 4], [3, 1], [5, 0], [5, 1], [5, 5]}, {[[0, 1], [3, 3]], [[1, 0] , [4, 6]], [[3, 2], [3, 3]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [3, 2] , [3, 4], [4, 4]}, {[[0, 4], [2, 2]], [[1, 1], [4, 3]], [[2, 0], [4, 6]]}], [{[ 0, 4], [0, 5], [1, 5], [2, 5], [3, 1], [4, 4], [5, 0], [5, 1]}, {[[0, 0], [5, 4 ]], [[1, 1], [2, 4]], [[3, 2], [3, 4]]}], [{[0, 2], [0, 3], [0, 4], [0, 5], [1, 2], [2, 4], [3, 1], [3, 4], [4, 4], [5, 0], [5, 1], [5, 2]}, {[[0, 0], [2, 2]], [[1, 3], [5, 3]], [[2, 0], [3, 3]]}], [{[0, 0], [0, 3], [0, 4], [0, 5], [1, 0], [4, 0], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]}, {[[0, 1], [5, 2]], [[1 , 3], [4, 3]], [[2, 0], [2, 5]]}], [{[0, 5], [1, 1], [1, 2], [1, 3], [1, 5], [2 , 5], [4, 3], [4, 4], [5, 0], [5, 1]}, {[[0, 0], [3, 5]], [[3, 0], [2, 2]], [[3 , 2], [3, 4]]}], [{[0, 2], [1, 2], [1, 4], [2, 0], [2, 1], [2, 2], [5, 0], [5, 1]}, {[[0, 0], [2, 2]], [[0, 3], [3, 3]], [[3, 0], [2, 2]], [[3, 2], [3, 2]], [ [3, 4], [3, 2]]}], [{[0, 2], [0, 5], [1, 2], [1, 5], [2, 0], [2, 1], [2, 2], [2 , 3], [5, 2], [5, 3], [5, 4], [5, 5]}, {[[0, 0], [2, 2]], [[0, 3], [2, 2]], [[2 , 4], [3, 2]], [[3, 0], [3, 2]], [[3, 2], [2, 2]]}], [{[0, 0], [0, 1], [1, 0], [2, 0], [2, 3], [3, 0], [4, 3], [4, 4]}, {[[0, 2], [6, 4]], [[1, 1], [3, 4]], [ [4, 0], [2, 2]]}], [{[0, 0], [0, 4], [0, 5], [1, 0], [1, 5], [5, 0], [5, 4], [5 , 5]}, {[[0, 1], [6, 3]], [[1, 2], [3, 3]], [[2, 0], [3, 6]]}], [{[0, 4], [0, 5 ], [1, 1], [4, 5], [5, 0], [5, 5]}, {[[0, 0], [5, 4]], [[1, 2], [3, 4]], [[2, 1 ], [4, 4]]}], [{[0, 0], [3, 0], [3, 4], [4, 2], [4, 4], [5, 2]}, {[[0, 1], [4, 2]], [[0, 3], [6, 3]], [[1, 0], [2, 5]], [[4, 0], [2, 2]]}], [{[0, 0], [0, 1], [0, 2], [1, 0], [1, 4], [2, 0], [3, 0], [3, 3], [4, 0], [5, 0], [5, 4], [5, 5]} , {[[0, 3], [3, 3]], [[1, 1], [3, 2]], [[3, 4], [2, 2]], [[4, 1], [2, 3]]}], [{ [0, 2], [0, 3], [0, 4], [0, 5], [2, 0], [3, 0], [4, 0], [4, 2], [4, 3], [4, 5], [5, 0], [5, 5]}, {[[0, 0], [2, 2]], [[1, 2], [3, 4]], [[2, 1], [4, 4]]}], [{[0, 0], [0, 3], [0, 4], [0, 5], [1, 0], [2, 0], [2, 1], [2, 2], [2, 4], [4, 1], [4, 3], [5, 3]}, {[[0, 1], [2, 2]], [[1, 3], [3, 3]], [[3, 0], [3, 3]], [[4, 4], [2 , 2]]}], [{[0, 2], [0, 5], [1, 2], [1, 5], [2, 0], [2, 1], [2, 2], [2, 5], [3, 0], [3, 3], [4, 0], [4, 3], [5, 0], [5, 3], [5, 4], [5, 5]}, {[[0, 0], [2, 2]], [[0, 3], [3, 2]], [[3, 1], [3, 2]], [[3, 4], [2, 2]]}], [{[0, 0], [0, 5], [1, 0 ], [2, 0], [3, 4], [4, 4], [5, 0], [5, 1]}, {[[0, 1], [3, 4]], [[1, 2], [5, 4]] , [[3, 0], [2, 4]]}], [{[0, 2], [0, 3], [0, 4], [0, 5], [2, 0], [2, 4], [3, 0], [3, 4], [5, 2], [5, 3], [5, 4], [5, 5]}, {[[0, 0], [2, 2]], [[1, 2], [4, 4]], [ [2, 1], [2, 3]], [[4, 0], [2, 2]]}], [{[1, 3], [1, 4], [2, 0], [3, 0], [4, 0], [4, 2], [4, 3], [4, 5], [5, 0], [5, 5]}, {[[0, 0], [2, 2]], [[0, 2], [4, 4]], [ [2, 1], [4, 4]]}], [{[0, 0], [0, 1], [1, 4], [2, 4], [3, 0], [4, 0], [5, 0], [5 , 5]}, {[[0, 2], [5, 4]], [[1, 0], [2, 4]], [[3, 1], [3, 4]]}], [{[0, 0], [0, 5 ], [1, 5], [2, 5], [3, 0], [3, 5], [4, 2], [5, 2]}, {[[0, 1], [4, 4]], [[1, 0], [2, 4]], [[4, 0], [2, 2]], [[4, 3], [2, 3]]}], [{[0, 0], [0, 1], [0, 2], [0, 3] , [2, 1], [3, 1], [3, 4], [4, 4], [5, 0], [5, 1]}, {[[0, 4], [2, 2]], [[1, 0], [4, 4]], [[2, 2], [4, 4]]}], [{[0, 0], [0, 1], [0, 4], [0, 5], [1, 5], [4, 0], [4, 4], [5, 0]}, {[[0, 2], [5, 2]], [[1, 0], [3, 5]], [[2, 1], [4, 5]]}], [{[0, 3], [0, 4], [0, 5], [1, 5], [3, 0], [5, 3], [5, 4], [5, 5]}, {[[0, 0], [3, 3]], [[1, 1], [3, 4]], [[2, 3], [3, 3]], [[4, 0], [2, 3]]}], [{[0, 0], [0, 1], [0, 4 ], [0, 5], [1, 0], [1, 5], [5, 0], [5, 5]}, {[[0, 2], [4, 2]], [[1, 1], [5, 4]] , [[2, 0], [3, 6]]}], [{[0, 0], [0, 5], [1, 5], [2, 5], [3, 4], [3, 5], [5, 0], [5, 3]}, {[[0, 1], [3, 4]], [[1, 0], [4, 4]], [[3, 1], [3, 2]], [[4, 4], [2, 2] ]}], [{[0, 4], [0, 5], [4, 0], [5, 0], [5, 1], [5, 5]}, {[[0, 0], [4, 4]], [[1, 1], [4, 5]], [[2, 2], [4, 3]]}], [{[1, 1], [2, 1], [3, 4], [4, 0], [4, 4], [5, 0]}, {[[0, 0], [4, 3]], [[0, 3], [2, 3]], [[2, 3], [4, 3]], [[4, 1], [2, 2]]}], [{[0, 2], [0, 3], [3, 0], [4, 0], [4, 2], [4, 3], [4, 4], [5, 0]}, {[[0, 0], [3 , 2]], [[0, 4], [3, 2]], [[1, 2], [2, 2]], [[3, 1], [3, 5]]}], [{[0, 0], [0, 4] , [0, 5], [1, 5], [4, 0], [4, 4], [5, 0], [5, 1]}, {[[0, 1], [5, 3]], [[1, 0], [3, 5]], [[2, 2], [4, 4]]}], [{[0, 5], [1, 5], [2, 0], [2, 5], [3, 5], [4, 3], [4, 5], [5, 5]}, {[[0, 0], [2, 3]], [[0, 3], [3, 2]], [[2, 1], [3, 2]], [[3, 0] , [3, 5]]}], [{[0, 0], [0, 5], [1, 0], [1, 5], [2, 0], [2, 3], [2, 4], [2, 5], [3, 5], [4, 1], [4, 5], [5, 3], [5, 4], [5, 5]}, {[[0, 1], [3, 2]], [[0, 3], [2 , 2]], [[3, 0], [3, 3]], [[3, 3], [2, 2]]}], [{[0, 0], [0, 5], [1, 0], [1, 5], [2, 0], [2, 1], [2, 2], [2, 5], [3, 4], [3, 5], [5, 0], [5, 1]}, {[[0, 1], [2, 2]], [[0, 3], [3, 2]], [[3, 0], [2, 2]], [[3, 2], [3, 2]], [[4, 4], [2, 2]]}], [{[0, 4], [0, 5], [1, 1], [4, 4], [5, 0], [5, 1]}, {[[0, 0], [5, 4]], [[1, 2], [5, 4]], [[2, 1], [2, 4]]}], [{[0, 0], [0, 1], [0, 2], [1, 2], [2, 4], [2, 5], [3, 0], [4, 0], [5, 0], [5, 1], [5, 4], [5, 5]}, {[[0, 3], [2, 3]], [[1, 0], [2 , 2]], [[2, 2], [4, 2]], [[3, 1], [2, 5]]}], [{[0, 2], [0, 3], [0, 4], [0, 5], [3, 1], [4, 5], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 5]}, {[[0, 0], [2, 2]], [[1, 2], [3, 4]], [[2, 0], [3, 5]]}], [{[0, 4], [0, 5], [1, 1], [1, 5], [2 , 1], [2, 5], [3, 5], [4, 5], [5, 4], [5, 5]}, {[[0, 0], [6, 4]], [[1, 2], [2, 3]], [[3, 1], [2, 4]]}], [{[0, 0], [0, 5], [1, 0], [1, 5], [4, 0], [4, 5], [5, 0], [5, 1], [5, 4], [5, 5]}, {[[0, 1], [5, 4]], [[1, 2], [5, 2]], [[2, 0], [2, 6]]}], [{[0, 0], [4, 0], [5, 0], [5, 1], [5, 4], [5, 5]}, {[[0, 1], [5, 5]], [[ 1, 0], [3, 5]], [[2, 2], [4, 2]]}], [{[0, 3], [0, 4], [0, 5], [1, 5], [2, 0], [ 2, 5], [3, 0], [3, 3], [4, 0], [5, 0]}, {[[0, 0], [2, 3]], [[1, 3], [2, 2]], [[ 2, 1], [2, 2]], [[3, 4], [3, 2]], [[4, 1], [2, 3]]}], [{[0, 2], [0, 3], [2, 0], [2, 5], [3, 0], [3, 5], [4, 0], [4, 2], [4, 3], [4, 5], [5, 0], [5, 5]}, {[[0, 0], [2, 2]], [[0, 4], [2, 2]], [[1, 2], [3, 2]], [[2, 1], [4, 4]]}]]: end: #DB77(): A list of 50 7 by 7 Ring Ring puzzles (and their solutions) DB77:=proc(): [[{[0, 0], [0, 1], [0, 2], [0, 3], [2, 1], [4, 3], [5, 1], [5, 3], [5, 6], [6, 3], [6, 6]}, {[[0, 4], [5, 3]], [[1, 0], [3, 3]], [[1, 3], [3, 3]], [[4, 0], [3 , 3]], [[5, 4], [2, 2]]}], [{[0, 0], [0, 3], [1, 0], [1, 3], [2, 0], [2, 5], [2 , 6], [4, 5], [5, 0], [5, 5], [6, 0], [6, 1], [6, 2]}, {[[0, 1], [2, 2]], [[0, 4], [2, 3]], [[2, 1], [4, 4]], [[3, 0], [2, 3]], [[3, 3], [4, 4]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [2, 1], [2, 5], [3, 1], [3, 5], [5, 0], [5, 4], [6, 0], [6, 4]}, {[[1, 0], [4, 7]], [[2, 2], [2, 3]], [[5, 1], [2, 3]], [[5, 5], [2, 2]]}], [{[0, 5], [0, 6], [1, 1], [1, 6], [4, 0], [5, 6], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]}, {[[0, 0], [4, 5]], [[1, 2], [5, 4]], [ [2, 1], [3, 6]], [[5, 0], [2, 2]]}], [{[0, 0], [0, 3], [0, 6], [1, 0], [1, 3], [1, 6], [2, 3], [2, 6], [3, 5], [3, 6], [6, 2], [6, 5], [6, 6]}, {[[0, 1], [2, 2]], [[0, 4], [3, 2]], [[2, 0], [2, 3]], [[3, 3], [4, 2]], [[4, 0], [3, 2]], [[ 4, 2], [2, 5]]}], [{[0, 0], [0, 5], [0, 6], [1, 0], [1, 6], [2, 6], [3, 6], [5, 3], [6, 6]}, {[[0, 1], [4, 4]], [[1, 2], [6, 4]], [[2, 0], [3, 4]], [[4, 4], [2 , 3]], [[5, 0], [2, 2]]}], [{[0, 5], [0, 6], [1, 1], [1, 2], [2, 1], [3, 1], [6 , 2]}, {[[0, 0], [5, 5]], [[1, 3], [6, 4]], [[2, 2], [4, 4]], [[5, 0], [2, 2]]} ], [{[0, 0], [1, 0], [3, 3], [5, 0], [6, 0], [6, 1], [6, 6]}, {[[0, 1], [6, 6]] , [[1, 2], [6, 4]], [[2, 0], [3, 5]]}], [{[0, 6], [1, 1], [1, 4], [1, 6], [3, 0 ], [4, 0], [5, 0], [6, 0], [6, 4], [6, 5], [6, 6]}, {[[0, 0], [3, 3]], [[0, 3], [5, 3]], [[2, 4], [4, 3]], [[3, 1], [2, 2]], [[5, 1], [2, 3]]}], [{[0, 2], [0, 3], [0, 4], [2, 6], [5, 0], [5, 5], [6, 0]}, {[[0, 0], [2, 2]], [[0, 5], [2, 2] ], [[1, 2], [5, 3]], [[2, 0], [3, 6]], [[3, 1], [4, 6]]}], [{[0, 0], [0, 1], [1 , 5], [2, 5], [4, 2], [4, 5], [4, 6], [6, 0], [6, 4]}, {[[0, 2], [4, 5]], [[1, 0], [5, 5]], [[2, 1], [5, 3]], [[5, 5], [2, 2]]}], [{[0, 3], [0, 6], [1, 1], [1 , 3], [1, 6], [2, 1], [2, 5], [2, 6], [4, 5], [5, 0], [6, 0], [6, 1], [6, 2], [ 6, 5], [6, 6]}, {[[0, 0], [5, 3]], [[0, 4], [2, 2]], [[2, 3], [5, 2]], [[3, 1], [3, 6]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [0, 6], [1, 6], [6, 0], [6, 1], [6 , 6]}, {[[0, 4], [2, 2]], [[1, 0], [3, 2]], [[1, 2], [2, 2]], [[2, 4], [4, 3]], [[3, 2], [4, 4]], [[4, 0], [2, 4]]}], [{[0, 5], [0, 6], [1, 6], [2, 2], [2, 3], [2, 6], [5, 0], [6, 0], [6, 1]}, {[[0, 0], [5, 5]], [[1, 1], [5, 5]], [[3, 2], [4, 5]]}], [{[0, 0], [0, 4], [1, 0], [2, 0], [3, 0], [3, 5], [3, 6], [5, 5], [6 , 0], [6, 1], [6, 2]}, {[[0, 1], [4, 3]], [[0, 5], [3, 2]], [[1, 2], [5, 3]], [ [4, 0], [2, 2]], [[4, 3], [3, 4]]}], [{[0, 6], [1, 3], [1, 4], [1, 6], [2, 0], [5, 6], [6, 0], [6, 1], [6, 6]}, {[[0, 0], [2, 2]], [[0, 2], [7, 4]], [[2, 1], [3, 6]], [[3, 0], [3, 5]]}], [{[0, 0], [0, 1], [0, 2], [0, 5], [0, 6], [1, 0], [1, 6], [2, 0], [3, 0], [4, 0], [4, 1], [5, 2], [6, 2]}, {[[0, 3], [7, 2]], [[1 , 1], [3, 5]], [[2, 2], [3, 5]], [[5, 0], [2, 2]], [[5, 5], [2, 2]]}], [{[0, 0] , [0, 3], [0, 6], [1, 0], [1, 3], [1, 6], [2, 0], [2, 6], [4, 4], [6, 0], [6, 1 ]}, {[[0, 1], [3, 2]], [[0, 4], [2, 2]], [[2, 3], [4, 3]], [[3, 0], [3, 2]], [[ 3, 2], [4, 5]]}], [{[0, 0], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 3], [1, 6], [2, 0], [2, 6], [3, 6], [6, 0], [6, 4], [6, 5], [6, 6]}, {[[0, 1], [2, 2]], [[1, 4], [3, 2]], [[2, 1], [5, 3]], [[3, 0], [3, 3]], [[4, 4], [2, 3]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 2], [1, 6], [4, 1], [5, 5], [6, 0], [6, 1]}, {[[1, 0], [2, 2]], [[1, 3], [4, 3]], [[2, 2], [5, 5]], [[3 , 0], [3, 5]]}], [{[0, 2], [1, 5], [2, 5], [3, 0], [3, 1], [3, 2], [4, 5], [4, 6], [5, 1]}, {[[0, 0], [3, 2]], [[0, 3], [4, 4]], [[1, 2], [2, 3]], [[4, 0], [3 , 3]], [[4, 3], [3, 2]], [[5, 5], [2, 2]]}], [{[0, 0], [0, 3], [0, 4], [1, 0], [2, 6], [3, 6], [4, 1], [4, 6], [5, 6], [6, 0], [6, 1], [6, 5], [6, 6]}, {[[0, 1], [4, 2]], [[0, 5], [2, 2]], [[1, 3], [3, 2]], [[2, 0], [4, 6]], [[4, 2], [3, 3]]}], [{[0, 0], [2, 4], [3, 0], [4, 0], [4, 1], [4, 2], [6, 6]}, {[[0, 1], [4, 6]], [[1, 0], [2, 3]], [[1, 3], [6, 3]], [[4, 4], [2, 3]], [[5, 0], [2, 3]]}], [{[0, 3], [3, 1], [3, 4], [3, 6], [4, 1], [5, 1], [6, 6]}, {[[0, 0], [2, 3]], [ [0, 4], [3, 3]], [[1, 3], [6, 3]], [[2, 0], [5, 3]], [[4, 4], [2, 3]]}], [{[0, 4], [0, 5], [0, 6], [1, 1], [3, 4], [4, 0], [4, 3], [4, 4], [5, 0], [6, 0], [6, 6]}, {[[0, 0], [4, 4]], [[1, 2], [5, 5]], [[2, 1], [5, 5]]}], [{[0, 0], [0, 1], [0, 6], [1, 0], [1, 6], [2, 0], [3, 0], [4, 0], [4, 3], [4, 6], [5, 0], [5, 6], [6, 0], [6, 5], [6, 6]}, {[[0, 2], [6, 4]], [[1, 1], [6, 4]], [[2, 3], [2, 4]]} ], [{[0, 3], [1, 3], [1, 5], [2, 0], [2, 5], [3, 5], [5, 4], [6, 0], [6, 4]}, { [[0, 0], [2, 3]], [[0, 4], [5, 3]], [[2, 1], [5, 3]], [[3, 0], [3, 3]], [[5, 5] , [2, 2]]}], [{[0, 0], [0, 4], [1, 0], [1, 2], [1, 4], [2, 0], [2, 5], [2, 6], [3, 0], [4, 0], [5, 0], [5, 4], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]}, {[[0, 1], [6, 3]], [[0, 5], [2, 2]], [[2, 2], [3, 3]], [[3, 5], [3, 2] ]}], [{[0, 0], [0, 4], [0, 5], [0, 6], [1, 0], [1, 2], [1, 6], [2, 6], [3, 6], [4, 0], [5, 0], [5, 3], [5, 5], [6, 0], [6, 3]}, {[[0, 1], [5, 3]], [[1, 4], [3 , 2]], [[2, 0], [2, 3]], [[4, 4], [3, 3]], [[5, 1], [2, 2]]}], [{[0, 0], [0, 1] , [0, 5], [0, 6], [1, 6], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5 ], [6, 6]}, {[[0, 2], [4, 3]], [[1, 0], [5, 6]], [[2, 1], [3, 6]]}], [{[0, 0], [1, 0], [1, 5], [2, 0], [2, 3], [2, 5], [3, 0], [4, 0], [5, 6], [6, 2], [6, 6]} , {[[0, 1], [5, 6]], [[1, 2], [5, 3]], [[3, 3], [4, 3]], [[5, 0], [2, 2]]}], [{ [0, 0], [0, 1], [0, 2], [0, 6], [1, 0], [1, 6], [2, 6], [3, 3], [3, 5], [3, 6], [4, 0], [4, 6], [5, 0], [5, 6], [6, 0], [6, 5], [6, 6]}, {[[0, 3], [3, 3]], [[1 , 1], [6, 4]], [[2, 0], [2, 3]], [[4, 2], [2, 4]]}], [{[0, 5], [0, 6], [1, 3], [2, 0], [2, 1], [3, 3], [3, 6], [4, 6], [5, 6], [6, 3], [6, 4], [6, 5], [6, 6]} , {[[0, 0], [2, 2]], [[0, 2], [3, 3]], [[1, 5], [2, 2]], [[3, 0], [4, 3]], [[3, 4], [3, 2]], [[4, 1], [2, 3]]}], [{[0, 3], [0, 4], [2, 6], [3, 0], [4, 0], [6, 2], [6, 6]}, {[[0, 0], [3, 3]], [[0, 5], [2, 2]], [[1, 1], [4, 4]], [[2, 3], [5 , 3]], [[3, 2], [3, 5]], [[5, 0], [2, 2]]}], [{[0, 2], [0, 5], [0, 6], [1, 6], [2, 0], [3, 0], [4, 6], [5, 2], [6, 0], [6, 1], [6, 2]}, {[[0, 0], [2, 2]], [[0 , 3], [7, 2]], [[1, 2], [4, 4]], [[2, 1], [2, 6]], [[4, 0], [2, 2]], [[5, 5], [ 2, 2]]}], [{[0, 0], [0, 1], [0, 6], [1, 0], [1, 6], [4, 1], [4, 3], [4, 4], [5, 1]}, {[[0, 2], [6, 4]], [[1, 1], [3, 4]], [[2, 0], [5, 7]]}], [{[0, 3], [1, 3], [1, 5], [2, 0], [2, 1], [2, 2], [3, 2], [4, 2], [4, 6], [5, 2], [5, 6], [6, 0], [6, 1], [6, 2], [6, 6]}, {[[0, 0], [2, 3]], [[0, 4], [4, 3]], [[2, 3], [3, 3]], [[3, 0], [3, 2]], [[5, 3], [2, 3]]}], [{[0, 6], [1, 1], [1, 2], [4, 0], [4, 5], [5, 2], [5, 4], [5, 5], [6, 2]}, {[[0, 0], [4, 6]], [[1, 3], [6, 4]], [[2, 1], [3, 4]], [[5, 0], [2, 2]]}], [{[0, 3], [0, 4], [2, 6], [3, 6], [4, 0], [4, 5], [4, 6], [5, 0], [6, 0], [6, 1], [6, 4]}, {[[0, 0], [4, 3]], [[0, 5], [2, 2]], [ [1, 1], [5, 4]], [[2, 3], [2, 3]], [[4, 2], [3, 2]], [[5, 5], [2, 2]]}], [{[0, 0], [0, 6], [3, 3], [5, 1], [5, 5]}, {[[0, 1], [5, 5]], [[1, 0], [6, 7]], [[2, 2], [4, 3]]}], [{[0, 5], [0, 6], [3, 1], [4, 1], [4, 6], [5, 1], [5, 2], [5, 3] , [5, 4], [5, 6], [6, 6]}, {[[0, 0], [2, 2]], [[0, 2], [5, 3]], [[1, 3], [3, 4] ], [[2, 0], [5, 6]]}], [{[0, 5], [0, 6], [1, 1], [2, 5], [3, 5], [4, 0], [5, 0] , [6, 0], [6, 6]}, {[[0, 0], [4, 5]], [[1, 2], [5, 5]], [[2, 1], [5, 3]], [[4, 4], [3, 2]]}], [{[0, 3], [2, 6], [3, 1], [4, 1], [5, 1]}, {[[0, 0], [7, 3]], [[ 0, 4], [2, 3]], [[1, 1], [2, 3]], [[2, 4], [4, 2]], [[3, 3], [4, 4]]}], [{[0, 0 ], [0, 4], [0, 5], [0, 6], [3, 0], [3, 4], [4, 0], [4, 6], [5, 0], [5, 2], [5, 6], [6, 0], [6, 4], [6, 5], [6, 6]}, {[[0, 1], [4, 3]], [[1, 0], [2, 5]], [[1, 5], [3, 2]], [[4, 1], [3, 3]], [[4, 4], [2, 2]]}], [{[0, 0], [0, 3], [0, 4], [0 , 5], [0, 6], [1, 0], [2, 5], [3, 1], [3, 2], [3, 5], [4, 5], [5, 0], [5, 4], [ 5, 5], [6, 0]}, {[[0, 1], [2, 2]], [[1, 3], [6, 4]], [[2, 0], [3, 5]], [[5, 1], [2, 2]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [2 , 5], [3, 5], [5, 1], [6, 3], [6, 4]}, {[[1, 1], [4, 6]], [[2, 0], [5, 3]], [[2 , 3], [4, 2]], [[5, 5], [2, 2]]}], [{[0, 0], [1, 0], [3, 3], [3, 6], [4, 0], [4 , 4], [5, 0], [5, 4], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]}, {[[0, 1], [2, 2]], [[0, 3], [3, 4]], [[1, 4], [3, 2]], [[2, 0], [2, 3]], [[4, 1 ], [2, 3]], [[4, 5], [2, 2]]}], [{[0, 0], [0, 1], [0, 5], [0, 6], [1, 0], [1, 6 ], [2, 0], [2, 6], [3, 0], [3, 6], [4, 0], [4, 1], [4, 4], [4, 5], [4, 6], [5, 6], [6, 2], [6, 3], [6, 6]}, {[[0, 2], [3, 3]], [[1, 1], [3, 5]], [[4, 2], [2, 2]], [[5, 0], [2, 2]], [[5, 4], [2, 2]]}], [{[1, 3], [2, 6], [5, 0], [6, 0], [6 , 1], [6, 5], [6, 6]}, {[[0, 0], [2, 2]], [[0, 2], [7, 3]], [[0, 5], [2, 2]], [ [2, 0], [3, 6]], [[3, 1], [3, 6]]}], [{[0, 0], [0, 3], [0, 4], [1, 0], [2, 0], [4, 5], [5, 3], [5, 4], [5, 5], [6, 0], [6, 1]}, {[[0, 1], [3, 2]], [[0, 5], [3 , 2]], [[1, 3], [4, 2]], [[3, 0], [3, 2]], [[3, 2], [4, 5]]}]]: end: DB88:=proc(): [[{[0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [1, 7], [3, 1], [5, 5], [5, 6], [5, 7], [7, 0], [7, 1], [7, 4]}, {[[0, 0], [2, 2]], [[1, 2], [7, 2]], [[1, 4], [3, 3]], [[2, 0], [3, 8]], [[5, 0], [2, 5]], [[6, 5], [2, 3]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 7], [2, 1], [3, 6], [5, 0], [6, 3], [6, 5], [7, 5]}, {[[0, 5], [3, 2]], [[1, 0], [4, 8]], [[2, 2], [6, 3]], [[3, 1], [3, 5] ], [[5, 6], [3, 2]], [[6, 0], [2, 2]]}], [{[1, 1], [1, 2], [1, 6], [4, 0], [4, 2], [4, 4], [4, 7], [5, 0], [5, 7], [7, 3], [7, 4], [7, 5]}, {[[0, 0], [4, 8]], [[1, 3], [6, 3]], [[2, 1], [4, 6]], [[6, 0], [2, 3]], [[6, 6], [2, 2]]}], [{[0, 0], [0, 1], [0, 4], [0, 5], [0, 6], [0, 7], [1, 7], [2, 1], [3, 1], [4, 4], [4, 5], [4, 7], [5, 7], [6, 0], [6, 2], [6, 4], [6, 7], [7, 0], [7, 4], [7, 7]}, {[ [0, 2], [4, 2]], [[1, 0], [5, 7]], [[2, 4], [2, 4]], [[4, 1], [4, 3]], [[6, 5], [2, 2]]}], [{[0, 7], [1, 3], [2, 0], [2, 1], [4, 1], [6, 3], [7, 6], [7, 7]}, { [[0, 0], [2, 2]], [[0, 2], [3, 5]], [[1, 4], [6, 4]], [[3, 0], [3, 7]], [[4, 2] , [4, 4]], [[6, 0], [2, 2]]}], [{[0, 0], [0, 7], [1, 3], [1, 4], [1, 5], [1, 7] , [3, 0], [4, 0], [5, 0], [5, 7], [6, 3], [6, 4]}, {[[0, 1], [6, 6]], [[1, 0], [2, 3]], [[2, 3], [3, 5]], [[3, 2], [5, 4]], [[6, 0], [2, 2]], [[6, 6], [2, 2]] }], [{[1, 5], [1, 6], [2, 0], [2, 6], [3, 0], [4, 4], [4, 6], [4, 7], [5, 2], [ 6, 6]}, {[[0, 0], [2, 2]], [[0, 2], [4, 2]], [[0, 4], [4, 4]], [[2, 1], [5, 5]] , [[4, 0], [4, 4]], [[5, 4], [3, 4]]}], [{[0, 3], [0, 4], [0, 7], [1, 3], [2, 0 ], [2, 3], [3, 0], [3, 3], [4, 0], [4, 6], [5, 0], [6, 0], [7, 0], [7, 1], [7, 4], [7, 5]}, {[[0, 0], [2, 3]], [[0, 5], [4, 2]], [[1, 4], [5, 4]], [[2, 1], [2 , 2]], [[4, 1], [3, 5]], [[5, 2], [3, 2]], [[6, 6], [2, 2]]}], [{[0, 0], [0, 3] , [0, 7], [3, 4], [4, 1], [4, 2], [4, 4], [6, 5], [7, 4], [7, 5]}, {[[0, 1], [4 , 2]], [[0, 4], [3, 3]], [[1, 0], [7, 4]], [[1, 5], [3, 3]], [[4, 5], [2, 3]], [[5, 1], [2, 4]], [[6, 6], [2, 2]]}], [{[0, 2], [0, 3], [0, 4], [3, 0], [5, 2], [5, 5], [7, 0], [7, 7]}, {[[0, 0], [3, 2]], [[0, 5], [4, 3]], [[1, 2], [2, 2]], [[1, 4], [7, 3]], [[3, 1], [5, 3]], [[4, 0], [3, 8]]}], [{[1, 3], [1, 4], [1, 5 ], [1, 6], [2, 0], [2, 1], [2, 6], [3, 0], [4, 0], [5, 7], [6, 3], [6, 4], [6, 5], [6, 7], [7, 0], [7, 7]}, {[[0, 0], [2, 2]], [[0, 2], [5, 6]], [[2, 3], [4, 3]], [[3, 1], [5, 6]], [[5, 0], [2, 3]]}], [{[0, 0], [0, 4], [0, 5], [0, 6], [0 , 7], [1, 0], [1, 7], [2, 0], [2, 4], [3, 0], [3, 4], [4, 5], [4, 7], [5, 1], [ 5, 7], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4]}, {[[0, 1], [4, 3]], [[1, 2], [5, 5]], [[2, 5], [2, 3]], [[4, 0], [3, 5]], [[6, 5], [2, 3]]}], [{[0, 0], [1, 4], [1, 5], [1, 6], [2, 6], [3, 0], [4, 0], [4, 7], [5, 3], [5, 7], [6, 7], [7, 3], [7, 4], [7, 5], [7, 6], [7, 7]}, {[[0, 1], [4, 7]], [[1, 0], [2, 4]], [[2, 4], [4, 2]], [[4, 1], [3, 6]], [[5, 0], [3, 3]]}], [{[0, 0], [0, 1], [0, 7], [1, 0] , [2, 0], [2, 3], [3, 5], [3, 6], [5, 0], [5, 3], [6, 0], [7, 0], [7, 1], [7, 5 ], [7, 6], [7, 7]}, {[[0, 2], [8, 3]], [[0, 5], [3, 2]], [[1, 1], [6, 7]], [[3, 0], [2, 4]], [[4, 5], [2, 2]]}], [{[0, 0], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [3, 4], [3, 5], [4, 0], [4, 7], [5, 7], [6, 4], [6, 7], [7, 3], [7, 4], [7, 7]}, {[[0, 1], [3, 2]], [[1, 0], [3, 4]], [[1, 4], [2, 2]], [[1, 6], [3, 2]], [ [4, 1], [3, 3]], [[4, 4], [2, 3]], [[5, 0], [3, 3]], [[6, 5], [2, 2]]}], [{[0, 0], [0, 3], [0, 4], [0, 5], [0, 6], [0, 7], [1, 0], [1, 3], [1, 7], [2, 0], [3, 0], [3, 1], [5, 6], [6, 2], [6, 4], [6, 5], [6, 6], [7, 0], [7, 1], [7, 2]}, {[ [0, 1], [3, 2]], [[1, 4], [4, 3]], [[2, 3], [6, 5]], [[3, 2], [3, 4]], [[4, 0], [3, 2]]}], [{[0, 0], [0, 6], [0, 7], [1, 0], [1, 2], [1, 3], [1, 4], [4, 3], [4 , 6], [5, 6], [6, 1], [7, 5], [7, 6], [7, 7]}, {[[0, 1], [6, 5]], [[1, 6], [2, 2]], [[2, 0], [6, 5]], [[3, 2], [4, 6]]}], [{[0, 0], [0, 6], [0, 7], [1, 0], [1 , 2], [1, 3], [1, 4], [3, 7], [4, 7], [5, 1], [5, 3], [7, 0], [7, 1], [7, 7]}, {[[0, 1], [5, 5]], [[1, 6], [2, 2]], [[2, 0], [5, 5]], [[3, 2], [5, 5]], [[5, 5 ], [2, 3]]}], [{[0, 7], [1, 7], [2, 0], [5, 0], [6, 0], [6, 2], [6, 6], [7, 0]} , {[[0, 0], [2, 2]], [[0, 2], [6, 5]], [[1, 3], [6, 3]], [[2, 1], [6, 7]], [[3, 0], [2, 5]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [0, 7], [1, 0], [1, 3], [2, 0] , [2, 3], [3, 0], [3, 1], [4, 6], [6, 4], [7, 4]}, {[[0, 4], [4, 3]], [[1, 1], [2, 2]], [[1, 5], [5, 3]], [[3, 2], [5, 2]], [[4, 0], [2, 5]], [[6, 0], [2, 2]] , [[6, 5], [2, 3]]}], [{[0, 0], [0, 4], [0, 5], [1, 0], [3, 7], [4, 7], [5, 4], [5, 7], [6, 0], [6, 7], [7, 0], [7, 1], [7, 6], [7, 7]}, {[[0, 1], [2, 3]], [[0 , 6], [3, 2]], [[1, 4], [2, 2]], [[2, 0], [4, 4]], [[3, 1], [4, 6]], [[4, 2], [ 4, 4]]}], [{[0, 7], [2, 4], [2, 5], [3, 0], [4, 0], [5, 0], [5, 1], [6, 0], [6, 4], [6, 5], [6, 6], [7, 0]}, {[[0, 0], [3, 2]], [[0, 2], [6, 5]], [[1, 3], [7, 5]], [[3, 1], [2, 5]], [[6, 1], [2, 2]]}], [{[1, 1], [1, 2], [1, 3], [2, 5], [4 , 7], [5, 4], [5, 5], [5, 6], [5, 7], [6, 1], [6, 3], [6, 7], [7, 3], [7, 7]}, {[[0, 0], [4, 8]], [[1, 4], [4, 3]], [[2, 1], [4, 3]], [[4, 0], [4, 3]], [[6, 4 ], [2, 3]]}], [{[0, 0], [0, 7], [1, 0], [4, 2], [4, 7], [5, 5], [6, 0], [6, 5], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5]}, {[[0, 1], [7, 4]], [[0, 5], [5 , 2]], [[1, 2], [3, 6]], [[2, 0], [4, 4]], [[5, 6], [3, 2]]}], [{[0, 6], [0, 7] , [1, 1], [3, 0], [3, 7], [4, 5], [4, 7], [5, 7], [7, 0], [7, 1]}, {[[0, 0], [3 , 6]], [[1, 2], [7, 3]], [[1, 6], [2, 2]], [[3, 1], [3, 6]], [[4, 0], [3, 4]], [[6, 5], [2, 3]]}], [{[1, 3], [2, 3], [2, 5], [2, 6], [2, 7], [3, 7], [4, 1], [ 5, 4], [6, 4], [6, 5], [6, 7], [7, 7]}, {[[0, 0], [3, 2]], [[0, 2], [5, 3]], [[ 0, 5], [2, 3]], [[3, 0], [5, 7]], [[4, 5], [2, 3]], [[5, 1], [2, 3]]}], [{[0, 0 ], [0, 1], [0, 7], [1, 3], [1, 4], [1, 5], [1, 7], [3, 0], [3, 5], [4, 0], [4, 5], [5, 4], [5, 5], [7, 2]}, {[[0, 2], [7, 5]], [[1, 0], [2, 2]], [[2, 3], [6, 5]], [[3, 1], [2, 4]], [[5, 0], [3, 2]]}], [{[0, 6], [0, 7], [1, 1], [1, 4], [3 , 0], [4, 0], [4, 5], [4, 6], [5, 0], [7, 2], [7, 3], [7, 4]}, {[[0, 0], [3, 3] ], [[0, 3], [3, 3]], [[1, 6], [2, 2]], [[3, 1], [3, 7]], [[4, 2], [3, 3]], [[6, 0], [2, 2]], [[6, 5], [2, 3]]}], [{[0, 0], [0, 1], [0, 2], [0, 7], [2, 1], [2, 5], [5, 0], [5, 7], [6, 0], [6, 4], [6, 5], [6, 7], [7, 0], [7, 7]}, {[[0, 3], [8, 4]], [[1, 0], [4, 3]], [[1, 4], [4, 4]], [[3, 1], [3, 5]], [[6, 1], [2, 2]] }], [{[0, 0], [0, 1], [1, 0], [1, 5], [1, 6], [2, 6], [4, 2], [4, 7], [5, 7], [ 6, 7], [7, 0], [7, 1], [7, 2], [7, 7]}, {[[0, 2], [4, 6]], [[1, 1], [5, 4]], [[ 2, 0], [5, 6]], [[4, 3], [4, 4]]}], [{[0, 7], [2, 2], [3, 2], [4, 2], [6, 0], [ 6, 2], [6, 6], [7, 0]}, {[[0, 0], [6, 7]], [[1, 1], [7, 7]], [[2, 3], [2, 3]], [[4, 3], [3, 3]]}], [{[1, 1], [2, 1], [5, 1], [5, 6], [6, 1], [6, 2], [7, 6], [ 7, 7]}, {[[0, 0], [8, 6]], [[0, 6], [2, 2]], [[1, 2], [5, 3]], [[2, 3], [5, 5]] , [[3, 1], [2, 6]]}], [{[0, 0], [0, 1], [0, 4], [0, 5], [0, 6], [0, 7], [2, 1], [3, 1], [3, 2], [3, 3], [4, 3], [6, 0], [6, 3], [6, 5], [6, 7], [7, 0], [7, 3], [7, 7]}, {[[0, 2], [3, 2]], [[1, 0], [5, 8]], [[2, 4], [2, 3]], [[4, 1], [4, 2] ], [[4, 4], [4, 3]]}], [{[0, 0], [0, 4], [0, 7], [1, 4], [1, 7], [2, 4], [2, 5] , [2, 6], [2, 7], [3, 0], [3, 7], [4, 0], [4, 7], [5, 0], [6, 0], [6, 2], [6, 4 ], [6, 6], [7, 0], [7, 4]}, {[[0, 1], [8, 3]], [[0, 5], [2, 2]], [[1, 0], [2, 3 ]], [[3, 2], [3, 3]], [[3, 5], [2, 2]], [[5, 5], [3, 3]]}], [{[0, 7], [1, 1], [ 1, 2], [1, 3], [1, 7], [2, 1], [2, 5], [3, 1], [3, 5], [4, 7], [6, 1], [6, 2], [6, 3], [6, 4]}, {[[0, 0], [5, 5]], [[0, 5], [2, 2]], [[2, 2], [2, 2]], [[2, 6] , [2, 2]], [[4, 5], [3, 2]], [[5, 0], [3, 8]]}], [{[0, 0], [0, 4], [1, 0], [1, 6], [5, 2], [7, 0]}, {[[0, 1], [8, 3]], [[0, 5], [5, 3]], [[1, 2], [4, 3]], [[2 , 0], [5, 7]], [[5, 4], [3, 4]]}], [{[0, 4], [0, 5], [0, 6], [0, 7], [2, 2], [5 , 4], [5, 6], [6, 0], [7, 0], [7, 1], [7, 6], [7, 7]}, {[[0, 0], [6, 4]], [[1, 1], [6, 7]], [[2, 4], [3, 3]], [[3, 2], [5, 4]]}], [{[0, 0], [0, 1], [0, 2], [0 , 3], [0, 6], [0, 7], [1, 2], [4, 0], [4, 1], [6, 2], [6, 4], [6, 5], [6, 6], [ 7, 2]}, {[[0, 4], [5, 2]], [[1, 0], [3, 2]], [[1, 3], [7, 5]], [[2, 2], [4, 5]] , [[5, 0], [3, 2]]}], [{[0, 2], [0, 3], [0, 4], [0, 5], [3, 0], [3, 1], [3, 4], [3, 6], [4, 0], [4, 6], [5, 0], [5, 6], [7, 6], [7, 7]}, {[[0, 0], [3, 2]], [[0 , 6], [2, 2]], [[1, 2], [7, 4]], [[2, 3], [5, 5]], [[4, 1], [2, 4]], [[6, 0], [ 2, 2]]}], [{[0, 4], [1, 6], [2, 6], [3, 0], [4, 3], [4, 4], [5, 6], [6, 3], [7, 0], [7, 5], [7, 6], [7, 7]}, {[[0, 0], [3, 4]], [[0, 5], [4, 3]], [[1, 1], [3, 4]], [[4, 0], [3, 3]], [[4, 5], [3, 3]], [[5, 1], [3, 4]]}], [{[0, 0], [0, 1], [0, 7], [1, 0], [1, 7], [2, 0], [3, 6], [4, 6], [5, 1], [6, 7], [7, 0], [7, 1], [7, 4], [7, 7]}, {[[0, 2], [3, 3]], [[0, 5], [2, 2]], [[1, 1], [4, 3]], [[2, 5] , [4, 3]], [[3, 0], [4, 5]], [[5, 2], [3, 2]], [[6, 5], [2, 2]]}], [{[0, 3], [0 , 6], [0, 7], [1, 1], [2, 6], [3, 0], [3, 1], [3, 5], [3, 6], [4, 0], [4, 6], [ 5, 0], [5, 6], [6, 0], [6, 2], [7, 0], [7, 6], [7, 7]}, {[[0, 0], [3, 3]], [[0, 4], [3, 2]], [[1, 3], [6, 5]], [[3, 2], [3, 3]], [[4, 1], [4, 5]]}], [{[0, 0], [0, 7], [1, 0], [1, 2], [1, 5], [1, 7], [3, 2], [3, 5], [6, 3], [6, 4]}, {[[0, 1], [5, 6]], [[1, 3], [5, 2]], [[2, 0], [6, 8]], [[5, 1], [2, 2]], [[5, 5], [2, 2]]}], [{[0, 0], [0, 1], [0, 2], [0, 3], [0, 7], [1, 7], [2, 7], [3, 7], [4, 0] , [5, 0], [6, 0], [6, 2], [6, 3], [6, 5], [7, 0], [7, 5], [7, 6], [7, 7]}, {[[0 , 4], [2, 3]], [[1, 0], [3, 4]], [[2, 1], [6, 4]], [[2, 5], [2, 2]], [[4, 2], [ 2, 4]], [[4, 6], [3, 2]]}], [{[0, 2], [0, 7], [1, 5], [1, 7], [2, 0], [2, 7], [ 3, 0], [3, 7], [4, 0], [4, 7], [6, 1], [7, 7]}, {[[0, 0], [2, 2]], [[0, 3], [8, 4]], [[1, 2], [3, 3]], [[2, 1], [3, 5]], [[5, 0], [3, 3]], [[5, 4], [2, 4]]}], [{[0, 7], [1, 3], [1, 4], [1, 5], [1, 7], [2, 0], [2, 1], [2, 7], [3, 0], [3, 3 ], [3, 7], [4, 7], [5, 6], [5, 7], [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5]}, {[[0, 0], [2, 2]], [[0, 2], [3, 5]], [[3, 1], [3, 2]], [[3, 4], [2, 3]], [ [4, 0], [3, 4]], [[5, 4], [2, 2]], [[6, 6], [2, 2]]}], [{[0, 0], [0, 3], [0, 7] , [1, 0], [1, 3], [1, 7], [2, 3], [2, 4], [2, 5], [3, 1], [3, 3], [5, 4], [6, 4 ], [6, 6], [7, 0], [7, 4]}, {[[0, 1], [2, 2]], [[0, 4], [2, 3]], [[2, 0], [5, 3 ]], [[2, 6], [3, 2]], [[3, 4], [2, 2]], [[4, 1], [4, 3]], [[5, 5], [3, 3]]}], [ {[0, 0], [0, 4], [0, 5], [0, 6], [0, 7], [4, 1], [5, 3], [6, 3], [6, 7], [7, 7] }, {[[0, 1], [4, 3]], [[1, 0], [7, 5]], [[1, 5], [5, 3]], [[2, 2], [3, 5]], [[5 , 1], [2, 2]], [[6, 5], [2, 2]]}], [{[1, 3], [1, 6], [2, 0], [2, 6], [3, 0], [3 , 6], [4, 0], [4, 1], [5, 4], [5, 5], [7, 0], [7, 1], [7, 2], [7, 7]}, {[[0, 0] , [2, 2]], [[0, 2], [7, 6]], [[1, 4], [3, 2]], [[2, 1], [2, 3]], [[4, 3], [4, 4 ]], [[5, 0], [2, 2]]}], [{[0, 0], [0, 4], [0, 5], [1, 0], [1, 2], [3, 2], [3, 6 ], [5, 0], [5, 4], [5, 7], [6, 0], [6, 4], [6, 7], [7, 0], [7, 4], [7, 7]}, {[[ 0, 1], [6, 3]], [[0, 6], [2, 2]], [[1, 4], [3, 2]], [[2, 0], [3, 8]], [[5, 5], [3, 2]], [[6, 1], [2, 3]]}]]: end: NYT:=proc(): [{[5,1],[6,1],[5,2],[4,3],[5,3],[4,4],[1,5],[8,5],[3,6],[4,6],[6,6],[2,7],[3,7],[9,9]}, {[1,1],[6,1],[7,1],[8,1],[1,2],[8,2],[1,3],[1,4],[2,4],[3,5],[4,5],[5,5],[3,6],[6,6],[6,7],[6,8],[7,8],[8,8]}, {[3,0],[8,1],[0,2],[8,2],[5,3],[7,4],[0,5],[3,5],[6,5],[7,5],[2,6],[3,6],[6,6],[2,7],[4,8],[9,9]}, {[2,0],[3,0],[6,0],[9,2],[1,3],[3,4],[6,4],[0,6],[3,6],[6,6],[1,8],[4,8],[7,8],[8,8]}, {[0,0],[1,0],[2,0],[4,2],[5,2],[4,4], [4,5],[6,5],[7,5],[1,6],[2,6],[7,6],[0,8], [7,8],[8,8],[0,9],[3,9],[4,9]}, {[0,0],[1,0],[4,0],[8,1],[1,2],[5,2],[6,2],[8,2],[5,3],[6,3],[2,4],[3,4],[6,4],[7,4], [2,5],[3,5],[0,6],[3,6],[4,6],[3,8], [5,8],[5,9]}, {[6,0],[1,1],[2,1],[6,1],[8,1],[8,2],[2,3],[4,3],[5,3],[8,3],[4,5],[5,5],[0,6],[4,7],[5,7],[7,7],[4,9],[5,9]}, {[4,2],[4,3],[5,4],[5,5],[0,6],[2,6],[3,7],[6,7],[3,9],[6,9]}, {[3,0],[6,0],[1,3],[3,3],[4,3],[5,3],[6,3],[3,4],[6,4],[9,4],[3,6],[6,6],[4,7],[5,7],[1,8],[4,9],[5,9],[9,9]}, {[0,0],[0,1],[6,1],[9,2],[3,3],[4,3],[3,4],[4,4],[9,6],[0,7],[8,7],[9,7],[0,8],[1,8],[6,8],[0,9],[1,9],[2,9],[5,9],[6,9]} ]: end: #End pre-computed puzzles and solutions #Rec(a,b): The rectangle [0,a-1]x[0,b-1] Rec:=proc(a,b) local i,j: {seq(seq([i,j],i=0..a-1),j=0..b-1)}: end: #CP(S): given a set of lattice points, S, finds the point [i,j] such that i is as small as possible and for that i, j is as small as possible . try: #CP({[0,0],[1,0],[2,0],[2,2],[-2,-5]}); CP:=proc(S) local j0,i0,s,Sb: i0:=min(seq(s[1],s in S)): Sb:={}: for s in S do if s[1]=i0 then Sb:=Sb union {s}: fi: od: j0:=min(seq(s[2], s in Sb)): [i0,j0]: end: #PeriV(pt,a,b): The set of vertices in perimeter of an a by b rectangle whose bottom left vertex is the lattice point pt. In other words [0,a-1]x[0,b-1]+pt #Try: #PeriV([2,3],[3,2]): PeriV:=proc(pt,a,b) local i,j: {seq(pt+[i,0],i=0..a-1),seq(pt+[a-1,j],j=0..b-1),seq(pt+[i,b-1],i=0..a-1),seq(pt+[0,j],j=0..b-1)} end: #PeriE(pt,a,b): The set of edges in perimeter of an a by b rectangle whose bottom left vertex is the lattice point pt. In other words [0,a-1]x[0,b-1]+pt #Try: #PeriE([2,3],3,2): PeriE:=proc(pt,a,b) local i,j: {seq({pt+[i,0],pt+[i+1,0]},i=0..a-2),seq({pt+[a-1,j],pt+[a-1,j+1]}, j=0..b-2),seq({pt+[i,b-1],pt+[i-1,b-1]},i=1..a-1),seq({pt+[0,j],pt+[0,j-1]},j=1..b-1)} end: #IniReg(a,b,S): inputs positive integers a and b and a subset of lattice points S, outputs the set of all #sets of rectangles that solve the Ring Ring puzzle where the region to be covered is #the rectanle [0,a-1]x[0,b-1] minus the set S. For example, for the puzzle of New Times magazine (created by Prassana Seshadri) Sunday, June 20, 2021, type: #IniReg(8,8,{[7,0],[3,1],[4,1],[0,2],[7,4],[5,5],[1,6],[2,6]}); IniReg:=proc(a,b,S): Rec(a,b) minus S: end: #KidS(St): Inputs a state St=[NeverUsed,UsedOnce,ForbiddenEdges] outputs the set of pairs [R,St1] obtained by inserting legally a rectangle, R, that is a subset of NeverUsed union UsedOnce #followed by the new state where the vertices of R intersect NeverUsed get moved to UsedOnce, the vertices of $ intersect UsedOnce are removed, and the new edges of Rec are joined to #ForbiddenEdges. Try: #Kids([IniReg(8,8,{[7,0],[3,1],[4,1],[0,2],[7,4],[5,5],[1,6],[2,6]}),{},{}]); Kids:=proc(St) local NeverUsed,UsedOnce,FE, NeverUsed1,UsedOnce1,FE1,gu,pt,Useable,mX,mY,pt1,a1,b1,NewV,NewE: NeverUsed:=St[1]: if NeverUsed={} then RETURN({{}}): fi: UsedOnce:=St[2]: FE:=St[3]: pt:=CP(NeverUsed): Useable:=St[1] union St[2]: mX:=max(seq(pt1[1]-pt[1],pt1 in Useable))+1: mY:=max(seq(pt1[2]-pt[2],pt1 in Useable))+1: gu:={}: for a1 from 2 to mX do for b1 from 2 to mY do NewV:=PeriV(pt,a1,b1): NewE:=PeriE(pt,a1,b1): if NewV minus (NeverUsed union UsedOnce)={} and NewE intersect FE={} then NeverUsed1:=NeverUsed minus NewV: UsedOnce1:=UsedOnce minus (NewV intersect UsedOnce) union (NewV intersect NeverUsed): FE1:=FE union NewE: gu:=gu union { [[pt,[a1,b1]], [NeverUsed1,UsedOnce1,FE1]]}: fi: od: od: gu: end: #RecCov(St): The set of coverings of St[1] that obey the rules and avoid Forbidden Edges RecCov:=proc(St) local mu,mu1,gu,gu1,gu11: option remember: if St[1]={} then RETURN({{}}): fi: mu:=Kids(St): gu:={}: for mu1 in mu do gu1:=RecCov(mu1[2]): gu:=gu union { seq({mu1[1]} union gu11,gu11 in gu1)}: od: gu: end: #Pinot(R): The four cornvers of the rectangle R=[pt,[a,b]] Pinot:=proc(R) local pt,a,b: pt:=R[1]: a:=R[2][1]: b:=R[2][2]: {pt,pt+[a-1,0],pt+[0,b-1],pt+[a-1,b-1]}: end: #IsGoodPinot(SOL): are there no overlapping cornners? IsGoodPinot:=proc(SOL) local i: evalb(nops({seq(op(Pinot(SOL[i])),i=1..nops(SOL))})=4*nops(SOL)): end: #RingRing(a,b,S): inputs a Ring Ring puzzle in the rectangle [0,a-1]x[0,b-1] with the lattice points of S deleted, outputs the set of solutions to a Ring Ring puzzle. Try: #RingRing(8,8,{[7,0],[3,1],[4,1],[0,2],[7,4],[5,5],[1,6],[2,6]}); RingRing:=proc(a,b,S) local SOL,i,gu: SOL:=RecCov([IniReg(a,b,S),{},{}]): gu:={}: for i from 1 to nops(SOL) do if IsGoodPinot(SOL[i]) then gu:=gu union {SOL[i]}: fi: od: gu: end: PlotPuz:=proc(a,b,S) local i,j,s,T,p,pt: T:=IniReg(a,b,S): p:=plot([[0,0],[a,0],[a,b],[0,b],[0,0]],thickness=3,axes=none): for i from 1 to b-1 do p:=p,plot([[0,i],[a,i]]): od: for j from 1 to a-1 do p:=p,plot([[j,0],[j,b]]): od: for s in S do p:=p,plot([s,s+[1,0],s+[1,1],s+[0,1],s], filled=true, color=black): od: display(p): end: PlotSol:=proc(a,b,P,SOL) local i,j,s,T,p,pt,re,a1,b1: T:=IniReg(a,b,P): p:=plot([[0,0],[a,0],[a,b],[0,b],[0,0]],thickness=3,axes=none): for i from 1 to b-1 do p:=p,plot([[0,i],[a,i]]): od: for j from 1 to a-1 do p:=p,plot([[j,0],[j,b]]): od: for s in P do p:=p,plot([s,s+[1,0],s+[1,1],s+[0,1],s], filled=true, color=black): od: for re in SOL do pt:=re[1]+[1/2,1/2]: a1:=re[2][1]-1: b1:=re[2][2]-1: p:=p,plot([pt,pt+[a1,0],pt+[a1,b1],pt+[0,b1],pt],thickness=3,color=blue): od: display(p): end: #FindNewRecs(a,b,S,FE): given positive integers a and b, a set of already occupied lattice points S #and a set of already-used edges, FE #outputs the set all legal new rectangles followed by the new occupied set, and the new set of used edges #FindNewRecs(4,4,{},{}); FindNewRecs:=proc(a,b,S,FE) local a1,b1,Av,gu,pt: Av:=Rec(a,b) minus S: gu:={}: for pt in Av do for a1 from 2 to a-pt[1] do for b1 from 2 to b-pt[2] do if {pt,pt+[a1-1,0],pt+[0,b1-1],pt+[a1-1,b1-1]} intersect S={} and PeriE(pt,a1,b1) intersect FE={} then gu:=gu union {[[pt,[a1,b1]], S union PeriV(pt,a1,b1), FE union PeriE(pt,a1,b1) ] } : fi: od: od: od: gu: end: #MakePuzSol1(a,b): Makes a random puzzle and its solution for an a by b rectangle if there is no unique solution or or takes more than 2 seconds, it returns FAIL. try: #MakePuzSol1(6,6); MakePuzSol1:=proc(a,b) local gu,S,lu,rec,FE,P,SOL,t0: t0:=time(): gu:={}: S:={}: FE:={}: lu:=FindNewRecs(a,b,S,FE): while nops(S){} and time()-t0 < 0.5 do lu:=FindNewRecs(a,b,S,FE): #print(`nops(lu) is`, nops(lu)): if lu<>{} then rec:=lu[rand(1..nops(lu))()]: gu:=gu union {rec[1]}: S:=rec[2]: FE:=rec[3]: #print(`Right now it loos like`): #print(PlotSol(a,b,Rec(a,b) minus S, gu)): else P:=Rec(a,b) minus S: SOL:=RingRing(a,b,P): if not member(gu,SOL) then print(`Something bad happened`): fi: if nops(SOL)<>1 then RETURN(FAIL): else RETURN(Rec(a,b) minus S,gu): fi: fi: od: FAIL: end: #MakePuzSol(a,b,K): Makes a puzzle and its solution for an a by b rectangle by trying random puzzles K times MakePuzSol:=proc(a,b,K) local gu,i: for i from 1 to K do gu:=MakePuzSol1(a,b): if gu<>FAIL then RETURN(gu): fi: od: FAIL: end: #MakePuzBook(a,b,K,M): Creates a list of M RingRing puzzles along with their solution for an a by b rectangle by calling MakePuzSol(a,b,K) M times. Try: #MakePuzBook(6,6,100,10); MakePuzBook:=proc(a,b,K,M) local gu,i,lu: gu:=[]: while nops(gu)FAIL and not member(lu,{op(gu)}) then gu:=[op(gu),lu]: fi: od: gu: end: