I shall leave you to work out why you are only using every other line.Antoine Compagnie wrote:. . . . . .
[loves(vincent, mia)., loves(marcellus, mia)., loves(pumpkin, honey_bunny)., loves(honey_bunny, pumpkin)., , jealous(X, Y) :-, loves(X, Z),, loves(Y, Z)., null, null, null, null]
Antoine Compagnie wrote:Campbell Ritchie, do you mean I should replace...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Antoine Compagnie wrote:But here is what I'm working on:...
Take into account the clauses that have several lines.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
[[loves[vincent, mia]], [loves[marcellus, mia]], [loves[pumpkin, honey_bunny]], [loves[honey_bunny, pumpkin]], [loves[X, mia]], [loves[vincent, Y]], [jealous[X, Y], loves[X, Z], loves[Y, Z]], [jealous[U, V]]]
{1=null, 2=null, 3=null, 4=null, 5=null, 6=null, 7=null, 8=null, 9=null, 10=null, 11=null, 12=null, 13=null, 14=null, 15=null, 17=null, 16=null}
{1=vincent, 2=mia, 3=marcellus, 4=mia, 5=pumpkin, 6=honey_bunny, 7=honey_bunny, 8=pumpkin, 9=X, 10=mia, 11=vincent, 12=Y, 13=X, 14=Y, 15=Z, 17=V, 16=U}
Antoine Compagnie wrote:Here is my new code: ...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
COUCOU jealous[X, Y], loves[X, Z], loves[Y, Z]
predicat l1 jealous
predicat l2 jealous
Annuaire Valeur {1=vincent, 2=mia, 3=marcellus, 4=mia, 5=pumpkin, 6=honey_bunny, 7=honey_bunny, 8=pumpkin, 9=null, 10=mia, 11=vincent, 12=null, 13=null, 14=null, 15=null, 17=marcellus, 16=vincent}
Annuaire Affichage {1=vincent, 2=mia, 3=marcellus, 4=mia, 5=pumpkin, 6=honey_bunny, 7=honey_bunny, 8=pumpkin, 9=X, 10=mia, 11=vincent, 12=Y, 13=X, 14=Y, 15=Z, 17=marcellus, 16=vincent}
S1 X
S1 code 13
S2 vincent
S2 code 16
Variable - Constante
Annuaire Valeur {1=vincent, 2=mia, 3=marcellus, 4=mia, 5=pumpkin, 6=honey_bunny, 7=honey_bunny, 8=pumpkin, 9=null, 10=mia, 11=vincent, 12=null, 13=vincent, 14=null, 15=null, 17=marcellus, 16=vincent}
Annuaire Affichage {1=vincent, 2=mia, 3=marcellus, 4=mia, 5=pumpkin, 6=honey_bunny, 7=honey_bunny, 8=pumpkin, 9=X, 10=mia, 11=vincent, 12=Y, 13=vincent, 14=Y, 15=Z, 17=marcellus, 16=vincent}
S1 Y
S1 code 14
S2 marcellus
S2 code 17
Variable - Constante
HOLALALALALALALA true
All things are lawful, but not all things are profitable.
Antoine Compagnie wrote:Last, but definitely not least, I now would like to do it automaticaly, that is to say to do this resolution automaticaly. I tried:
Which is inspired a lot from the "by hand method". Yet, it doesn't work because of an IndexOutOfBoundsException at line 60.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Next you set 'goal' to the element before the last one.
plainly isn't going to work if ListClauses has less than two elements in it - which is definitely the case here.
Antoine Compagnie wrote:Should I do
to set is as the goal?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Antoine Compagnie wrote:the following one is from my teacher
Antoine Compagnie wrote:Alas! it only work for simple resolution questions. It semms not to be okay for more complex programs such as
write,nl rules
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|