summaryrefslogtreecommitdiff
path: root/assets/levels/vertex-coloring
diff options
context:
space:
mode:
Diffstat (limited to 'assets/levels/vertex-coloring')
-rw-r--r--assets/levels/vertex-coloring/colors.xml16
-rw-r--r--assets/levels/vertex-coloring/max-edges.xml30
-rw-r--r--assets/levels/vertex-coloring/maximum.xml19
-rw-r--r--assets/levels/vertex-coloring/more-rules.xml45
-rw-r--r--assets/levels/vertex-coloring/vertex-coloring.xml29
5 files changed, 139 insertions, 0 deletions
diff --git a/assets/levels/vertex-coloring/colors.xml b/assets/levels/vertex-coloring/colors.xml
new file mode 100644
index 0000000..7139d18
--- /dev/null
+++ b/assets/levels/vertex-coloring/colors.xml
@@ -0,0 +1,16 @@
+<level title="Coloring" description="Click on a vertex to color it." objective="Change the color of the vertex."/>
+<global-vertex-protections protect="ad"/>
+<colors>
+ <color color="#FF0000" name="red"/>
+ <color color="#00FF00" name="green"/>
+ <color color="#0000FF" name="blue"/>
+</colors>
+<graph>
+ <vertex x="300" y="300" id="v" color="red"/>
+</graph>
+<values>
+ <op op="vertex-color" id="v_color" val1="v"/>
+ <op op="!=" id="is_changed" val1="v_color" val2="red"/>
+ <op op="*" id="points" val1="is_changed" val2="5"/>
+ <var id="objective" val="5"/>
+</values>
diff --git a/assets/levels/vertex-coloring/max-edges.xml b/assets/levels/vertex-coloring/max-edges.xml
new file mode 100644
index 0000000..1d6151a
--- /dev/null
+++ b/assets/levels/vertex-coloring/max-edges.xml
@@ -0,0 +1,30 @@
+<level title="Create Edges" description="You will receive one point per edge and one point per red vertex." objective="Earn as many points as possible."/>
+<global-vertex-protections protect="ad"/>
+<colors>
+ <color color="#FF0000" name="red" vertex-points="1"/>
+ <color color="#00FF00" name="green"/>
+ <color color="#0000FF" name="blue"/>
+ <color color="#FFFF00" name="yellow"/>
+</colors>
+<graph>
+ <vertex x="250" y="250"/>
+ <vertex x="400" y="250"/>
+ <vertex x="550" y="250"/>
+ <vertex x="250" y="400"/>
+ <vertex x="400" y="400"/>
+ <vertex x="550" y="400"/>
+ <vertex x="250" y="550"/>
+ <vertex x="400" y="550"/>
+ <vertex x="550" y="550"/>
+</graph>
+<rules>
+ <edge-rule v1="same" v2="same"/>
+
+ <edge-rule v1="red" v2="green"/>
+ <edge-rule v1="red" v2="blue"/>
+ <edge-rule v1="yellow" v2="blue"/>
+</rules>
+<values>
+ <var id="points" val="E"/>
+ <var id="objective" val="25"/>
+</values>
diff --git a/assets/levels/vertex-coloring/maximum.xml b/assets/levels/vertex-coloring/maximum.xml
new file mode 100644
index 0000000..6f20cf0
--- /dev/null
+++ b/assets/levels/vertex-coloring/maximum.xml
@@ -0,0 +1,19 @@
+<level title="Highest E-V" description="There is now a limit to the number of vertices you can have of each color." objective="+1 point per edge, -1 point per vertex"/>
+<colors>
+ <color color="#FF0000" name="red"/>
+ <color color="#00FF00" name="green"/>
+ <color color="#0000FF" name="blue"/>
+</colors>
+<graph>
+</graph>
+<rules>
+ <edge-rule v1="same" v2="same"/>
+ <edge-rule v1="red" v2="green"/>
+ <vertex-maximum color="red" max="5"/>
+ <vertex-maximum color="green" max="3"/>
+ <vertex-maximum color="blue" max="2"/>
+</rules>
+<values>
+ <op op="-" id="points" val1="E" val2="V"/>
+ <var id="objective" val="6"/>
+</values>
diff --git a/assets/levels/vertex-coloring/more-rules.xml b/assets/levels/vertex-coloring/more-rules.xml
new file mode 100644
index 0000000..805d09d
--- /dev/null
+++ b/assets/levels/vertex-coloring/more-rules.xml
@@ -0,0 +1,45 @@
+<level title="Vertex Colorings" description="Press R to see which colors can connect to which. Use at least one vertex of each color." objective="Color the graph so that it follows the rules."/>
+<global-vertex-protections protect="ad"/>
+<global-edge-protections protect="ad"/>
+<colors>
+ <color color="#FF0000" name="red"/>
+ <color color="#00FF00" name="green"/>
+ <color color="#0000FF" name="blue"/>
+ <color color="#FFFF00" name="yellow"/>
+</colors>
+<graph>
+ <vertex x="250" y="250" id="top1"/>
+ <vertex x="350" y="320" id="top2"/>
+ <vertex x="450" y="320" id="top3"/>
+ <vertex x="550" y="250" id="top4"/>
+ <vertex x="300" y="400" id="mid1"/>
+ <vertex x="500" y="400" id="mid2"/>
+ <vertex x="550" y="500" id="bot1"/>
+
+ <edge v1="top1" v2="top2"/>
+ <edge v1="top2" v2="top3"/>
+ <edge v1="top3" v2="top4"/>
+ <edge v1="top1" v2="top4"/>
+
+ <edge v1="mid1" v2="mid2"/>
+
+ <edge v1="top1" v2="mid1"/>
+ <edge v1="top2" v2="mid1"/>
+ <edge v1="top3" v2="mid2"/>
+ <edge v1="top4" v2="mid2"/>
+
+ <edge v1="top4" v2="bot1"/>
+ <edge v1="mid1" v2="bot1"/>
+</graph>
+<rules>
+ <edge-rule v1="same" v2="same"/>
+
+ <edge-rule v1="red" v2="green"/>
+ <edge-rule v1="red" v2="blue"/>
+
+ <vertex-minimum color="same" min="1"/>
+</rules>
+<values>
+ <var id="points" val="15"/>
+ <var id="objective" val="15"/>
+</values>
diff --git a/assets/levels/vertex-coloring/vertex-coloring.xml b/assets/levels/vertex-coloring/vertex-coloring.xml
new file mode 100644
index 0000000..7cb6cf4
--- /dev/null
+++ b/assets/levels/vertex-coloring/vertex-coloring.xml
@@ -0,0 +1,29 @@
+<level title="Vertex Colorings" description="A vertex coloring is a coloring where no two vertices of the same color are connected." objective="Find a vertex coloring of this graph."/>
+<global-vertex-protections protect="ad"/>
+<global-edge-protections protect="ad"/>
+<colors>
+ <color color="#FF0000" name="red"/>
+ <color color="#00FF00" name="green"/>
+ <color color="#0000FF" name="blue"/>
+</colors>
+<graph>
+ <vertex x="400" y="280" id="top"/>
+ <vertex x="300" y="380" id="top-l"/>
+ <vertex x="500" y="380" id="top-r"/>
+ <vertex x="300" y="530" id="bot-l"/>
+ <vertex x="500" y="530" id="bot-r"/>
+ <edge v1="top" v2="top-l"/>
+ <edge v1="top" v2="top-r"/>
+ <edge v1="top-l" v2="top-r"/>
+ <edge v1="top-l" v2="bot-l"/>
+ <edge v1="top-l" v2="bot-r"/>
+ <edge v1="top-r" v2="bot-r"/>
+ <edge v1="bot-l" v2="bot-r"/>
+</graph>
+<rules>
+ <edge-rule v1="same" v2="same"/>
+</rules>
+<values>
+ <var id="points" val="10"/>
+ <var id="objective" val="10"/>
+</values>