I am creating a game based on prolog logic base and i would like to create a user interface for it. Any ideas what programming language integrates with prolog?
It might seem a little counter-intuitive at first, but I actually recommend making a web-based GUI. Once you think it through (and check out the http functionality of eclipse clp, http://eclipseclp.org/doc/bips/lib/http/index.html) you'll realize that Prolog is actually rather well suited as language to write an application server in. I've done that to great success and it avoid the uphill battle of convincing someone to look at a non-standard UI framework. Plus it enables mobile right away and separates concerns really well.
Here is a minimalist example. When you run it (eclipse -s http.pl
, then invoke runserver
), you can open your browser at localhost:8000 to invoke the route predicates defined in processURL below:
http.pl:
:- lib(http),
use_module(http_method).
runserver :-
http_server(8000).
http_method.pl:
:- module(http_method).
http_method("GET", Url, Params, Contents, 200, [contentLength(CL), contentType(mt(text, html))]):-
printf("%w\n", [http_method(Url, Params)]), flush(output),
http_process(Url, Contents),
string_length(Contents, CL).
http_process(Url, Contents) :-
split_string(Url, "/", "/", L),
printf("URL split: %w\n", [L]), flush(output),
processURL(L, Contents).
processURL([""], "Hello World!").
processURL(["route1"], "You are at /route1").
If you use SWI-Prolog, and know Qt, you could use QtCreator designer. An example is online here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With