Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Happy New Year 2018 Prolog Challenge

61 views
Skip to first unread message

j4n bur53

unread,
Jan 12, 2018, 8:22:36 PM1/12/18
to
Dear All,

Not yet fully recovered from the party?
Need a challenge to get the brains working?

In case you have a HTML5 browser, this is
a little nifty coloring game:
https://www.crazygames.com/game/coloruid

Anybody up to a Prolog code that computes
a solution sequence for a given problem?

Bye

burs...@gmail.com

unread,
Jan 27, 2018, 12:39:13 PM1/27/18
to
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
0 new messages