Game Development Reference
In-Depth Information
'Do bankruptcy here.
If cash < 0 Then
Debug.WriteLine("Bankruptcy")
cash = 0
End If
'Pay living expenses (free if you are broke or almost broke).
expense = 0.0
If cash > 500 Then
'Rich people spend 2.5 days' wages a day on expenses.
expense = 2.5
Else
If cash >= 1 Then
'Regular people spend 25% of a day's wage to live.
expense = 0.25
Else
If cash >= 0.1 Then
'Poor people have expenses too.
expense = 0.025
End If
End If
End If
living += expense
cash -= expense
Next
'Print results of last job.
Say(name & " spent " & daysInJob.ToString & " with job " & _
curJobName & " ending with $" & _
Format(cash, "#,##0.00") & " from $" & _
Format(wins, "#,##0.00") & " gains less (" & _
Format(losses, "#,##0.00") & "+"&_
Format(costs, "#,##0.00") & _
" + " & Format(living, "#,##0.00") & _
") in losses+costs+expenses.")
End Sub
All we need now is the code to tie the user interface to the simulation. Get to the
EddyButton's Click event handler and add the following line of code:
RunSim("Eddy", New Eddy)
We are ready to debug! Run the code and click the Eddy button a few times to see
how he does. He should work steadily toward becoming a Financier, though it
 
Search Nedrilad ::




Custom Search