我最近安装了 B-prolog 并从这里尝试了 CG 图形示例http://www.probp.com/
根据他们的手册,我已经在 C:/ 驱动器中安装了 B prolog,并且正确编译但没有执行它们。
这是 cuba.pl
go:-
cuba(Os),
cgWindow(Win,"cuba"),
handleWindowClosing(Win),
cgSame(Os,window,Win),
cgPack(Os),
cgMove(Os,30,30),
cgShow(Os).
handleWindowClosing(Win),{windowClosing(Win)} => cgClose(Win).
cuba(Os):-
cgRectangle(Frame),Frame^fill #= 0,
cgRectangle(Bg),Frame^size #= Bg^size,
Bg^color #=blue,
Bg^width #= 2*Bg^height,
WhiteBox=[W1,W2],
cgRectangle(WhiteBox),
cgSame(WhiteBox,color,white),
cgSame([Bg|WhiteBox],width),
cgSame(WhiteBox,width),
cgSame(WhiteBox,width),
5*W1^height #= Bg^height,
W1^x #= Bg^x,
W1^y #= Bg^y + Bg^height/5,
W2^x #= Bg^x,
W2^y #= Bg^y + 3*Bg^height/5,
cgTriangle(Tri),
Tri^color #=red,
Tri^point1 #= Bg^leftTopPoint,
Tri^point2 #= Bg^leftBottomPoint,
Tri^x3 #= Bg^x + 3*Bg^width/7,
Tri^y3 #= Bg^y + Bg^height/2,
cgStar(Star),
Star^n #=5,
Star^color #= white,
Star^centerX #= Bg^x + Bg^width/7,
Star^centerY #= Bg^centerY,
Star^diameter #= Bg^height/4,
Os=[Bg,W1,W2,Tri,Star,Frame].
每当我尝试运行时,我都会收到此错误?
Type 'help' for usage.
| ?- cl('cuba.pl').
Compiling::cuba.pl
compiled in 3 milliseconds
loading::cuba.out
yes
| ?- go
*** Undefined procedure: cgRectangle/1
这里有什么问题?