Skip to content

Instantly share code, notes, and snippets.

Created January 11, 2013 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4515011 to your computer and use it in GitHub Desktop.
Save anonymous/4515011 to your computer and use it in GitHub Desktop.
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;
}
@tomspilman
Copy link

Ignore the bug on line 40... it didn't affect the test. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment