Here is a solution to the Happy New Year 2018
challenge, solving the coloruid in Prolog. We
only bothered with representing the problem domain
straight away and then doing a brute force search.
We do not yet show time measures.
The problem is interesting, since it uses some
manipulations which are similar to equational
logic. So in the future we might look again
into this problem. To represent the problem
domain we numbered the regions:
For a picture see here:
https://gist.github.com/jburse/c3362733ed08ee2e92db58723d529ad2#gistcomment-2334088
The start and end are then modelled as states as follows:
% start(-State)
start(([1-2, 2-3, 2-4, 2-5, 4-5, 5-6, 5-7, 5-8, 8-9],
[1-magenta, 2-orange, 3-yellow, 4-magenta,
5-yellow, 6-green, 7-magenta, 8-green, 9-magenta])).
% end(-State)
end(([],_)).
An ordinary Prolog interpreter can solve this problem easily:
?- solve([A,B,C]).
A = 2-yellow,
B = 5-green,
C = 8-magenta ;
No