在 BProlog 上运行 CG 图形?

发布于 2024-12-07 20:06:12 字数 1433 浏览 4 评论 0原文

我最近安装了 B-pr​​olog 并尝试了这里的 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

这里有什么问题呢?

i recently installed B-prolog and tried CG graphics examples from here http://www.probp.com/

According to their manual, i've installed B prolog in C:/ drive and its compiling propoerly but not executing them.

This is 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].

Whenever i try to run, i get this error?

Type 'help' for usage.
| ?- cl('cuba.pl').
Compiling::cuba.pl
compiled in 3 milliseconds
loading::cuba.out

yes
| ?- go
***  Undefined procedure: cgRectangle/1

What is the problem here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我ぃ本無心為│何有愛 2024-12-14 20:06:12

您必须运行 Java 版本的 prolog 引擎。

尝试使用 bpp.bat 而不是 bp.bat 来启动解释器。

您将需要一个 32 位 Java VM

You have to run the Java version of the prolog engine.

Try using bpp.bat to launch the interpreter instead of bp.bat.

You will need a 32bit Java VM

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文