begin %police%

Contains(Street, x, y) :-
	Street = "Vine",
	x >= -50, x <= -48,
	y >= -80,
	y <= 40.
Contains(Street, x, y) :-
	Street = "Oak",
	x >= 10, x <= 12,
	y >= -80,
	y <= 20.
Contains(Street, x, y) :-
	Street = "Maple",
	y >= -51, y <= -49,
	x >= -30,
	x <= 100.
Contains(Street, x, y) :-
	Street = "Willow",
	y >= 90, y <= 92,
	x >= -60,
	x <= 100.
Contains(Street, x, y) :-
	Street = "Bear",
	x >=-80,
	x <= 70,
	3y - x >= 110, 3y - x <= 114.
Contains(Street, x, y) :-
	Street = "Hare",
	y >= 10,
	y <= 100,
	y + 2x >= -11, y + 2x <= -8.


Resident(Name, No, Street) :- 
	Name = "David",
	No = "1000",
	Street = "Vine".
Resident(Name, No, Street) :- 
	Name = "Joe",
	No = "2000",
	Street = "Maple".
Resident(Name, No, Street) :- 
	Name = "Mary",
	No = "3000",
	Street = "Maple".
Resident(Name, No, Street) :- 
	Name = "Bob",
	No = "1000",
	Street = "Maple".
Resident(Name, No, Street) :- 
	Name = "Carl",
	No = "4000",
	Street = "Oak".
Resident(Name, No, Street) :- 
	Name = "Greg",
	No = "1000",
	Street = "Willow".
Resident(Name, No, Street) :- 
	Name = "Han",
	No = "2000",
	Street = "Bear".
Resident(Name, No, Street) :- 
	Name = "Fred",
	No = "5000",
	Street = "Hare".
Resident(Name, No, Street) :- 
	Name = "Charles",
	No = "2000",
	Street = "Vine".
Resident(Name, No, Street) :- 
	Name = "Davis",
	No = "3000",
	Street = "Bear".


Emergency(Type, No, Street, T) :- 
	Type = "Fire",
	No = "1000",
	Street = "Vine",
	T = 5.
Emergency(Type, No, Street, T) :- 
	Type = "Fire",
	No = "2000",
	Street = "Maple",
	T = 6.
Emergency(Type, No, Street, T) :- 
	Type = "Sick",
	No = "3000",
	Street = "Maple",
	T = 20.
Emergency(Type, No, Street, T) :- 
	Type = "Theft",
	No = "1000",
	Street = "Maple",
	T = 38.
Emergency(Type, No, Street, T) :- 
	Type = "Fire",
	No = "4000",
	Street = "Oak",
	T = 49.
Emergency(Type, No, Street, T) :- 
	Type = "Theft",
	No = "1000",
	Street = "Willow",
	T = 36.
Emergency(Type, No, Street, T) :- 
	Type = "Sick",
	No = "2000",
	Street = "Bear",
	T = 42.
Emergency(Type, No, Street, T) :- 
	Type = "Violant",
	No = "5000",
	Street = "Hare",
	T = 20.

Location(No, Street, x, y) :- 
	No = "1000",
	Street = "Vine",
	x >= -50, x<=-45,
	y >= -65, y<=-55.
Location(No, Street, x, y) :- 
	No = "2000",
	Street = "Vine",
	x >= -58, x<=-50,
	y >= -20, y<=-5.
Location(No, Street, x, y) :- 
	No = "2000",
	Street = "Maple",
	x >= -15, x<=-5,
	y >= -55, y<=-50.
Location(No, Street, x, y) :- 
	No = "3000",
	Street = "Maple",
	x >= 60, x<=75,
	y >= -50, y<=-45.
Location(No, Street, x, y) :- 
	No = "1000",
	Street = "Maple",
	x >= 85, x<=95,
	y >= -55, y<=-50.
Location(No, Street, x, y) :- 
	No = "4000",
	Street = "Oak",
	x >= 10, x<=15,
	y >= -45, y<=-30.
Location(No, Street, x, y) :- 
	No = "1000",
	Street = "Willow",
	x >= 5, x<=15, 
	y >= 80, y<=90.
Location(No, Street, x, y) :- 
	No = "2000",
	Street = "Bear",
	x >= 15, x<=25, y<=50,
	3y - x >= 110.
Location(No, Street, x, y) :- 
	No = "3000",
	Street = "Bear",
	x >= -40, x<=-30, y>=15,
	3y - x <= 110.
Location(No, Street, x, y) :- 
	No = "5000",
	Street = "Hare",
	x<=-30, y >= 65, y<=75,
	y + 2x >= -10.

Police(Name, VIN, x, y, T) :-
	Name = "Charles",
	VIN = "1001",
	x >= -50, x<=-48,
	y - 5T >= -80,
	y - 5T <= -76,
	T >= 0,
	T <= 20.
Police(Name, VIN, x, y, T) :-
	Name = "Charles",
	VIN = "1001",
	x >= -52, x<=-50,
	y + 5T >= 320,
	y + 5T <= 324,
	T > 60,
	T <= 80.
Police(Name, VIN, x, y, T) :-
	Name = "Charles",
	VIN = "1001",
	x - 4T >= -130, x - 4T <= -126,
	3y - x >= 110, 3y - x <= 128,
	T > 20,
	T <= 40.
Police(Name, VIN, x, y, T) :-
	Name = "Charles",
	VIN = "1001",
	x + 4T >= 180, x + 4T <= 184,
	3y - x >= 102, 3y - x <= 110,
	T > 40,
	T <= 60.

Police(Name, VIN, x, y, T) :-
	Name = "Davis",
	VIN = "1002",
	y >= 90, y <= 92,
	x - 5T >= -50, x - 5T <= -46,
	T >= 0,
	T <= 20.
Police(Name, VIN, x, y, T) :-
	Name = "Davis",
	VIN = "1002",
	y >= 88, y <= 90,
	x + 5T >= 150, x + 5T <= 154,
	T > 20,
	T <= 40.
Police(Name, VIN, x, y, T) :-
	Name = "Davis",
	VIN = "1002",
	y + 4T >=250 , y + 4T <= 254,
	y + 2x >= -10, y + 2x <= -2, 
	T > 40,
	T <= 60.
Police(Name, VIN, x, y, T) :-
	Name = "Davis",
	VIN = "1002",
	y - 4T >= -230 , y - 4T <= -226,
	y + 2x >= -18, y + 2x <= -10, 
	T > 60,
	T <= 80.

Contains2(Street, x, y) :-
	Street = 1,
	x >= -50, x <= -48,
	y >= -80,
	y <= 40.
Contains2(Street, x, y) :-
	Street = 2,
	x >= 10, x <= 12,
	y >= -80,
	y <= 20.
Contains2(Street, x, y) :-
	Street = 3,
	y >= -51, y <= -49,
	x >= -30,
	x <= 100.
Contains2(Street, x, y) :-
	Street = 4,
	y >= 90, y <= 92,
	x >= -60,
	x <= 100.
Contains2(Street, x, y) :-
	Street = 5,
	x >=-80,
	x <= 70,
	3y - x >= 110, 3y - x <= 114.
Contains2(Street, x, y) :-
	Street = 6,
	y >= 10,
	y <= 100,
	y + 2x >= -11, y + 2x <= -8.

Townmap(id, x, y) :-
	Contains(id, x, y).

Townmap(id, x, y) :-
	id=1,
	Location(No, Street, x, y).


end %police%