Как нарисовать дерево поиска, используя трассировку в прологе - PullRequest
0 голосов
/ 13 января 2020

Я изо всех сил пытаюсь нарисовать дерево поиска, используя трассировку в прологе, какие-либо идеи о том, как это сделать?

вот что у меня есть, когда я делаю трассировку:

[trace]  ?- rabbit_owner(N).
   Call: (8) rabbit_owner(_7256) ? creep
   Call: (9) street(_7472) ? creep
   Call: (10) _7458=[_7458, _7464, _7470, _7476] ? creep
   Exit: (10) [[[[[[[[[...|...]|...], _7464|...], _7464, _7470|...], _7464, _7470, _7476], _7464, _7470, _7476], _7464, _7470, _7476], _7464, _7470, _7476], _7464, _7470, _7476]=[[[[[[[[[...|...]|...], _7464|...], _7464, _7470|...], _7464, _7470, _7476], _7464, _7470, _7476], _7464, _7470, _7476], _7464, _7470, _7476], _7464, _7470, _7476] ? creep
   Call: (10) lists:member(house(black, _7484, _7486), [[[[[[[[...|...]|...], _7464|...], _7464, _7470|...], _7464, _7470, _7476], _7464, _7470, _7476], _7464, _7470, _7476], _7464, _7470, _7476]) ? creep
   Exit: (10) lists:member(house(black, _7484, _7486), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, _7484, _7486), _7470|...], house(black, _7484, _7486), _7470, _7476], house(black, _7484, _7486), _7470, _7476], house(black, _7484, _7486), _7470, _7476], house(black, _7484, _7486), _7470, _7476]) ? creep
   Call: (10) lists:member(house(blue, _7492, _7494), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, _7484, _7486), _7470|...], house(black, _7484, _7486), _7470, _7476], house(black, _7484, _7486), _7470, _7476], house(black, _7484, _7486), _7470, _7476], house(black, _7484, _7486), _7470, _7476]) ? creep
   Exit: (10) lists:member(house(blue, _7492, _7494), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, _7484, _7486), house(..., ..., ...)|...], house(black, _7484, _7486), house(blue, _7492, _7494), _7476], house(black, _7484, _7486), house(blue, _7492, _7494), _7476], house(black, _7484, _7486), house(blue, _7492, _7494), _7476], house(black, _7484, _7486), house(blue, _7492, _7494), _7476]) ? creep
   Call: (10) lists:member(house(brown, _7500, _7502), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, _7484, _7486), house(..., ..., ...)|...], house(black, _7484, _7486), house(blue, _7492, _7494), _7476], house(black, _7484, _7486), house(blue, _7492, _7494), _7476], house(black, _7484, _7486), house(blue, _7492, _7494), _7476], house(black, _7484, _7486), house(blue, _7492, _7494), _7476]) ? creep
   Exit: (10) lists:member(house(brown, _7500, _7502), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, _7484, _7486), house(..., ..., ...)|...], house(black, _7484, _7486), house(blue, _7492, _7494), house(..., ..., ...)], house(black, _7484, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)], house(black, _7484, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)], house(black, _7484, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)]) ? creep
   Call: (10) lists:member(house(black, french, _7510), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, _7484, _7486), house(..., ..., ...)|...], house(black, _7484, _7486), house(blue, _7492, _7494), house(..., ..., ...)], house(black, _7484, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)], house(black, _7484, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)], house(black, _7484, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)]) ? creep
   Exit: (10) lists:member(house(black, french, _7486), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, _7486), house(..., ..., ...)|...], house(black, french, _7486), house(blue, _7492, _7494), house(..., ..., ...)], house(black, french, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)], house(black, french, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)], house(black, french, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)]) ? creep
   Call: (10) lists:member(house(_7514, spanish, jaguar), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, _7486), house(..., ..., ...)|...], house(black, french, _7486), house(blue, _7492, _7494), house(..., ..., ...)], house(black, french, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)], house(black, french, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)], house(black, french, _7486), house(blue, _7492, _7494), house(brown, _7500, _7502)]) ? creep
   Exit: (10) lists:member(house(blue, spanish, jaguar), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, _7486), house(..., ..., ...)|...], house(black, french, _7486), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, _7486), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, _7486), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, _7486), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Call: (10) lists:member(house(_7522, _7524, rabbit), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, _7486), house(..., ..., ...)|...], house(black, french, _7486), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, _7486), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, _7486), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, _7486), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Exit: (10) lists:member(house(black, french, rabbit), [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Call: (10) sublist([house(_7536, _7538, snail), house(_7550, japanese, _7554)], [[[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Call: (11) suffix(_7572, [[[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Call: (12) lists:append(_7572, _7574, [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Exit: (12) lists:append([], [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Exit: (11) suffix([[[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], [[[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Call: (11) prefix([house(_7536, _7538, snail), house(_7550, japanese, _7554)], [[[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Call: (12) lists:append([house(_7536, _7538, snail), house(_7550, japanese, _7554)], _7574, [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? creep
   Fail: (12) lists:append([house(_7536, _7538, snail), house(_7550, japanese, _7554)], _7574, [[[[[[[[...|...]|...], house(..., ..., ...)|...], house(black, french, rabbit), house(..., ..., ...)|...], house(black, french, rabbit), house(blue, spanish, jaguar), house(..., ..., ...)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)], house(black, french, rabbit), house(blue, spanish, jaguar), house(brown, _7500, _7502)]) ? 

но я Не знаю, как преобразовать его в дерево поиска. Меня смущает то, будет ли все, что имеет 10, находиться в одной строке или нет. Любая помощь приветствуется, пожалуйста. Спасибо.

enter image description here

...