Skip to content

Instantly share code, notes, and snippets.

@joladev
Forked from anonymous/gist:5933010
Last active December 19, 2015 09:29
Show Gist options
  • Save joladev/5933011 to your computer and use it in GitHub Desktop.
Save joladev/5933011 to your computer and use it in GitHub Desktop.
public int LostTrainees(int a, int b, int c)
{
int lives = 3;
int doorsOpened = 0;
while (true)
{
var result = OpenDoor(b);
var weapon = GetWeapon();
switch (result)
{
case "Blue Monster":
if (!weapon.Equals("Bow"))
{
lives--;
doorsOpened--;
}
break;
case "Red Monster":
if (!weapon.Equals("Sword"))
{
lives--;
doorsOpened--;
}
break;
case "Yellow Monster":
if (!weapon.Equals("Slingshot"))
{
lives--;
doorsOpened--;
}
break;
case "Bunny":
{
lives--;
doorsOpened--;
}
break;
}
doorsOpened++;
if (lives == 0)
return doorsOpened;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment