Game Development Reference
thisRelation.name = theirName
thisRelation.value = howMuch
'Store the relationship.
'A simple Boolean when the caller does not care about magnitude.
Public Function NeedsSome(ByVal need As String) As Boolean
Dim someNeed As NVP = CType(myNeeds(need), NVP)
Return (someNeed.value <= 0)
'Return HOW MUCH they like an activity.
Public Function Likes(ByVal activity As String) As Integer
Dim somePref As NVP = CType(myPreferences(activity), NVP)
The NeedsSome() function is used when computing the relationship score for an
interaction. The third term in the computation was a bonus if both parties had an
unmet need satisfied by the activity. So we need to be able to ask a person if a
particular need was unmet. The other parts of the relationship score need a
person's preference value for an activity, which is provided by the Likes()
The final code for a person handles the various ways outside code interrogates a
person in order to print out results. The simulation will make use of these in
debugging statements that let us see our results. Add the following code to the
Public Function CurrentRelationship(ByVal theirName As String) As Integer
'If we have met them...
If myRelationships.Contains(theirName) Then
Dim rel As NVP = CType(myRelationships(theirName), NVP)
'...then return the value of our relationship.
'Return 0 if we haven't met yet.
'Give back my name and my needs in a compact form.
Public Function ShortDump() As String