TestGames.hs
module TestGames where
import BDDModule
----------------------------------------------------------------------------------------------------
-- BDD aus der Vorlesung, Aufbau: Bottom-Up. Diese Aufbau-Reihenfolge ist wichtig, weil es sich
-- anderenfalls immer nur um vollständige Entscheidungsdiagramme handelt.
bdd :: OBDD
bdd = OBDD left3 1 right3 where
left3 = OBDD left2 2 left2
right3 = OBDD left2 2 right2
left2 = OBDD left1 3 right1
right2 = OBDD right1 3 right1
left1 = OBDD One 4 Zero
right1 = OBDD Zero 4 Zero
-- BDD für x1*x2 bezüglich der Variablenordnung (1, 2).
bddAnd :: OBDD
bddAnd = OBDD left 1 Zero where
left = OBDD One 2 Zero
-- BDD für x1+x2 bezüglich der Variablenordnung (1, 2).
bddOr :: OBDD
bddOr = OBDD One 1 (OBDD One 2 Zero)
-- ROBDD für x1x2 + x3x4 +x5x6 bzgl. der Ordnung (1, 3, 5, 2, 4, 6).
largeBDD :: OBDD
largeBDD = OBDD three1 1 three2 where
three1 = OBDD five1 3 five2
three2 = OBDD five3 3 five4
five1 = OBDD two1 5 two2
five2 = OBDD two3 5 two4
five3 = OBDD four1 5 four2
five4 = OBDD six 5 Zero
two1 = OBDD One 2 four1
two2 = OBDD One 2 four2
two3 = OBDD One 2 six
two4 = OBDD One 2 Zero
four1 = OBDD One 4 six
four2 = OBDD One 4 Zero
six = OBDD One 6 Zero
-- ROBDD für x1x2 + x3x4 +x5x6 bzgl. der Ordnung (1, 2, 3, 4, 5, 6).
smallBDD :: OBDD
smallBDD = OBDD two 1 three where
two = OBDD One 2 three
three = OBDD four 3 five
four = OBDD One 4 five
five = OBDD six 5 Zero
six = OBDD One 6 Zero
----------------------------------------------------------------------------------------------------
danishParliamentWeirdRules :: OBDD
danishParliamentWeirdRules = OBDD two1 1 two2 where
two1 = OBDD three1 2 three2
two2 = OBDD three2 2 three2
three1 = OBDD four1 3 four2
three2 = OBDD four3 3 four3
four1 = OBDD five1 4 five2
four2 = OBDD five2 4 five3
four3 = OBDD five4 4 five4
five1 = OBDD six1 5 six2
five2 = OBDD six2 5 six3
five3 = OBDD six3 5 six4
five4 = OBDD six4 5 six4
six1 = OBDD seven1 6 seven2
six2 = OBDD seven2 6 seven3
six3 = OBDD seven3 6 seven4
six4 = OBDD seven4 6 seven4
seven1 = OBDD eight1 7 eight1
seven2 = OBDD eight1 7 eight2
seven3 = OBDD eight2 7 eight3
seven4 = OBDD eight3 7 eight3
eight1 = OBDD One 8 One
eight2 = OBDD One 8 Zero
eight3 = OBDD Zero 8 Zero
-- ith(2) mit drei Variablen, d. h. Spieler 2 ist ein Diktator.
dictator :: OBDD
dictator = OBDD two 1 two where
two = OBDD three1 2 three2
three1 = OBDD One 3 One
three2 = OBDD Zero 3 Zero
-- Hier sind 3, 4, 5, 6, 7 Vetospieler und 1, 2 belanglos.
vetoers :: OBDD
vetoers = OBDD two 1 two where
two = OBDD three 2 three
three = OBDD four1 3 four2
four1 = OBDD five1 4 five2
four2 = OBDD five2 4 five2
five1 = OBDD six1 5 six2
five2 = OBDD six2 5 six2
six1 = OBDD seven1 6 seven2
six2 = OBDD seven2 6 seven2
seven1 = OBDD One 7 Zero
seven2 = OBDD Zero 7 Zero
-- Keine Diktatoren, aber Spieler 5 (die Grünen) ist ein belangloser Spieler.
germanParliament:: OBDD
germanParliament = OBDD two1 1 two2 where
two1 = OBDD three1 2 three2
two2 = OBDD three3 2 three4
three1 = OBDD four1 3 four1
three2 = OBDD four1 3 four2
three3 = OBDD four2 3 four3
three4 = OBDD four3 3 four3
four1 = OBDD five1 4 five1
four2 = OBDD five1 4 five2
four3 = OBDD five2 4 five2
five1 = OBDD One 5 One
five2 = OBDD Zero 5 Zero
shParliament :: OBDD
shParliament = OBDD two1 1 two2 where
two1 = OBDD three1 2 three2
two2 = OBDD three2 2 three3
three1 = OBDD four1 3 four1
three2 = OBDD four2 3 four3
three3 = OBDD four4 3 four4
four1 = OBDD five1 4 five1
four2 = OBDD five1 4 five2
four3 = OBDD five3 4 five4
four4 = OBDD five4 4 five4
five1 = OBDD six1 5 six1
five2 = OBDD six1 5 six2
five3 = OBDD six2 5 six3
five4 = OBDD six3 5 six3
six1 = OBDD One 6 One
six2 = OBDD One 6 Zero
six3 = OBDD Zero 6 Zero