lundi 2 octobre 2017

Getting all possible randomly generated lists in Prolog

I've written a predicate that randomly picks 4 elements from a list of 6 elements [a,b,c,d,e,f]:

?- random_code(X). X = [e, c, b, f]

?- random_code(X). X = [b, d, c, e]

?- random_code(X). X = [c, f, d, a]

etc.

What I'm trying to get is a predicate for a list of ALL possible outcomes from this query, meaning 6*5*4*3 = 320 (right?) answers, at once.




Aucun commentaire:

Enregistrer un commentaire