image thumbnail
from Mathworks Rubik by Stijn Helsen
Display, tester and solver of the Rubiks game, including "full cubes".

Cube=MakeFullCube(Cube) %MakeFullCube - Makes the cube "full" (mid cubes orientation dependent % Cube=MakeFullCube(Cube) Cube.bFullCube=true; for i=1:6 k=Cube.iExtraFaces(i,:); ccc=Cube.Color(Cube.iMidInd(k)); if Cube.Color(k(1),Cube.iMid(i)) if ~i
function Cube=MakeFullCube(Cube)
%MakeFullCube - Makes the cube "full" (mid cubes orientation dependent
%   Cube=MakeFullCube(Cube)
Cube.bFullCube=true;
for i=1:6
	k=Cube.iExtraFaces(i,:);
	ccc=Cube.Color(Cube.iMidInd(k));
	if Cube.Color(k(1),Cube.iMid(i))
		if ~isempty(setdiff(ccc,Cube.Color(k,Cube.iMid(i))))
			Cube.Color(k,Cube.iMid(i))=0;
		end
		%  (!!?check for the right order?!!)
	end
	if Cube.Color(k(1),Cube.iMid(i))==0
		Cube.Color(k,Cube.iMid(i))=ccc;
	end
end

Contact us at files@mathworks.com