<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">from threading import Thread

#Here, we create 4 threads to parallelize the work of comparing
#fingerprints. To do this, each thread will compare the 1/4 of 
#the arrays. If we give an id = i, 0 &lt;= i &lt; 4, to each thread,
#the ith thread will be responsible for i*3, i*3+1, i*3+2 columns
#and all the rows. This means that we "split" the arrays vertically
#into four parts (0,1,2,3). Thus, the ith thread will compare the ith
#part of "finger_print_cr" with the ith part of "finger_print_s1"
#and the ith part of "finger_print_s2". We, also, have the array
#"match_counter", where each thread saves the counter of the 
#matching pixels. For example, the ith thread saves the number
#of the matching pixels between the ith parts of "finger_print_cr"
#and "finger_print_s1" in the match_counter[i][1] and the number
#of the matching pixels between the ith parts of "finger_print_cr"
#and "finger_print_s2" in the match_counter[i][2]. The parent
#of the threads, after the completion of the threads, will concentrate
#the partial results and it will generate the final matching degrees.

#Notice that the fingerprints and the match_counter can be accessed
#by both the parent and the threads (children), which means that 
#these structures reside at the same memory space!

#Fingerprint of the criminal
finger_print_cr =[	[0, 0, 1, 0, 0, 1, 0, 0, 0 ,1 ,0 ,0], 
					[0, 0, 1, 1, 1, 0, 1, 1, 1 ,0 ,0 ,0], 
					[0, 1, 0, 0, 0, 0, 0, 1, 0 ,1 ,0 ,0],
					[0, 0, 0, 1, 0, 1, 0, 1, 1 ,0 ,1 ,0],
					[0, 0, 1, 0, 1, 0, 0, 1, 0 ,0 ,0 ,0],
					[0, 0, 0, 1, 0, 0, 1, 0, 0 ,1 ,0 ,0]
				]

#Fingerprint of the first suspect
finger_print_s1 =[	[0, 0, 1, 0, 0, 1, 0, 0, 0 ,1 ,0 ,0], 
					[0, 0, 0, 1, 1, 0, 1, 1, 1 ,0 ,0 ,0], 
					[0, 1, 0, 0, 0, 1, 0, 1, 1 ,1 ,1 ,0],
					[0, 0, 1, 1, 0, 1, 0, 1, 1 ,0 ,1 ,0],
					[0, 0, 1, 0, 1, 0, 0, 0, 0 ,0 ,0 ,0],
					[0, 0, 0, 1, 0, 0, 1, 0, 1 ,1 ,0 ,0]
				]

#Fingerprint of the second suspect
finger_print_s2 =[	[0, 0, 1, 0, 0, 1, 0, 0, 0 ,1 ,0 ,0], 
					[0, 0, 0, 1, 1, 0, 1, 0, 1 ,0 ,0 ,0], 
					[0, 1, 1, 0, 0, 1, 0, 1, 1 ,1 ,1 ,0],
					[1, 1, 1, 1, 0, 1, 0, 1, 1 ,0 ,1 ,1],
					[0, 0, 1, 0, 1, 0, 0, 0, 0 ,0 ,0 ,0],
					[0, 0, 0, 1, 0, 0, 1, 0, 1 ,1 ,0 ,0]
				]

#Array with partial matching counters of the threads
match_counter = [[0 for i in range(2)] for j in range(4)]

class Worker(Thread):

    def __init__(self,myid):

        Thread.__init__(self)
        self.myid=myid

    def run(self):
		#Implement me! :)#


###############################################
# I am the parent and I will create 4 threads #
###############################################

#For each thread, which we name it "Worker", we pass as an argument
#a unique id.

w1 = Worker(0)
w2 = Worker(1)
w3 = Worker(2)
w4 = Worker(3)

#Begin the execution of the threads!
w1.start()
w2.start()
w3.start()
w4.start()

#Wait the threads to finish!
w1.join()
w2.join()
w3.join()
w4.join()

#Now, that my children finished calculating, I will calculate
#the final matching degrees.

#Implement me! :)#

#...And I will print the results!

#Implement me! :)#
</pre></body></html>