Skip to content

Instantly share code, notes, and snippets.

@filipearray
Last active May 11, 2024 02:00
Show Gist options
  • Save filipearray/3b887803ac3596a424353ea6fb0ff398 to your computer and use it in GitHub Desktop.
Save filipearray/3b887803ac3596a424353ea6fb0ff398 to your computer and use it in GitHub Desktop.
Annalyn's Infiltration
package annalyn
// CanFastAttack can be executed only when the knight is sleeping.
func CanFastAttack(knightIsAwake bool) bool {
canFastAttack := !knightIsAwake
return canFastAttack
panic("Please implement the CanFastAttack() function")
}
// CanSpy can be executed if at least one of the characters is awake.
func CanSpy(knightIsAwake, archerIsAwake, prisonerIsAwake bool) bool {
canSpy := knightIsAwake || archerIsAwake || prisonerIsAwake
return canSpy
panic("Please implement the CanSpy() function")
}
// CanSignalPrisoner can be executed if the prisoner is awake and the archer is sleeping.
func CanSignalPrisoner(archerIsAwake, prisonerIsAwake bool) bool {
canSignalPrisoner := !archerIsAwake && prisonerIsAwake
return canSignalPrisoner
panic("Please implement the CanSignalPrisoner() function")
}
// 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 {
canFreePrisoner := petDogIsPresent && !archerIsAwake || prisonerIsAwake && !knightIsAwake && !archerIsAwake
return canFreePrisoner
panic("Please implement the CanFreePrisoner() function")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment