-
Notifications
You must be signed in to change notification settings - Fork 546
Expand file tree
/
Copy pathnetflix_buddy.py
More file actions
40 lines (32 loc) · 1.66 KB
/
netflix_buddy.py
File metadata and controls
40 lines (32 loc) · 1.66 KB
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
from nada_dsl import *
def nada_main():
party1 = Party(name="Party1")
party2 = Party(name="Party2")
dramaP1 = SecretInteger(Input(name="DramaP1", party=party1))
actionP1 = SecretInteger(Input(name="ActionP1", party=party1))
horrorP1 = SecretInteger(Input(name="HorrorP1", party=party1))
romanceP1 = SecretInteger(Input(name="RomanceP1", party=party1))
thrillerP1 = SecretInteger(Input(name="ThrillerP1", party=party1))
comedyP1 = SecretInteger(Input(name="ComedyP1", party=party1))
dramaP2 = SecretInteger(Input(name="DramaP2", party=party2))
actionP2 = SecretInteger(Input(name="ActionP2", party=party2))
horrorP2 = SecretInteger(Input(name="HorrorP2", party=party2))
romanceP2 = SecretInteger(Input(name="RomanceP2", party=party2))
thrillerP2 = SecretInteger(Input(name="ThrillerP2", party=party2))
comedyP2 = SecretInteger(Input(name="ComedyP2", party=party2))
div = Integer(0)
ans = Integer(0)
u1 = [dramaP1, actionP1, horrorP1, romanceP1, thrillerP1, comedyP1]
u2 = [dramaP2, actionP2, horrorP2, romanceP2, thrillerP2, comedyP2]
#checks the difference between choice and calculates the score
for x in range(6):
t = u1[x] - u2[x]
if t < Integer(0):
t = t * Integer(-1)
ans = ans + t
if u1[x] > Integer(0) or u2[x] > Integer(0):
div = div + Integer(5)
# using finite field method to divide the ans and calculate percentage
inverse_mod = (div ** (Integer(29))) % Integer(31)
result = Integer(100) - ((ans * Integer(7) * inverse_mod) % Integer(31))
return [Output(result, "buddy_score", party1), Output(result, "buddy_score", party2)]