From 4f8e0649ebfa6f7ed322d4c1d79db52183e4171a Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:32:18 +0000 Subject: [PATCH] [Sync Iteration] go/annalyns-infiltration/1 --- .../1/annalyns_infiltration.go | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 solutions/go/annalyns-infiltration/1/annalyns_infiltration.go diff --git a/solutions/go/annalyns-infiltration/1/annalyns_infiltration.go b/solutions/go/annalyns-infiltration/1/annalyns_infiltration.go new file mode 100644 index 0000000..71a7dc2 --- /dev/null +++ b/solutions/go/annalyns-infiltration/1/annalyns_infiltration.go @@ -0,0 +1,22 @@ +package annalyn + +// CanFastAttack can be executed only when the knight is sleeping. +func CanFastAttack(knightIsAwake bool) bool { + return !knightIsAwake +} + +// CanSpy can be executed if at least one of the characters is awake. +func CanSpy(knightIsAwake, archerIsAwake, prisonerIsAwake bool) bool { + return knightIsAwake || archerIsAwake || prisonerIsAwake +} + +// CanSignalPrisoner can be executed if the prisoner is awake and the archer is sleeping. +func CanSignalPrisoner(archerIsAwake, prisonerIsAwake bool) bool { + 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 { + return !knightIsAwake && !archerIsAwake && prisonerIsAwake || petDogIsPresent && !archerIsAwake +}