Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would I implement this in Prolog ? 1)I need to take a List and Randomize it.

ID: 3834345 • Letter: H

Question

How would I implement this in Prolog? 1)I need to take a List and Randomize it.

2) then pick the first element and add it to a new list.

3) Then get the second randomized element and compare the categories. (element looks like this: question(Category, 'Question here?', Score).) If the categories are not the same, add it to the new list.

4) Check the sum of the Scores from the new list and if Sum > 9, I can accept. Else, I have to pick the next element in the Randomized list, this time category does not matter, and continue until my Sum of Scores is > 9. The Scores range from 1-10, but must have at least 2 categories and I need to be able to produce all possible combinations out question sequences.

Explanation / Answer

generate(L, N) :- generate(L, [], N). generate(L, L, 0) :- !. generate(L, X, N) :- A is N - 1, B is random(2), generate(L, [B|X], A).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote