⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendmory.pl

📁 PRl教学程序 PRl教学程序 PRl教学程序
💻 PL
字号:
/********************************************************************
    Constraint-based Graphical Programming in B-Prolog
    %
    solve the SEND+MORE=MONEY puzzle
*********************************************************************/
go:-
    Vars=[S,E,N,D,M,O,R,Y],
    Vars in 0..9,
    alldifferent(Vars),
    S#\=0,
    M#\=0,
    1000*S+100*E+10*N+D+1000*M+100*O+10*R+E#=10000*M+1000*O+100*N+10*E+Y,
    labeling(Vars),
    % show solution
    createLabels([(Ds,S),(De,E),(Dn,N),(Dd,D),
		  (Em,M),(Eo,O),(Er,R),(Ee,E),
		  (Ym,M),(Yo,O),(Yn,N),(Ye,E),(Yy,Y)]),

    % constraint
    cgLabel(Plus), Plus^text #= '+',
    cgRectangle(Rect),
    cgLine(Line), Line^y1 #= Line^y2, Line^y1 #= Rect^centerY, Line^x1 #= Rect^x, Line^x2 #= Rect^rightX,

    cgGrid([[_,Ds,De,Dn,Dd],
	    [Plus,Em,Eo,Er,Ee],
	    [Rect, Rect, Rect, Rect,Rect],
	    [Ym,Yo,Yn,Ye,Yy]]),

    %
    cgStartRecord(sendmory),
    cgShow([Ds,De,Dn,Dd,
	    Plus,Em,Eo,Er,Ee,
	    Line,
	    Ym,Yo,Yn,Ye,Yy]),
    cgStopRecord.

createLabels([]).
createLabels([(Label,Text)|Ls]):-
    cgLabel(Label),Label^text #= Text,
    Label^fontSize #= 20,
    Label^fontStyle #= 'BOLD',
    createLabels(Ls).


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -