-
Notifications
You must be signed in to change notification settings - Fork 11
/
rules.py
32 lines (25 loc) · 1011 Bytes
/
rules.py
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
list_of_rules = ["color_equal", "position_equal", "size_equal"]
def color_equal(obj1_colors, obj2_colors):
"""
checks if the two objects passed are the same color
the reason why we pass in a list of colors for each object instead of just 1 color:
in future implementation there will be objects that are multi-colored
:param obj1_colors: list of colors from object 1
:param obj2_colors: list of colors from object 2
"""
return obj1_colors == obj2_colors
def position_equal(obj1_pixels, obj2_pixels):
"""
checks if two objects have the same position
:param obj1_pixels: list of pixel coordinates from object 1 (unsorted)
:param obj2_pixels: list of pixel coordinates from object 2 (unsorted)
:return:
"""
return obj1_pixels == obj2_pixels
def size_equal(obj1_size, obj2_size):
"""
checks if the two objects have the same size
:param obj1_size: size of obj1
:param obj2_size: size of obj2
"""
return obj1_size == obj2_size