Indiana Jones and the Raiders of the Lost Ark

void RetrieveGoldenIdol()
{
    while(true)
    {
        float dif = bag.Weight - indy.CalculateApproxWeight(idol);
        // 200g of margin should be enough.
        if(dif < -100) bag.AddSand(rand.Next(100, -dif));
        else if(dif > 100) bag.RemoveSand(rand.Next(100, dif));
        else break;
    }

    Swap(bag, idol);
    DeployTraps();

    indy.Run();
}
Vote up this code1