Find package for implementing "policies"

I am looking for a package implementing “policies”. I found one with this name exactly,
but it seems not ideal, was not updated since 2015.

The general idea: there is a collection of items, each item has a “status”,
say a list of variables, and a number of “actions” on it is available; these
actions are attemped by an “agent” addressing one item at one time, and they are
either accepted or refused according to the status of the item addressed
and of other items too. If accepted, they may change the status of all items
involved, the addressed one and the others involved in the decision process.

One silly example is an old solitaire game of cards: N cards forming N/2 companion
pairs are disposed face down, and the “agent” tries to find pairs by flipping cards,
one at a time. The “status” has 3 components: [card value, face-up or down, frozen].
The “agent” flips card 1 face-up (unless it’s “frozen”), then card 2: if its value is equal to card 1’s value, they both become “frozen” and face-up. If not, card 1 (was facing up) is flipped back to face-down.
I could probably code something myself, but am sure something useful should already
exist. Thank you for any ideas or suggestion.

Do you mean that you want to search a “game tree” of possible sequences of actions?

Not only for games.
I am thinking more of a collection of distinct entities, and of a set of actions changing
their states, if allowed by a policy, that is, a set of rules based on a subset of these entities.

Also, all actions are considered one at a time and are independent, so I don’t see a “tree” here.
Maybe in the policies, if the (yes/no) result is governed by a series of “if’s”,
but that’s not my main point, I guess.

My main point is that the yes/no answers (one for each policy-type), based on the inner
(composite) state of a subset of the entities, will impact (if the answer ias positive)
the inner states of another subset, overlapping the subsets of others.

“Mother says: if you are not good, I will punish you”
“Teacher says: if two of you in a same bench I find playing hangman, I will punish the whole class”
“Factory manager says: if at least 3 departments next month improve production, I will increase my own salary”
etc. etc.