image thumbnail

Mathworks Rubik version 2

by

 

04 Apr 2013 (Updated )

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

2*S(i,1)-1+(S(i,2)+1)/2; sol(i)=Cube.Color(j,Cube.RotLayerCube(j,5));
function sol=FRU2Color(S,Cube)
%FRU2Color - Convert FrontRightUp(and others) to Color space
%     sol=FRU2Color(S,Cube)
if isempty(S)
	sol=zeros(0,3);
	return
end
S(mod(S(:,3),4)==0,:)=[];
if isempty(S)
	sol=zeros(0,3);
	return
end
sol=zeros(size(S,1),2);
sol(:,2)=S(:,3);
for i=1:size(S,1)
	j = 2*S(i,1)-1+(S(i,2)+1)/2;
	sol(i)=Cube.Color(j,Cube.RotLayerCube(j,5));	% color of mid cube
end

Contact us