Created
January 11, 2013 23:53
-
-
Save anonymous/4515011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async void Think() | |
{ | |
Loop: | |
Program.MineCycles++; | |
Say("Walking to the mine!"); | |
await this.WaitSeconds(2.0f); | |
Say("Entering the mine!"); | |
await this.WaitSeconds(1.0f); | |
// YUCK! | |
var random = _injector.Resolve<Random>(); | |
while (_fatigue < 6) | |
{ | |
await this.WaitSeconds(3.0f); | |
++_fatigue; | |
if (random.NextDouble() < 0.2) | |
{ | |
++_goldCarried; | |
Say("Got {0} nuggets!", _goldCarried); | |
} | |
} | |
Say("Exiting the mine with {0} nuggets!", _goldCarried); | |
await this.WaitSeconds(1.0f); | |
Say("Walking home!"); | |
await this.WaitSeconds(3.0f); | |
Say("Back at the shack!"); | |
await this.WaitSeconds(2.0f); | |
Say("Dumping {0} nuggets!", _goldCarried); | |
await this.WaitSeconds(1.0f); | |
_goldCarried = 0; | |
if (_fatigue <= 0) | |
return; | |
Say("Going to sleep!"); | |
await this.WaitSeconds(2.0f); | |
while (_fatigue > 0) | |
{ | |
Say("ZZZZZZZ..."); | |
await this.WaitSeconds(1.0f); | |
_fatigue--; | |
} | |
Say("Waking up!"); | |
await GetReady(); | |
Say("Getting ready to mine!"); | |
await this.WaitSeconds(2.0f); | |
goto Loop; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ignore the bug on line 40... it didn't affect the test. ;)