From u640486@csi.UOttawa.CA Mon Feb 5 21:11 EST 1996 Return-Path: Received: from sma.usna.navy.MIL (math3) by math65.usna.navy.MIL (5.x/SMI-SVR4) id AA02115; Mon, 5 Feb 1996 21:11:07 -0500 Received: from mail.csi.UOttawa.CA by sma.usna.navy.MIL (4.1/SMI-4.1) id AA03947; Mon, 5 Feb 96 21:07:30 EST Received: from csia.csi.uottawa.ca (csia.csi.uottawa.ca [137.122.16.2]) by mail.csi.UOttawa.CA (8.6.9/8.6.9) with SMTP id VAA02232 for ; Mon, 5 Feb 1996 21:07:12 -0500 Received: by csia.csi.uottawa.ca (4.1/8.6.9) id AA14609 for wdj@math65.sma.usna.navy.MIL; Mon, 5 Feb 96 21:07:12 EST From: Istvan Message-Id: <9602060207.AA14609@csia.csi.uottawa.ca> Subject: Re: cube.g To: wdj@math65.sma.usna.navy.MIL (W. David Joyner) Date: Mon, 5 Feb 96 21:07:11 EST In-Reply-To: <9602051942.AA02062@math65.usna.navy.MIL>; from "W. David Joyner" at Feb 5, 96 2:42 pm X-Mailer: ELM [version 2.3 PL11] Content-Type: text Content-Length: 5570 X-Lines: 176 Status: RO David, > > gap> c1:=CubeList(cubelist,(2,5)(34,26),cube); > You must realize that (2,5)(34,26) is not in the cube! gap>(2,5)(34,26) in cube; false gap> Actually it is interesting. It is a property of the Rubik's Cube that any single-pair edge piece swaps are not in the group, while any two pairs of edge piece swaps are in the cube. example: gap>(2,5)(26,34)(23,21)(42,28) in cube; true gap> Well 48! is not equal to the size of "cube" so not every permutation is permitted. But this was not the problem. The way I wrote cube.g is not suitable for what you were about to do. I wrote a few functions which will facilitate your queries (at least I hope this is what you are intended to do, and I did not misunderstand). Attach the following three functions to the end of your cube2.g SolveAndDisplayFromElement(g,solved,element,iterationdepth) takes the group "g" (cube), "element" as a permutation cycle and iterationdepth which is an upper limit on the number of shrinkages on the first path found. "solved" is [1..48] , that is all the elements in order (the 48 moved points). eg: Element := (2,5)(26,34)(23,21)(42,28); SolveAndDisplayFromElement(cube,[1..48],Element,5); will bring the cube into "Element", ie the two pairs of edge pieces swapped. Then it generates a path that will solve the cube from "Element" and displays it right on the screen (ie, every operation). It will shrink a maximum of 5 times. If it figures that let's say after the 3rd it cannot improve on the path, it will stop right their. You can paste the three functions at the end of cube2.g or you can save it in a different file (cubemisc.g) and load this file after you have loaded cube2.g. The following are the three functions: # # # Miscellaneous functions for cube.g # # # (c) Hernadvolgyi 1996 # # # # Solve for an element "element" of group "g" and return # a left-to-right ordered list of generators that would bring # "element" to the solved group # SolveFromElement := function(g,element,iterationdepth) # g is the group # element should be a perm-cycle # iterationdepth tells how many times the first path is to be shrunk local word, # word in generators counter, # for number of iterartions last, # the index of the last operation in List(word) list, # converted List(word) to a list of generators # it only means that the path in the generators # is represented in a right-to-left list in reversed order. # We have to convert it into left-to-right correct order # at the end Ok; # This boolean indicates that only iterate until # you can improve on the path, it is checked by the # length of the previous operation-list, if it is not any # shorter don't try to shrink it again if element in g # is "element" in the group "g" ? then word := FactorPermGroupElement(g,element); # call AbStab's function last := LengthWord(word); # record last index counter := 1; # set counter Ok := true; # set entry condition while counterx^element),LabelPrint); Print("\nSolution:\n"); OperationOnList(List(solved,x->x^(element^-1)),solved,operations,true,g); Print("it took ",Length(operations)," operations\n"); end; # DisplayPath # Display the solution operations which bring "element" to "solved" in # group "g" using "iterationdepth" as the upper limit of how many times # the first path should be shrunk # # It needs a display function, so "g" must be "cube" # solved is [1..48] ie, the points on the cube in the right order # "element" can be any element of "g" expressed as a perm-cycle # # exapmple: SolveAndDisplayFromElement(cube,[1..48],Random(cube.generators),3); # # or # # Element := (17,19)(11,8)(6,25)(7,28)(18,21); # # SolveAndDisplayFromElement(cube,[1..48],Element,5); # SolveAndDisplayFromElement := function(g,solved,element,iterationdepth) DisplayPath(g,solved,element,SolveFromElement(g,element,iterationdepth)); end; Let me know if this is what you wanted. -- - Istvan Istvan T. Hernadvolgyi | http://www.csi.uottawa.ca/~u640486 u640486@csi.uottawa.ca | (Canada) -( 613 ) - 749 - 5191