samedi 28 novembre 2020

I need to get prolog to guess random element in a lost in x amount of tries

Write a predicate to interactively guess an element from a list in at most k tries, where k is also an input (integer) value. this is the exact question. I'm not sure if that means If i also have to get the list from the user. How do i get a random element and how do i make it run x number of times? up until now all i know is doing something until the list is empty method([],[]). <=like that. currently my code looks something like this.

'''guess_number:- write("Please insert a list"), read(L), write("Please insert amount of tries"), read(T).'''




Aucun commentaire:

Enregistrer un commentaire