I'm doing a project for my last university examination but I'm having some troubles! I'm making an expert system who should be able to assemble a computer after asking some questions to the user. It works but according to my teacher I need to define more rules, could you give me some suggestions please? I have facts like these:

processor(P, Proc_price, Price_range),
motherboard(M, Motherboard_price, Price_range),
ram(R, Ram_price, Price_range),
case(C, Case_price, Price_range),
ali(A, Ali_price, Price_range),
video_card(V, Vga_price, Price_range),
ssd(S, Ssd_price, Price_range),
monitor(D, Monitor_price, Price_range),
hdd(H, Hdd_price, Price_range).

I ask these questions to the user: 1) choose the price range 2) choose the display size 3) choose hard disk size Then I ask 3 questions about computer utilization to define the user: 1) do you surf on internet? 2) do you play? 3) do you use editing programs?

use(gaming) :- ask("Do you play games? (y/n)").

    use(editing) :- ask("Do you use editing programs? (y/n)").

    use(surfing) :- ask("Do you surf internet?(y/n)").

    user(base) :-
        use(surfing),  \+ use(gaming), \+ use(editing).

    user(gamer) :-
        use(gaming), use(surfing), \+ use(editing).

    user(professional) :-
        use(editing), \+ use(gaming), use(surfing).

I should make more questions about user definition to make user definition more complex too and add some rules. Please help me, I'm desperate


2 Answers 2


The three questions "1) do you surf on internet? 2) do you play? 3) do you use editing programs?" are a good start, but I think your teacher is right that you need more granularity.

1) What do you use your computer for?

(a) Watching videos [leads to: "Streaming or Downloaded HD?" b/c downloading requires more local volume, and potentially a better video card.]

(b) Do you play Games [leads to: "High-end video games or simple games?" b/c playing AAA FPS requires much more powerful video cards. If they play words with friends or Tetris, a low-end card will be sufficient.]

(c) Do you use editing programs? [leads to: "photo editing? video editing? what size files?" b/c editing HD vid and high resolution photos is onerous with an underpowered system.]

You might want to ask in general what they use the computer for, because if it's just email, web surfing, Facebook and Youtube, etc., they can probably get by with a Windows surface (I'm a regular critic of MS, but my understanding is you can get the fully functional Office Suite on Surface, which has utility value.)


I think you're on the right track, but you should step back and think like a Product Manager here, as opposed to a developer. These questions might help you clarify your intent, and expand your initial template to a more fully featured system your teacher is looking for:

  • Who is the customer for my system?
  • What level of technical knowledge will the average user have?
  • Am I covering every aspect with the proper amount of detail?
  • Is the order of my questions correct? (Why ask price range before monitor size?)
  • Is there any mechanism to help a user if they don't know what answer to choose?

Again, these are just some initial thoughts. Only you know what product you want to create, and what the capabilities should be.


We cannot do homework for students in this network, however I can suggest that several items affecting cost and several usage patterns are missing and the number of rules is shy by an order of magnitude. I wholeheartedly agree with the educational directives you received.

Consider first developing your lists further to include peripherals like DVD burner, USB devices, and audio. Whether the user does scientific programming, watches movies on the monitor, develops software, and other specific usage scenarios is also more specific and therefore will produce a better tailored system than the answer to the question of whether the user is a professional.

It is not the metric of the number of rules that is of most importance. It is the number of operations contained in the rule set that is the guiding metric. This is because rules in Prolog can be aggregated. The rough estimate of rule operator count to complete a system is sqrt(i*o)/4, where i is the number of input permutations and o is the number of output permutations.

(This is the application of Shannon Information Theory, that number of bits n = log2 (P'/P), where P' and P are the a posteriorii and a priori probabilities respectively. The divisor of four is because there are about 16 = 24 operators normally used.)

You may end up with thirty or forty rules.

Create some use cases that exercise the extremes as well as some of the typical cases from among the permutations in inputs and outputs. Run your system on those cases and observe the system behavior. Learn how to debug by outputting intermediate results or stepping through rule execution.

There are no shortcuts to researching and developing other than not wasting time worrying about how much time it will take. You can also optimize your homework time by learning the tools and then stepping back, taking a deep breath, and saying, "I can do this!"

  • $\begingroup$ Although my answer may have been more in line with what the OP was looking for--pure luck, imo--this answer deserves recognition (I certainly upvoted) for the technical points you make re Prolog and Shannon. Thanks for contributing! $\endgroup$
    – DukeZhou
    Jun 6, 2018 at 20:38
  • 1
    $\begingroup$ @DukeZhou I've panicked when not sure of myself with regard to academic assignments at the university. In this specific case, I read between the lines, supported what the professor was doing (which seemed to be in the best interest of the student), and provided a wider context to understand what appeared to be the assignment. I am interested in what you mean when you say the author of the question was looking for an answer involving pure luck. Can you expound? $\endgroup$ Jun 8, 2018 at 19:33
  • $\begingroup$ Just that I took a shot in the dark that the list of questions itself needed to be supplemented, without thinking much about the underlying mechanics. (It seems to me "level of use" is the primary question these days re: computer purchase--with the rise of the tablet, only PC gamers and techs really need PCs anymore, outside of an office setting. That said, my answer doesn't involve AI!) $\endgroup$
    – DukeZhou
    Jul 5, 2018 at 21:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .