Finish Boolean concepts

This commit is contained in:
Blizzard Finnegan 2025-03-09 13:57:56 -04:00
parent 369ba8b79d
commit 0d15fc8958
Signed by: blizzardfinnegan
GPG key ID: 61C1E13067E0018E

View file

@ -2,21 +2,21 @@ package annalyn
// CanFastAttack can be executed only when the knight is sleeping.
func CanFastAttack(knightIsAwake bool) bool {
panic("Please implement the CanFastAttack() function")
return !knightIsAwake
}
// CanSpy can be executed if at least one of the characters is awake.
func CanSpy(knightIsAwake, archerIsAwake, prisonerIsAwake bool) bool {
panic("Please implement the CanSpy() function")
return knightIsAwake || archerIsAwake || prisonerIsAwake
}
// CanSignalPrisoner can be executed if the prisoner is awake and the archer is sleeping.
func CanSignalPrisoner(archerIsAwake, prisonerIsAwake bool) bool {
panic("Please implement the CanSignalPrisoner() function")
return !archerIsAwake && prisonerIsAwake
}
// CanFreePrisoner can be executed if the prisoner is awake and the other 2 characters are asleep
// or if Annalyn's pet dog is with her and the archer is sleeping.
func CanFreePrisoner(knightIsAwake, archerIsAwake, prisonerIsAwake, petDogIsPresent bool) bool {
panic("Please implement the CanFreePrisoner() function")
return (prisonerIsAwake && !knightIsAwake && !archerIsAwake) || (petDogIsPresent && !archerIsAwake)
}