Questions tagged [win-prolog]

15 questions
2
votes
1 answer

Knapsack Find Max

I am studying prolog in a course, I have an exercise to implement the knapsack problem. I succeeded in writing the code, but I cant figure out how to find the max profit out of all the possible solutions. Here's the code between( Lo, Hi, Nu ) :- …
Ariel Pinchover
  • 654
  • 3
  • 17
1
vote
0 answers

How can I apply Menu functionalities to buttons in WIN-PROLOG,

I am trying to build a toolbar in WIN-PROLOG and I am having some problems on giving functionalities to the buttons. I want to have buttons that have the same functionalities that items in the menu bar have. For example, a button named "New" that…
Rodrigo
  • 11
  • 1
1
vote
3 answers

how to print the first letter of few words in prolog list?

I want to print the name code input by user begin:-read(X), name(X,L), write('Name Code: '), beginStr(L). beginStr([H|T]):- put(H), beginStr(T). beginStr([]):-nl. The Name Code…
EddieJn
  • 47
  • 2
1
vote
1 answer

Prolog. lists predicate to remove an element

Im trying to remove 'b' which is '(b, 10)'. The code i have is: remove(C, L1, L2). remove(C, [C|N], N). remove(C, [C|L1], [C|L2]) :- remove(C, L1, L2). 'C' represents a chest. 'L' represents a location. 'N' represents a number. Im not…
user1854914
  • 137
  • 8
1
vote
1 answer

Win Prolog List partly works

Im trying to relate a locker with a code. This is what i have so far. lockerof(C, [], V). lockerof(C,[C|_], V). lockerof(C, [[C, V]|_], V). When i type in: lockerof(a, [[a,1],[b,2]], V). It gives me the value for a so i get: V…
user1854914
  • 137
  • 8
0
votes
0 answers

How to write the output from a list with only atoms for win-prolog translator?

When user inputs 'i like prolog', or 'saya like Prolog' via Win-Prolog, the expected output will be 'saya suka prolog' or 'i suka Prolog' respectively, based on the code…
Leon219
  • 1
  • 2
0
votes
1 answer

Visual Win-Prolog Listbox Selected Item Index

I was going through the manual file Win-W32.PDF but I couldn't find how to get the selected item in a listbox. i.e the index of test3 in this case I know that: test being the name, 3 being the id of the listbox wlbxsel((test, 3),1, X) get the…
Katia
  • 679
  • 2
  • 15
  • 42
0
votes
2 answers

Opening a browser with a URL from WinProlog

I am trying to implement a help system for a GUI written in Win-Prolog. The obvious approach would seem to be HTML. Is it possible to open a browser with a given URL programatically from within WinProlog? Ideally I'd like to tie the browser open…
bph
  • 10,728
  • 15
  • 60
  • 135
0
votes
1 answer

Read string and single out every word in the string in Win-Prolog

I've spend whole day on the internet and I wasn't able to find any built-in predicate in Win-Prolog that can single out every word in a String. Example: | ?- read(X). |: 'this is a string'. X = 'this is a string'. is there any predicate I can use…
Soon
  • 1
  • 4
0
votes
1 answer

Best ide for using win-prolog

I have to understand an existing code in prolog which is written for win-prolog 4.800, and then build my work on that. The problem is the ide supplied along with win-prolog is very clumsy. I searched internet, but did not find better substitue for…
0
votes
1 answer

Prolog error: Predicate Protected

I'm new to prolog and I'm trying to write a predicate that returns "Yes" if two train stations are on the same line. line(1,[a,b,c,d,e]); line(2,[b,g,f,e,i,h]); line(3,[l,m,g,n,f,o,p,q,i,j]); same_line(X,Y):- line(_,L), member(X,L), …
SaintLike
  • 9,119
  • 11
  • 39
  • 69
0
votes
1 answer

Random numbers in flex

so im just getting to grips with flex and fuzzy logic. I wanted to create a simple chat system where based on what your choice of dialogue is the NPC would change what they say, but i want to make it a bit more unique and it currently gets the same…
Mike Tarrant
  • 291
  • 2
  • 7
  • 19
0
votes
2 answers

Prolog, list which identifies an item is in a current place

Im having trouble work out how to write in prolog that the chest "C" is at location "L" This is the code i have at the moment but i think im making it too complicated and going in the wrong direction location(C, L). location(C, [[C,L]|_]). …
user1854914
  • 137
  • 8
0
votes
1 answer

How to get both drive predicates working in prolog?

begin:- go, initialise. % drive predicate begin:- write('Sorry cannot help'),nl,nl. go:- write('Below is the list of the current toys available within the store.'),nl,nl,nl,nl, loop_through_list([car, football, action_men,…
W_K
  • 33
  • 3
  • 4
  • 8
-1
votes
1 answer

WIN-PROLOG - how to get random value?

I'm using LPA WIN-PROLOG and I want to get random values. I looked for a random predicate and I don't find one that is already defined. What I tried: X is random(10) random(1,10,X) Can someone help me find the way to get a random value? Thanks.
STF
  • 1,485
  • 3
  • 19
  • 36