Responses for exercises in Exercism.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
766 B

using System;
static class QuestLogic
{
public static bool CanFastAttack(bool knightIsAwake)
{
return !knightIsAwake;
}
public static bool CanSpy(bool knightIsAwake, bool archerIsAwake, bool prisonerIsAwake)
{
return knightIsAwake || archerIsAwake || prisonerIsAwake;
}
public static bool CanSignalPrisoner(bool archerIsAwake, bool prisonerIsAwake)
{
return !archerIsAwake && prisonerIsAwake;
}
public static bool CanFreePrisoner(bool knightIsAwake, bool archerIsAwake, bool prisonerIsAwake, bool petDogIsPresent)
{
return !archerIsAwake &&
((!knightIsAwake && (prisonerIsAwake || petDogIsPresent))
|| (knightIsAwake && petDogIsPresent))
;
}
}