Visual prolog 7.5 tutorial
![visual prolog 7.5 tutorial visual prolog 7.5 tutorial](https://usermanual.wiki/Document/a20gentle20guide20to20constraint20logic20programming20via20eclipse.1116263019-User-Guide-Page-1.png)
SetLocation (console_native :: coord ( X, Y ) ) , The object is thrown at certain angle and falls with free-fall acceleration G */Ĭoord ( X0, Xspeed, T, Y0, Yspeed, G, Symbol ) :- X =convert (unsigned16 ,round ( X0 + XSpeed * T ) ), Y =convert (unsigned16 ,round ( Y0 - ( YSpeed * T - G * T ^ 2 / 2 ) ) ) ,
![visual prolog 7.5 tutorial visual prolog 7.5 tutorial](https://wiki.visual-prolog.com/images/4/45/FundamentalVisualProlog2.png)
![visual prolog 7.5 tutorial visual prolog 7.5 tutorial](https://static.docsity.com/documents_first_pages/notas/2012/03/23/1d96b9b87dfc3c59d5e2994792748115.png)
* Calculation of the trajectory of a thrown object (symbol) for forming a firework line. SetLocation (console_native :: coord (convert (unsigned16, X ), Y ) ) , Line (console_native :: coord ( X1, Y1 ) ,console_native :: coord ( X2, Y2 ), Symbol, Sleep ) :- foreach X =std :: fromTo ( X1, X2 ) do Z1 = X - X1, if Y2 >= Y1 then Z2 = Y2 - Y1 else Z2 =- 1 * ( Y1 - Y2 ) end if, Y =convert (unsigned16 ,round ( Z1 * Z2 / ( X2 - X1 ) + Y1 ) ) , SetLocation (console_native :: coord ( X, convert (unsigned16, Y ) ) ) , Line (console_native :: coord ( X, Y1 ) ,console_native :: coord ( X, Y2 ), Symbol, Sleep ) :- !, foreach Y =std :: fromTo ( Y1, Y2 ) do SetLocation (console_native :: coord ( XCur, YCur ) ) , % drawing an arc with the center in (XCent YCent)Īrc ( Rx, Ry, XCent, YCent, Percent_Beg, Percent_End, Symbol, Sleep ) :- foreach X =std :: fromTo (round ( Percent_Beg * 31 ) ,round ( Percent_End * 31 ) ) do Angle = ( 2 *pi ) * ( X / 32 ), XCur =convert (unsigned16, XCent +round ( Rx *cos ( Angle ) ) ), YCur =convert (unsigned16, YCent -round ( Ry *sin ( Angle ) ) ) ,
![visual prolog 7.5 tutorial visual prolog 7.5 tutorial](https://demo.pdfslide.net/img/380x512/reader024/reader/2021021915/55cf881d55034664618d808f/r-2.jpg)
Ĭlauses % drawing an ellipse with the center in (XCent YCent)Įllipse ( Rx, Ry, XCent, YCent, Symbol, Sleep ) :-Īrc ( Rx, Ry, XCent, YCent, 0, 1, Symbol, Sleep ). % Symbols that will be randomly used for building a firework Line : (console_native :: coord P1 ,console_native :: coord P2 ,string ,positive Sleep ).Ĭoord : (real X0, real Xspeed ,real T ,real Y0 ,real Yspeed, real G, string Symbol ).įirework : (boolean IsDrawing ,real X0 ,real Y0 ,real G ,positive Sleep ,string Symbol ).Ĭonstants % Congratulation-phrases for random choice Open core, console, math, list, programControlĮllipse : (integer Rx ,integer Ry ,integer XCent ,integer YCent ,string Symbol ,positive Sleep ).Īrc : (integer Rx ,integer Ry ,integer XCent ,integer YCent ,real Percent_Beg ,real Percent_End ,string Symb ,positive Sleep ).