What range is used to determine targets for the victim of a Spectator’s Confusion Ray

The Spectator has an Eye Ray option, Confusion Ray, that says:

[The target] uses its action to make a melee or ranged attack against a randomly determined creature within range.

Unlike the spell Confusion which limits the attack to melee attacks, the Spectator’s victim can be compelled to make a ranged attack.

When determining the random target are creatures that are outside of the weapon’s normal range but within the weapon’s long range included?

For a specific example a Rogue with a light crossbow is hit by the ray and fails their save. On their turn there are three allies within 80 ft, and the Spectator is 90 ft away. Is there a chance that the Rogue randomly targets the Spectator?

How do I determine the proper bonuses for my attack and damage rolls? [closed]

I am a half orc monk at level 14. I am using a homebrew gun called the demon of powder, which has 6 charges that it expends instead of regular bullets as ammo. My stats are 14 20 14 8 15 10 in order. in the description of the weapon it says i get +5 to both hit and damage rolls, but on dndbeyond it says i have +6 to hit and 2d8+6 for damage. My DM said that the regular damage for this is 2d8. I’m very confused where dndbeyond is getting the 6s from. Additionally, should i manually add in the +5 to hit from the description or is it already included?

Thanks!

How to determine if a language produced by grammar is recognizable by deterministic pushdown automaton (DPDA)?

I have a following grammar: S -> aSa | bSb | lambda.

And I have to figure out whether the language produced by this grammar is recognizable by DPDA. I can’t find any theoremas about it. Obviously, it’s a context-free language and can be recognized by DPA, but what about DPDA?

Determine whether given f is shortest path function

I have the following question: Let $ G = (V,E)$ be a directed graph with a weight function $ w:E\rightarrow \mathbb{R}^+$ , and let $ s \in V$ be a vertex such that there is a path from $ v$ to every other vertex, i.e $ 0\leq dist(s,v) < \infty$ . Let $ f\colon V \to \mathbb R$ a given function. Describe an algorithm that runs in $ O(|V| + |E|)$ that determines wethter this given $ f$ is the shortest path function from $ s$ , i.e $ \forall v \in V :f(v)=dist(s,v)$ .

What I thought about was to check for every $ v \in V$ whether $ f$ fulfill the two following demands:

  1. $ f(s)=0$
  2. $ f(v) \leq f(u) + w(uv)$ for all $ u \in V$ and $ uv \in E$

This runs in the proper complexity. I thought to prove it by showing that $ f(v) \leq dist(s,v) \land f(v) \geq dist(u,v) \Rightarrow f(v) = dist(f,v)$

I proved that $ f(v) \leq dist(s,v)$ , but I am stuck at proving that $ f(v) \geq dist(s,v)$ .

How to determine the reason for unconsciousness?

Can visual inspection tell the reason a creature is unconscious? Is there a difference between a creature that is sleeping normally, sleeping magically, or unconscious due to dropping to 0 HP? Does a stable creature at 0 HP look or behave different to an unstable one?

This came up in game last night after a character in darkness cast sleep on themself. Another character moved to the unconscious figure. The player said “I shake them awake”. My question was, “How do you know they are sleeping? They might be at 0 HP, in which case wouldn’t the appropriate action be to use Lay on Hands?” The player knew what had happened but all the character knew was that they moved to within darkvision range and saw their friend unmoving on the ground.

How do you determine constraint length,k is small value or large value?

enter image description here

[For small values of k, this is done with a widely used algorithm developed by Viterby(Forney, 1973]

My question is how do they determine k value is considered small or big? What is the threshold value for k? For example, length of this code is 7 and they considered it as small value. How about 10? or how about 20? Are they considered as small value or large value? I’m curious about the threshold value of k.

This is an excerpt from Computer Network Book by Andrew S. Tanenbaum

The data link layer(chapter 3), Page 208, Fifth edition.

Is there an algorithm to determine which face of an n-dimensional hypercube is closest to a given point in $O(n\log(n))$?

Given a point in N-dimensional space, I’d like to be able to determine which face of an N-dimensional hypercube of edge length 1 that the point is closest to.

In the 2-dimensional case it’s fairly trivial, you simply split the square along its diagonals:

if (x < y) then     if (x + y < 0) then         // Side 1     else         // Side 2 else     if (x + y < 0) then         // Side 3     else         // Side 4  

In 3-dimensions, this becomes more complex; each face creates a ‘volume’ of points that are closest to it in the shape of a square based pyramid.

Visualisation of the 6 planes that form the 6 pyramids

Of course, given a point, it’s possible to determine which side of the 6 planes it lands on and using that information you can determine which face of the cube is closest. However this would involve running 6 separate checks.

Moving this into higher dimensions, a similar algorithm can be run on hypercubes, however, as the number of faces on a n-cube is $ 2^{n-2}{n \choose 2}$ , this quickly becomes computationally very expensive.

However, theoretically a perfect algorithm could cut the search space in half with every check, discarding half the faces each time.

This would give this hypothetical algorithm a runtime of $ O(\log_2(2^{n-2}{n \choose 2}))$ which can be simplified, if my rate of growth calculations worked out, to $ O(n\log(n))$

Is my logic correct here; can/does such an algorithm exist?