prologcgb-prolog

Running CG graphics on BProlog?


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?


Solution

  • 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