Game Development Reference
In-Depth Information
everyone is always hungry, they will always enjoy eating together. If we allow
extreme ranges in the starting values, some of the people will be quite single-
minded for the first part of the simulation, and it will take longer for the true
long-term trends to emerge. If we do not allow somewhat extreme values, our
people will lack interesting diversity.
Preferences are also tunable. Because preference values will be added sometimes
and multiplied other times, the range is important. Increasing the range of
preference values makes strong preferences more dominant in the relationship
score. The code for a range of 3to รพ 3 is given as comments. Running the
simulation with the wider range is left as an exercise, but it is well worth doing. So
far, our simulation has three tuning knobs to adjust, and it is a good experience
for AI programmers to try their hand at tuning a simulation.
The cruise director needs the database to pick an activity and to give the list of
activities. We will add that code now to finish up the database. Add the following
to the MiniDB class:
'Get a random activity for this need.
Public Function ActivityForNeed(ByVal Satisfies As String) As String
'Find the collection of activities for this need.
If ToDo.Contains(Satisfies) Then
'We have a collection for this need, get access to it.
Dim category As Collection = CType(ToDo.Item(Satisfies), Collection)
'Pick a random item.
Dim i As Integer = getDx(category.Count)
'The lower-level collection holds activity names (strings).
Return CStr(category(i))
Debug.WriteLine("Error: MiniDB unable to meet need " & Satisfies)
Return ""
End If
End Function
'What is the master list of activities?
Public Function ActivityList() As Collection
'Give them a copy of our list instead of our actual list.
Dim alist As New Collection
Dim activity As String
'Copy from our list to theirs.
For Each activity In ActivityNames
alist.Add(activity, activity)
Search Nedrilad ::

Custom Search