Exercise: Map Coloring

Exercise: Map Coloring

In this exercise, you will create an IDP-Z3 specification for the Map Coloring Problem. The problem is simple: you must color a map in such a way that no bordering countries have the same color.

We have already prepared a vocabulary and a structure. However, before you dive in, think about how to best represent all the necessary elements of the problem. How would you represent colors, and countries? How to best denote that two countries are bordering, or what the color of a country is? By now, you should be able to answer these questions yourself. If not, don't worry -- you will learn in time.

Once you've given some thoughs to these questions, ▶ click here to see the vocabulary and structure we prepared.

Using this structure, try to express the following:

  • Belgium is red.
  • The color of Luxembourg is not the color of Belgium.
  • Every country is yellow.
  • Every country that borders Germany is green.
  • Every country that doesn't border Switzerland is yellow.
  • Neighbouring countries may not have the same colour.

Made with love (and Hugo) by Joost Vennekens and Simon Vandevelde. :-)