image thumbnail
from Geo Magic Squares by Krishna Lalith
Identify 20 Geo Magic Squares with 4-Hexaminos.

Draw_GMS(handy,varargin)
function Draw_GMS(handy,varargin)

global hand Counter Links Soln_Links summe slink compli Dbase;

mm=varargin{2};
if isempty(find(Links==mm)),
    Counter=Counter+1;
    Links(Counter)=mm;
	set(hand(mm),'enable','off');
end

if Counter==4,
    tmp=find(summe==sum(Links));
    if sum(Links)==34,
        if ~isempty(find(Links==1)),
            tmp=1;
        else
            tmp=6;
        end
    end
    vec=ones(1,4);
    if ~isempty(tmp), vec=Soln_Links(tmp,:)-sort(Links); end
    if sum(vec.*vec)==0,
        set(slink(tmp),'visible','on');
        set(slink(compli(tmp)),'visible','on');
        Dbase=Dbase+1;
    else
        msg={'Selected Combination Doesn''t exists...'};     
        msg_handle=msgbox(msg,'Oops!!!','help');
        pause(2);  close(msg_handle);
    end
    Counter=0;
    for ii=1:4,
        set(hand(Links(ii)),'enable','on');
    end
    Links=[];
end

if Dbase==10,
    [namastedata namastemap]=imread('namaste.jpg');
    msg={'You have cracked the Puzzle!!!'};
    hd=msgbox(msg,'Congrats!','custom',namastedata,namastemap);        
    pause(2);  close(hd);
end

Contact us