Solve csharp/exercises/annalyns-infiltration

This commit is contained in:
Daniel Siepmann 2024-03-26 07:42:32 +01:00
parent dd395435af
commit a0e547b483
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -4,21 +4,30 @@ static class QuestLogic
{
public static bool CanFastAttack(bool knightIsAwake)
{
throw new NotImplementedException("Please implement the (static) QuestLogic.CanFastAttack() method");
return !knightIsAwake;
}
public static bool CanSpy(bool knightIsAwake, bool archerIsAwake, bool prisonerIsAwake)
{
throw new NotImplementedException("Please implement the (static) QuestLogic.CanSpy() method");
return knightIsAwake || archerIsAwake || prisonerIsAwake;
}
public static bool CanSignalPrisoner(bool archerIsAwake, bool prisonerIsAwake)
{
throw new NotImplementedException("Please implement the (static) QuestLogic.CanSignalPrisoner() method");
return !archerIsAwake && prisonerIsAwake;
}
public static bool CanFreePrisoner(bool knightIsAwake, bool archerIsAwake, bool prisonerIsAwake, bool petDogIsPresent)
{
throw new NotImplementedException("Please implement the (static) QuestLogic.CanFreePrisoner() method");
if (petDogIsPresent && !archerIsAwake)
{
return true;
}
if (!petDogIsPresent && !archerIsAwake && !knightIsAwake && prisonerIsAwake)
{
return true;
}
return false;
}
}