image thumbnail

Mathworks Rubik version 2

by

 

04 Apr 2013 (Updated )

Display, tester and solver of the Rubik's game, including "full cubes".

Cube=MakeFullCube(Cube)
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