Code -
The Implementation
Below is the code that was generated from extracting the heuristics from the Field case
and mapping them to an interactive visualizer.
Sub CalculateScore()
Dim Factor1 As Decimal = 0
Dim Factor1_Weight As Decimal = 0.35
Dim SubFactor1_Use As Decimal = 0
Dim SubFactor1_Purpose As Decimal = 0
Dim SubFactor1_Transform As Decimal = 0
Dim Factor2 As Decimal = 0
Dim Factor2_Weight As Decimal = 0.1
Dim Factor3 As Decimal = 0
Dim Factor3_Weight As Decimal = 0.1
Dim SubFactor3_Taken As Decimal = 0
Dim SubFactor3_Quality As Decimal = 0
Dim SubFactor3_Ratio As Decimal = 0
Dim Factor4 As Decimal = 0
Dim Factor4_Weight As Decimal = 0.35
Dim SubFactor4_Original As Decimal = 0
Dim SubFactor4_Derivative As Decimal = 0
Dim Factor5 As Decimal = 0
Dim Factor5_Weight As Decimal = 0.1
Dim myScore As Decimal = 0
'----------------------------------------------------------
' Factor 1 - Purpose and Character of Use
'----------------------------------------------------------
' Factor 1 - Use
SubFactor1_Use = getData(SubFactor1_Use)
' Factor 1 - Purpose
Dim li As ListItem
For Each li In getData(SubFactor1_Purpose)
If li.Selected = True Then
SubFactor1_Purpose += 1
End If
Next
If SubFactor1_Purpose > 0 Then
SubFactor1_Purpose = 72 + ((SubFactor1_Purpose - 1) * 4)
End If
' Factor 1 - Transformation
SubFactor1_Transform = getData(SubFactor1_Transform)
' Normalize Factor1
If SubFactor1_Transform > 50 Then
SubFactor1_Use += 1
SubFactor1_Use *= 2
If SubFactor1_Use > 100 Then
SubFactor1_Use = 100
End If
End If
Factor1 = (SubFactor1_Use + SubFactor1_Purpose + SubFactor1_Transform) / 3
'----------------------------------------------------------
' Factor 2 - Nature of Copyrighted Works (Worthiness)
'----------------------------------------------------------
Factor2 = getData(Factor2)
'----------------------------------------------------------
' Factor 3 - Amount and Substantiality of Use
'----------------------------------------------------------
SubFactor3_Taken = getData(SubFactor3_Taken)
SubFactor3_Quality = getData(SubFactor3_Quality)
SubFactor3_Ratio = getData(SubFactor3_Ratio)
'Normalize Factor3
If SubFactor1_Transform > 50 Then
SubFactor3_Taken += 1
SubFactor3_Ratio += 1
SubFactor3_Taken *= 2
SubFactor3_Ratio *= 2
If SubFactor3_Taken > 100 Then
SubFactor3_Taken = 100
End If
If SubFactor3_Ratio > 100 Then
SubFactor3_Ratio = 100
End If
End If
Factor3 = (SubFactor3_Taken + SubFactor3_Quality + SubFactor3_Ratio) / 3
'----------------------------------------------------------
' Factor 4 - The Effect of the Use upon the Potential Market
'----------------------------------------------------------
SubFactor4_Original = getData(SubFactor4_Original)
SubFactor4_Derivative = getData(SubFactor4_Derivative)
' Normalize Factor4
Factor4 = (SubFactor4_Original + SubFactor4_Derivative) / 2
'----------------------------------------------------------
' Factor 5 - Bonus Points for Good Faith
'----------------------------------------------------------
Factor5 = getData(Factor5)
'----------------------------------------------------------
' run the Transformation transformation
'----------------------------------------------------------
If SubFactor1_Transform > 50 Then
If SubFactor1_Transform > 90 Then
SubFactor1_Transform = 90
End If
Factor1_Weight += (SubFactor1_Transform - 50) / 100
Factor2_Weight -= ((SubFactor1_Transform - 50) / 100) / 3
Factor3_Weight -= ((SubFactor1_Transform - 50) / 100) / 3
Factor4_Weight -= ((SubFactor1_Transform - 50) / 100) / 3
End If
myScore = (Factor1 * Factor1_Weight) +
(Factor2 * Factor2_Weight) +
(Factor3 * Factor3_Weight) +
(Factor4 * Factor4_Weight) +
(Factor5 * Factor5_Weight)
End Sub