-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhogwarts.pl
229 lines (213 loc) · 6.99 KB
/
hogwarts.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
male(siriusBlackI).
male(phineasNigellusBlack).
female(ursulaFlint).
marry(phineasNigellusBlack,ursulaFlint).
female(elladoraBlack).
female(ilsaBlack).
marry(ilsaBlack,bobHitchens).
male(bobHitchens).
siblinge(siriusBlackI,phineasNigellusBlack).
siblinge(siriusBlackI,elladoraBlack).
siblinge(siriusBlackI,ilsaBlack).
siblinge(phineasNigellusBlack,elladoraBlack).
siblinge(phineasNigellusBlack,ilsaBlack).
siblinge(ilsaBlack,elladoraBlack).
child(siriusBlackII,phineasNigellusBlack).
child(phineasBlack,phineasNigellusBlack).
child(cygnusBlack,phineasNigellusBlack).
child(arcturusBlack,phineasNigellusBlack).
child(belvinaBlack,phineasNigellusBlack).
child(siriusBlackII,ursulaFlint).
child(phineasBlack,ursulaFlint).
child(cygnusBlack,ursulaFlint).
child(arcturusBlack,ursulaFlint).
child(belvinaBlack,ursulaFlint).
male(siriusBlackII).
male(phineasBlack).
male(cygnusBlack).
male(arcturusBlack).
female(belvinaBlack).
female(hesperGamp).
female(violettaBulstrode).
male(herbertBurke).
female(lysandraYaxley).
marry(siriusBlackII,hesperGamp).
marry(cygnusBlack,violettaBulstrode).
marry(herbertBurke,belvinaBlack).
marry(arcturusBlack,lysandraYaxley).
child(arcturusBlackII,siriusBlackII).
child(lycorisBlack,siriusBlackII).
child(regulusBlack,siriusBlackII).
child(arcturusBlackII,hesperGamp).
child(lycorisBlack,hesperGamp).
child(regulusBlack,hesperGamp).
male(arcturusBlackII).
male(lycorisBlack).
male(regulusBlack).
female(melaniaMacmillan).
marry(regulusBlack,melaniaMacmillan).
child(polluxBlack,cygnusBlack).
child(cassiopeiaBlack,cygnusBlack).
child(mariusBlack,cygnusBlack).
child(doreaBlack,cygnusBlack).
child(polluxBlack,violettaBulstrode).
child(cassiopeiaBlack,violettaBulstrode).
child(mariusBlack,violettaBulstrode).
child(doreaBlack,violettaBulstrode).
male(polluxBlack).
female(cassiopeiaBlack).
female(mariusBlack).
female(doreaBlack).
male(charlusPotter).
female(irmaCrabbe).
marry(doreaBlack,charlusPotter).
marry(irmaCrabbe,polluxBlack).
child(callidoraBlack,arcturusBlack).
child(cadrellaBlack,arcturusBlack).
child(charisBlack,arcturusBlack).
child(callidoraBlack,lysandraYaxley).
child(cadrellaBlack,lysandraYaxley).
child(charisBlack,lysandraYaxley).
female(callidoraBlack).
female(cadrellaBlack).
female(charisBlack).
male(harfangLongbottom).
male(septimusWeasley).
male(casparCrouch).
marry(callidoraBlack,harfangLongbottom).
marry(cadrellaBlack,septimusWeasley).
marry(charisBlack,casparCrouch).
child(lucretiaBlack,arcturusBlackII).
child(orionBlack,arcturusBlackII).
child(lucretiaBlack,melaniaMacmillan).
child(orionBlack,melaniaMacmillan).
child(walburgaBlack,polluxBlack).
child(walburgaBlack,irmaCrabbe).
female(lucretiaBlack).
male(orionBlack).
female(walburgaBlack).
male(ignatiusPrewett).
marry(lucretiaBlack,ignatiusPrewett).
marry(walburgaBlack,orionBlack).
child(alphardBlack,polluxBlack).
child(cygnusBlackII,polluxBlack).
child(alphardBlack,irmaCrabbe).
child(cygnusBlackII,irmaCrabbe).
male(alphardBlack).
male(cygnusBlackII).
female(druellaRosier).
marry(cygnusBlackII,druellaRosier).
child(jamesPotter,charlusPotter).
child(jamesPotter,doreaBlack).
male(jamesPotter).
female(lillyPotter).
marry(jamesPotter,lillyPotter).
male(bartyCrouch).
child(bartyCrouch,casparCrouch).
child(bartyCrouch,charisBlack).
male(bartyCrouchJr).
child(bartyCrouchJr,bartyCrouch).
child(arthurWeasley,septimusWeasley).
child(arthurWeasley,cadrellaBlack).
male(arthurWeasley).
female(mollyWeasley).
marry(arthurWeasley,mollyWeasley).
male(siriusBlackIII).
male(regulusBlackII).
child(siriusBlackIII,orionBlack).
child(siriusBlackIII,walburgaBlack).
child(regulusBlackII,orionBlack).
child(regulusBlackII,walburgaBlack).
child(bellatrixBlack,cygnusBlackII).
child(narcissaBlack,cygnusBlackII).
child(andromedaBlack,cygnusBlackII).
child(bellatrixBlack,druellaRosier).
child(andromedaBlack,druellaRosier).
child(narcissaBlack,druellaRosier).
female(bellatrixBlack).
female(narcissaBlack).
female(andromedaBlack).
male(luciusMalfoy).
male(rudolphusLestrange).
male(tedTonks).
marry(tedTonks,andromedaBlack).
marry(narcissaBlack,luciusMalfoy).
marry(bellatrixBlack,rudolphusLestrange).
child(nymphadoraTonks,andromedaBlack).
child(nymphadoraTonks,tedTonks).
female(nymphadoraTonks).
male(remusLupin).
marry(nymphadoraTonks,remusLupin).
child(billWeasley,arthurWeasley).
child(charlieWeasley,arthurWeasley).
child(percyWeasley,arthurWeasley).
child(fredWeasley,arthurWeasley).
child(georgeWeasley,arthurWeasley).
child(ronWeasley,arthurWeasley).
child(ginnyWeasley,arthurWeasley).
child(billWeasley,mollyWeasley).
child(charlieWeasley,mollyWeasley).
child(percyWeasley,mollyWeasley).
child(fredWeasley,mollyWeasley).
child(georgeWeasley,mollyWeasley).
child(ronWeasley,mollyWeasley).
child(ginnyWeasley,mollyWeasley).
male(billWeasley).
female(fleurDelacour).
marry(billWeasley,fleurDelacour).
male(charlieWeasley).
male(percyWeasley).
male(fredWeasley).
male(georgeWeasley).
male(ronWeasley).
female(ginnyWeasley).
female(hermioneGranger).
marry(ronWeasley,hermioneGranger).
male(harryPotter).
child(harryPotter,jamesPotter).
child(harryPotter,lillyPotter).
marry(ginnyWeasley,harryPotter).
child(dracoMalfoy,luciusMalfoy).
child(dracoMalfoy,narcissaBlack).
male(dracoMalfoy).
equal(X,X).
parent(X,Y) :- child(Y,X).
son(X,Y):- child(X,Y) , male(X).
daughter(X,Y):- child(X,Y) , female(X).
married(X,Y) :- marry(X,Y).
married(X,Y) :- marry(Y,X).
mother(X,Y) :- parent(X,Y), female(X).
father(X,Y) :- parent(X,Y), male(X).
husband(X,Y) :- married(X,Y), male(X).
wife(X,Y) :- married(X,Y),female(X).
brother(X,Y) :- male(X), sibling(X,Y).
sister(X,Y) :- female(X), sibling(X,Y).
halfbrother(X,Y) :- male(X), halfsibling(X,Y).
halfsister(X,Y) :- female(X), halfsibling(X,Y).
stepbrother(X,Y) :- male(X), stepsibling(X,Y).
stepsister(X,Y) :- female(X), stepsibling(X,Y).
stepbrother(X,Y) :- male(X), stepsibling(X,Y).
stepsister(X,Y) :- female(X), stepsibling(X,Y).
ancestor(X,Y) :- parent(X,Y).
ancestor(X,Y) :- parent(X,M), ancestor(M,Y).
inLaws(X,Y) :- parent(X,M),parent(Y,N),not(sibling(X,Y)),not(married(X,Y)), married(M,N).
parentInLaw(X,Y) :- parent(X,M),married(M,Y),not(parent(X,Y)).
fatherInLaw(X,Y) :- male(X), parentInLaw(X,Y).
motherInLaw(X,Y) :- female(X),parentInLaw(X,Y).
daughterInLaw(X,Y) :- female(X), inLaw(Y,X).
sonInLaw(X,Y) :- male(X), inLaw(Y,X).
sibledInLaw(X,Y) :- married(X,M), sibling(M,Y).
siblingInLaw(X,Y) :- sibledInLaw(X,Y).
siblingInLaw(X,Y) :- sibledInLaw(Y,X).
brotherInLaw(X,Y) :- siblingInLaw(X,Y), male(X).
sisterInLaw(X,Y) :- siblingInLaw(X,Y), female(X).
descendant(X,Y) :- ancestor(Y,X).
grandfather(X,Y) :- father(X,M),parent(M,Y).
grandmother(X,Y) :- mother(X,M),parent(M,Y).
sibling(X,Y) :- male(N),parent(N,Y),parent(N,X),parent(M,Y),parent(M,X),not(equal(X,Y)),not(equal(M,N)).
halfsibling(X,Y) :- not(sibling(X,Y)), parent(M,Y),parent(M,X),not(equal(X,Y)).
stepsibling(X,Y) :- not(sibling(X,Y)),not(halfsibling(X,Y)),parent(M,X),parent(N,Y),married(M,N).
stepmother(X,Y) :- parent(M,Y),not(parent(X,Y)), married(M,X).
stepfather(X,Y) :- parent(M,Y),not(parent(X,Y)),married(M,X).
uncle(X,Y) :- male(X),sibling(X,M),parent(M,Y).
aunt(X,Y) :- female(X),sibling(X,M),parent(M,Y).