Not logged in. · Lost password · Register

katjab
Member for 2 months
54 posts
Subject: Problem 5, map coloring, availablecolors, etc.
I think I managed to fix the situation with the notebook. There may or may not be a bug in availablecolors (apart from the fact that it does the opposite of what it says). It works for me now on some tests. If it does not work for you, please let me know just how it crashes, best here in the forum.

If you run the sample paint query on a clean setup, you should get
ColoredMap = [sa:red, tas:red, vic:red, nsw:red, qld:red, nt:red, wa:red]
This post was edited on 2019-11-28, 17:54 by katjab.
michael_wagner
Member since Oct 2016
6 posts
In https://kwarc.info/teaching/AI/resources/hw5-setup.txt there is a missing semicolon, isn't it?

arrangecolors([Country:Neighbors|Rest], ColorList, TempList, ColoredMap) :-
    member(Color,ColorList),
%    Tracing:
%    write('Color:'), write(Color),write(' TempList:'), write(TempList),nl,
    different(Color,Neighbors,TempList) <- here
    arrangecolors(Rest,ColorList,[Country:Color|TempList], ColoredMap).
michael_wagner
Member since Oct 2016
6 posts
In reply to post #1
We already submitted a working solution with the original code.
Do you want us to find another one with the updated code?


original:
sortedcountries(Countries,TempList,SortedCountries) :-
    countrieswithconstraints(Countries,TempList,[],CountriesWithConstraints),
    keysort(CountriesWithConstraints,SortedCountriesWithConstraints),
    % write(SortedCountriesWithConstraints), nl,
    pairs_keys_values(SortedCountriesWithConstraints,_,SortedCountries).
katjab
Member for 2 months
54 posts
arrangecolors is in the Edit section, which is the one you were supposed to fix.
As for sortedcountries, either is ok.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Datenschutz | Kontakt
Powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2011 by Yves Goergen