c# – Breadth first event synchronization based on a frequency or time series

I have an interesting and problem I’m facing. I’m trying to maintain a set of metrics independently based off of a time frequency.

Note: This is a simplification of the problem I’ve omitted pieces of the code the remain brief
I have a simple architecture which looks like so:

public interface INode<TIn, TOut> : IBaseNode
{
    event EventHandler<TOut> Output; 
    void Subscribe(IBaseNode node);
    void OnInput(object sender, TIn input)
}

I have a bunch of nodes which independently subscribe to pieces of data they want to track which can be depicted as so:

enter image description here

All of the events are fired from a parent node in a Breadth First Manner. So the nodes that are further away from the original event will fire after, which means that the Nodes that are further away from the originating node will take longer to fire since they are dependent on the nodes before them provide output. Additionally, since new nodes are coming in, some nodes may fire multiple times before reach other nodes in the chain of events.

I’m looking for a strategy to keep these relatively in sync. Based off their frequency. e.g If the frequency is 3 requests per 1000ms I would like to be sure that All of the PriceMA and the Volume MA values are processed for that specific time frame before doing additional calculations

My intuition say that this should be solved relatively easy by added a Synchronization Node at the end which waits for all subscribed nodes to be complete based off of some requestId e.g:

enter image description here

However seeing as I’ve never done this before, I’m not sure that’s the best strategy, since I want all events which occur within a specific time frame to be processed prior to chains in other time frames.

What is a relatively reliable strategy for handling breadth first synchronization of events?

gm techniques – How do I respond to a player’s criticism that the breadth of feats available in Pathfinder 2e is by its nature restrictive?

Not sure how better to phrase the title. Let me explain.

I recently migrated a 5e campaign across to PF2e. One player has been resistant to this move. As an example, he asked how a character might perform a Feint-like action, but making the target flat-footed to an ally, rather than themselves. I referred him to Distracting Performance, which he said wasn’t what he meant, but we reached a point in the conversation where he made the following claim:

For every feat that says “you can do this thing”, that inherently means “if you don’t have this feat, you can’t”.

In other words, the breadth of character choices is actually restrictive.

So for instance, a character without Distracting Performance in principle has no way by which to get an enemy’s attention. This appears to be his main gripe with PF2e as a system, as he sees 5e as flexible enough that a DM can ‘just sorta make it up on the spot as necessary’.

I don’t believe that a system is superior because it’s easier to fill in gaps in the system ad-hoc. I know there’s creating actions, as a route for DMs to create new actions on the fly, but this is different to a character attempting something that’s already outlined, but behind a feat wall, so to speak. I understand his point – a character shouldn’t be blocked entirely from trying to grab a creature’s attention, just because they haven’t taken the feat.

So I think the root of my question is how to handle a character attempting an action or set of actions that’s facilitated by a particular feat (such as in the case of Distracting Performance), without having that feat, but also without drastically devaluing the feat.

RAW, is it a straight “no, the character cannot do that until they have the feat”? Or is there leeway in the system for “a character can attempt it, but the DC is then modified to hard / very hard (+2 / +5)?”

go – Breadth first search of a binary-tree with channels

As an exercise in using channels in Go I implemented a breadth-first traversal of a binary tree, using a channel as a queue to store the order of the nodes to traverse. After ironing out a bunch of bugs related to all goroutines sleeping I ended up with this code:

package main

import "fmt"

type Node struct {
    Value int
    Left  *Node
    Right *Node
}

var tree *Node

func init() {
    tree = &Node{1, &Node{2, &Node{4, &Node{6, nil, nil}, nil}, &Node{5, nil, &Node{7, nil, nil}}}, &Node{3, nil, nil}}
}

func (t *Node) BFS() {
    c := make(chan *Node, 512)
    c <- t
    bfs(c)
    close(c)
}

func bfs(c chan *Node) {
    empty := false
    for {
        select {
        case next := <-c:
            if next != nil {
                c <- next.Left
                c <- next.Right
                fmt.Println(next.Value)
            }
        default:
            empty = true
        }
        if empty {
            break
        }
    }
}

func main() {
    tree.BFS()
}

While I appreciate advice on any part of the code, I am specifically concerned about the tight for loop in the body of bfs(), the not particularly safe-for-concurrency code and other possible issues mentioned in this question on stackoverflow.