# Hello, would you help a beginner?

**URL:** <https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310>\
**Category:** Help!\
**Tags:** raspberry-pi\
**Created:** [February 21, 2019, 1:30am UTC](https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310 "2019-02-21T01:30:13Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![yosoyquiensoy](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/yosoyquiensoy/32/124_2.png) [@yosoyquiensoy](https://swi-prolog.discourse.group/u/yosoyquiensoy)\
**Post date:** [March 2, 2019, 7:24pm UTC](https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310/21 "2019-03-02T19:24:15Z")

</div>

Boris, this is becoming better. It’s almost good. Thanks.  
As you can see, some queries were not answered correctly by the program (I don’t know why). I’m content anyways.  
I didn’t understand when and where should i type the three backticks.

```prolog
pi@raspberrypi:~ $ swipl
Warning: Package bddem: no binary for architecture armhf
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 7.2.3)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- [office].
true.

?- supervises(black,green).
true .

?- supervises(gray,green).
false.

?- adminWorker(black).
true.

?- supervises(brown,white).
false.

?- supervises(brown, white).
false.

?- supervises(brown,black).
true .

?- trace.
true.

[trace] ?- notrace.
true.

[debug] ?-

```

---

<div class="post-metadata">

**Author:** ![yosoyquiensoy](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/yosoyquiensoy/32/124_2.png) [@yosoyquiensoy](https://swi-prolog.discourse.group/u/yosoyquiensoy)\
**Post date:** [March 2, 2019, 7:44pm UTC](https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310/22 "2019-03-02T19:44:15Z")

</div>

?- trace.  
true.

[trace] ?- supervises(who,green).  
Call: (7) supervises(who, green) ? skip  
Fail: (7) supervises(who, green) ? up  
false.

[trace] ?- supervises(who, green).  
Call: (7) supervises(who, green) ? creep  
Call: (8) manager(who) ? creep  
Fail: (8) manager(who) ? creep  
Redo: (7) supervises(who, green) ? creep  
Call: (8) adminWorker(who) ? creep  
Fail: (8) adminWorker(who) ? creep  
Redo: (7) supervises(who, green) ? creep  
Call: (8) manager(who) ? creep  
Fail: (8) manager(who) ? creep  
Fail: (7) supervises(who, green) ? creep  
false.

[trace] ?- notrace.  
true.

[debug] ?-  
|  
|

---

<div class="post-metadata">

**Author:** ![yosoyquiensoy](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/yosoyquiensoy/32/124_2.png) [@yosoyquiensoy](https://swi-prolog.discourse.group/u/yosoyquiensoy)\
**Post date:** [March 2, 2019, 10:38pm UTC](https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310/23 "2019-03-02T22:38:54Z")

</div>

NOW IT LOOKS MORE LIKE MY BOOK. This is very good.

- [office].  
true.

?- trace.  
true.

[trace] ?- supervises(\_G2345, green).  
Call: (7) supervises(\_G932, green) ? creep  
Call: (8) manager(\_G932) ? creep  
Exit: (8) manager(brown) ? creep  
Call: (8) adminWorker(green) ? creep  
Fail: (8) adminWorker(green) ? creep  
Redo: (8) manager(\_G932) ? creep  
Exit: (8) manager(grey) ? creep  
Call: (8) adminWorker(green) ? creep  
Fail: (8) adminWorker(green) ? creep  
Redo: (7) supervises(\_G932, green) ? creep  
Call: (8) adminWorker(\_G932) ? creep  
Exit: (8) adminWorker(black) ? creep  
Call: (8) officeJunior(green) ? creep  
Exit: (8) officeJunior(green) ? creep  
Exit: (7) supervises(black, green) ? creep  
\_G2345 = black .

[trace] ?-

---

<div class="post-metadata">

**Author:** ![yosoyquiensoy](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/yosoyquiensoy/32/124_2.png) [@yosoyquiensoy](https://swi-prolog.discourse.group/u/yosoyquiensoy)\
**Post date:** [March 3, 2019, 12:13am UTC](https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310/24 "2019-03-03T00:13:00Z")

</div>

Boris,  
this is working not completely like the book. After  
the last query the expert system didn’t give the answer: “I guess that the animal es penguin”, But this is great advance, don’t you think? I just enter the into the train for a long trip to Siberia and i feel grateful and humble for your big help and the other professors,

For help, use ?- help(Topic). or ?- apropos(Word).

?- [animal].  
true.

?- go.  
Does the animal have the following attribute: has\_hair? yes.

Does the animal have the following attribute: eats\_meat? |: yes.

Does the animal have the following attribute: has\_tawny\_color? |: yes.

Does the animal have the following attribute: has\_dark\_spots? |: no.

Does the animal have the following attribute: has\_black\_stripes? |: yes.

I guess that the animal is: tiger  
true.

?- go.  
Does the animal have the following attribute: has\_hair? no.

Does the animal have the following attribute: gives\_milk? |: no.

Does the animal have the following attribute: has\_feathers? |: yes.

Does the animal have the following attribute: does\_not\_fly? |: yes.

Does the animal have the following attribute: has\_long\_neck? |: no.

Does the animal have the following attribute: swims? |: yes  
|:  
|:

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [March 3, 2019, 6:17am UTC](https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310/25 "2019-03-03T06:17:32Z")

</div>

What is your question???

---

<div class="post-metadata">

**Author:** ![yosoyquiensoy](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/yosoyquiensoy/32/124_2.png) [@yosoyquiensoy](https://swi-prolog.discourse.group/u/yosoyquiensoy)\
**Post date:** [March 3, 2019, 7:45pm UTC](https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310/26 "2019-03-03T19:45:07Z")

</div>

> [@Boris](#):
>
> You should also use code blocks when you post such things. Put 4 spaces at the beginning of each line of code, or make code block by using 3 backticks on the top and the bottom of the code block:
> 
> ```prolog
> 
> ```
> 
> this is a code block
> 
> ```prolog
> 
> ```

Except for this suggestion made by you, I am good now. I’ll continue doing the exercises of my book.  
Thank you very much for your valuable help.

[Previous page](https://swi-prolog.discourse.group/t/hello-would-you-help-a-beginner/310.md?page=1)
