我一直在尝试制作游戏。游戏由 9 块组成,其中有圆点。棋子的每个面都有 0,1 或 2 个点。
[2,2,0,0,1,0]
这是一块。这块,看起来像这样:
[[2,2,0,0,1,0], %%peca1
[2,1,0,0,1,1], %%peca2
[2,0,0,0,1,1], %%peca3
[2,0,0,0,0,0], %%peca4
[1,0,0,0,1,0], %%peca5
[1,0,0,0,0,0], %%peca6
[1,0,0,0,0,0], %%peca7
[0,0,0,0,1,0], %%peca8
[0,0,0,0,0,0]]), %%peca9
这些都是碎片。(前、右脸、后、右、上、下)
这是,当我运行它时,我会收到消息
[V2,V5,V7,V11,V12,V16,V17,V18,V19,V23,V26,V29,V31,V35,V41,V47,V53] - singleton variables
有什么帮助或建议吗?
此致,
路易斯·科斯塔
:-use_module(library(clpfd)).
dice:-
Vars=[V1, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18,
V19, V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, V30, V31, V32, V33, V34, V35, V36,
V37, V38, V39, V40, V41, V42, V43, V44, V45, V46, V47, V48, V49, V50, V51, V52, V53, V54],
domain(Vars,1,9),
table([
[V1, V2, V3, V4, V5, V6], %%peca1
[V7, V8, V9, V10, V11, V12], %%peca2
[V13, V14, V15, V16, V17, V18], %%peca3
[V19, V20, V21, V22, V23, V24], %%peca4
[V25, V26, V27, V28, V29, V30], %%peca5
[V31, V32, V33, V34, V35, V36], %%peca6
[V37, V38, V39, V40, V41, V42], %%peca7
[V43, V44, V45, V46, V47, V48], %%peca8
[V49, V50, V51, V52, V53, V54]], %%peca9
[[2,2,0,0,1,0], %%peca1
[2,1,0,0,1,1], %%peca2
[2,0,0,0,1,1], %%peca3
[2,0,0,0,0,0], %%peca4
[1,0,0,0,1,0], %%peca5
[1,0,0,0,0,0], %%peca6
[1,0,0,0,0,0], %%peca7
[0,0,0,0,1,0], %%peca8
[0,0,0,0,0,0]]), %%peca9
labeling([],Vars).
noDotsFace:-
sum([V2,V19, V7, V16, V31, V26],[V5, V23, V11, V53, V47, V41, V17, V35, V29, V18, V12], 7).