-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLineCritic.py
28 lines (20 loc) · 911 Bytes
/
LineCritic.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
import numpy as np
from Critic import Critic
class LineCritic(Critic):
def __init__(self):
pass
def critique(self, lvl):
#Returns a score between 0-1 based on the particular critics scope
while len(lvl.height_line) < len(lvl.song.height_notes):
lvl.height_line = [0] + lvl.height_line
array1 = np.array(lvl.height_line)
array2 = np.array(lvl.song.height_notes)
subtracted_array = np.subtract(array1, array2)
subtracted = list(subtracted_array)
#Find theoretical max difference between height notes and opposite
array3 = lvl.max_height - array2
subtracted_array_max = np.subtract(array3, array2)
subtracted_max = list(subtracted_array_max)
return 1-(np.sum(np.square(subtracted))/np.sum(np.square(subtracted_max))) #sum Squared difference
def print(self):
print("LINE CRITIC")