list manipulation – Replace points on a grid with numbers to maintain order

I am DMing a game of DnD and one of my players is really into fear effects, which is cool, but the effect of having monsters suffer from the “panicked” condition gets tedious to render via dice rolls.

The rule is, on the battle grid the monster will run for 1 square in a random direction, then from that new position it will move into another random adjacent square. repeat this process until its moved its full move speed.

movespeed = 6;
points = Point(
   NestList({(#((1)) + RandomChoice({-1, 0, 1})), #((2)) + 
       RandomChoice({-1, 0, 1})} &, {11/2, 11/2}, movespeed));
Graphics({PointSize(Large), points}, 
 GridLines -> {Range(0, 11), Range(0, 11)}, 
 PlotRange -> {{0, 11}, {0, 11}}, Axes -> True)

I have written some code that shows me the squares the monster moves through, but I would love to replace the little black dots with numbers like “1”, “2”,…,”6″ so that I know the path it actually took.

How does looting treasures worth legend points work?

How does looting treasures worth legend points work? – Role-playing Games Stack Exchange

anydice – How can I calculate expected Stunt Points per attack when FIRST dropping a d6?

Here’s an example anydice function which calculates this kind of result:

function: stunt DICE:s STUNT:n DC:n {
  if 1@DICE + 2@DICE + STUNT < DC {
    result: 0
  }
  loop X over {1..#DICE-1}{
    if (X@DICE = (X+1)@DICE | X@DICE = STUNT | (X+1)@DICE = STUNT) & X@DICE + (X+1)@DICE + STUNT >= DC { result: STUNT }
  }
  result: 0
}

Let’s walk through it.

We invoke the function by calling (stunt Xd6 1d6 DC), where Xd6 is our dice pool, the other 1d6 is our stunt die, and DC is the target we need to roll on the dice. When the function runs, the rolled dice pool will be cast to a sequence, which anydice will helpfully automatically sort from highest to lowest.

The first if statement in the function checks to see whether the roll can possibly succeed – we take the two highest dice from the dice pool and the stunt die and see if they are less than the target number. If so, we immediately return 0 as it not possible to succeed on the roll.

Then we start iterating over the pool using a loop in order to check for any doubles, starting with the first two dice. If any two of the two dice under consideration and the stunt die are equal to each other, and the total of those two dice and the stunt die is enough to beat the target DC, the test has succeeded with stunt points – we return the value of the stunt die.

We know that any two dice in the sequence must be adjacent to each other in order to have a chance of being doubles, because the sequence has been sorted already, so don’t need to exhaustively check every possible combination from the sequence – stepping along it in adjacent pairs, using X@DICE and (X+1)@DICE, is good enough.

Otherwise, if we get all the way through the dice pool without finding any doubles that also beat the target DC, we return 0 to indicate the test has succeeded with no stunt points.

Here’s a screencap of some sample output from the function:

Tables of anydice output for pools from 2d6 to 5d6

Interesting modifications to make to the function might be to return -1 instead of 0 if the test fails, which will show you a distribution which indicates both the likelihood of a specific number of stunt points and the likelihood of passing at all (though it will skew the averages), or to return d{} (the “empty die”) to produce a distribution ignoring rolls that fail (i.e. how many stunt points are we likely to get if we succeed?).

cortex prime – Can a player character avoid dying as long as they still have Plot Points?

I’ve read Cortex Prime and now I’m wondering whether a PC could die. The rule said that “you can spend a PP to avoid being taken out of the scene” (which I translate as dying).

Does this mean that as long as a player still has PP, they can’t die if they don’t wish so?

Connecting common points on a map

I work with a private preschool – 12th-grade school. The school has several campuses. And each campus has several hundred families. We have two separate spreadsheets. One spreadsheet has all of the parents’ home addresses and the other spreadsheet has all of the parents’ work addresses. We’re using a mapping software called eSpatial (but it’s limited). We can upload the spreadsheets (datasets) and map both batches of addresses.

The problem is that this doesn’t really tell us very much. Ultimately, we need a way to link home and work addresses together, visually, as being the same person.

For example, let’s say one point on a map is a parent’s home address at 123 Main St. and another point on the map is the same parent’s work address at 321 Sycamore Rd. We need a way to visually know that the two points below to the same person so we can see who, and how far, each parent travels to work. Ideally, if there was a line that connected the two points that would be great. That would make it easy to see how far away the parent works. Or it would also work to hover over one point and the corresponding home or work point would highlight.

Currently, the two spreadsheets do not have a common column that links the two together (I guess a “key”). Although I can create a spreadsheet that has a student ID column which would be the key between the two.

Any thoughts on how to put something like this together? Hopefully, this makes sense.

unity – How can I change the curved meeting points in my waypoints system so it will be updated in run time?

The post is a bit long but all the scripts are connected.

I have a simple waypoints system.

The first script is moving along LineRenderer line/s positions :

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class MoveOnCurvedLines : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public float speed;
    public bool go = false;
    public bool moveToFirstPositionOnStart = false;
    public float rotSpeed;
    public bool random = false;
    public int currentCurvedLinePointIndex;

    private Vector3() positions;
    private Vector3() pos;
    private int index = 0;
    private bool goForward = true;
    private List<GameObject> curvedLinePoints = new List<GameObject>();
    private int numofposbetweenpoints;
    private bool getPositions = false;
    int randomIndex;
    int curvedPointsIndex;

    // Start is called before the first frame update
    void Start()
    {
        curvedLinePoints = GameObject.FindGameObjectsWithTag("Curved Line Point").ToList();

        if (curvedLinePoints != null && curvedLinePoints.Count > 0)
        {
            transform.rotation = curvedLinePoints(1).transform.rotation;
        }
    }

    Vector3() GetLinePointsInWorldSpace()
    {
        positions = new Vector3(lineRenderer.positionCount);
        //Get the positions which are shown in the inspector 
        lineRenderer.GetPositions(positions);


        //the points returned are in world space
        return positions;
    }

    // Update is called once per frame
    void Update()
    {
        if (lineRenderer.positionCount > 0 && getPositions == false)
        {
            pos = GetLinePointsInWorldSpace();
            numofposbetweenpoints = curvedLinePoints.Count;

            if (moveToFirstPositionOnStart == true)
            {
                transform.position = pos(index);
            }

            getPositions = true;
        }

        if (go == true && lineRenderer.positionCount > 0)
        {
            Move();
        }

        var dist = Vector3.Distance(transform.position, curvedLinePoints(curvedPointsIndex).transform.position);
        if (dist < 0.1f)
        {
            if (curvedPointsIndex < curvedLinePoints.Count - 1)
                curvedPointsIndex++;

            currentCurvedLinePointIndex = curvedPointsIndex;
        }
    }

    int counter = 0;
    int c = 1;
    void Move()
    {
        Vector3 newPos = transform.position;
        float distanceToTravel = speed * Time.deltaTime;

        bool stillTraveling = true;
        while (stillTraveling)
        {
            Vector3 oldPos = newPos;

            newPos = Vector3.MoveTowards(oldPos, pos(index), distanceToTravel);

            distanceToTravel -= Vector3.Distance(newPos, oldPos);
            if (newPos == pos(index)) // Vector3 comparison is approximate so this is ok
            {
                // when you hit a waypoint:
                if (goForward)
                {
                    bool atLastOne = index >= pos.Length - 1;
                    if (!atLastOne)
                    {
                        index++;
                        counter++;
                        if (counter == numofposbetweenpoints)
                        {
                            c++;
                            
                            counter = 0;
                        }
                        if (c == curvedLinePoints.Count - 1)
                        {
                            c = 0;
                        }
                    }
                    else { index--; goForward = false; }
                }
                else
                { // going backwards:
                    bool atFirstOne = index <= 0;
                    if (!atFirstOne)
                    {
                        index--;

                        counter++;
                        if (counter == numofposbetweenpoints)
                        {
                            c++;
                            
                            counter = 0;
                        }
                        if (c == curvedLinePoints.Count - 1)
                        {
                            c = 0;
                        }
                    }
                    else { index++; goForward = true; }
                }
            }
            else
            {
                stillTraveling = false;
            }
        }

        transform.position = newPos;
    }
}

The second script is creating the lines :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenerateLines : MonoBehaviour
{
    public GameObject linesWaypointsPrefab;
    public int amountOfLines = 30;
    public int minRandRange, maxRandRange;
    public bool randomPositions = false;
    public bool generateNewPositions = false;

    private List<Vector3> linesWaypoints = new List<Vector3>();
    private Transform waypointsLinesParent;

    // Start is called before the first frame update
    void Awake()
    {
        waypointsLinesParent = GameObject.Find("Curved Lines").transform;

        if (generateNewPositions || (linesWaypoints.Count == 0 && amountOfLines > 0))
        {
            GenerateLinesWaypoints();
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    private void GenerateLinesWaypoints()
    {
        for (int i = 0; i < amountOfLines; i++)
        {
            if (randomPositions)
            {
                var randPosX = UnityEngine.Random.Range(minRandRange, maxRandRange);
                var randPosY = UnityEngine.Random.Range(minRandRange, maxRandRange);
                var randPosZ = UnityEngine.Random.Range(minRandRange, maxRandRange);

                if(linesWaypointsPrefab != null)
                {
                    var LineWaypoint = Instantiate(linesWaypointsPrefab, 
                        new Vector3(randPosX, randPosY, randPosZ), Quaternion.identity, waypointsLinesParent);

                    LineWaypoint.name = "Curved Line Point";
                    LineWaypoint.tag = "Curved Line Point";
                }
            }
            else
            {
                if (linesWaypointsPrefab != null)
                {
                    var LineWaypoint = Instantiate(linesWaypointsPrefab,
                        new Vector3(i, i, i), Quaternion.identity, waypointsLinesParent);

                    LineWaypoint.name = "Curved Line Point";
                    LineWaypoint.tag = "Curved Line Point";
                }
            }
        }
    }
}

And last the script that should update in real time in run time the curved line/s positions and the lines positions between each curved point :

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

(RequireComponent( typeof(LineRenderer) ))
public class CurvedLineRenderer : MonoBehaviour 
{
    //PUBLIC
    public float lineSegmentSize = 0.15f;
    public float lineWidth = 0.1f;
    (Tooltip("Enable this to set a custom width for the line end"))
    public bool useCustomEndWidth = false;
    (Tooltip("Custom width for the line end"))
    public float endWidth = 0.1f;
    (Header("Gizmos"))
    public bool showGizmos = true;
    public float gizmoSize = 0.1f;
    public Color gizmoColor = new Color(1,0,0,0.5f);
    //PRIVATE
    private CurvedLinePoint() linePoints = new CurvedLinePoint(0);
    private Vector3() linePositions = new Vector3(0);
    private Vector3() linePositionsOld = new Vector3(0);

    // Update is called once per frame
    public void Update () 
    {
        if (ResetLineRendererPositions.hasReseted == false)
        {
            GetPoints();
            SetPointsToLine();
        }
    }

    public void GetPoints()
    {
        //find curved points in children
        linePoints = this.GetComponentsInChildren<CurvedLinePoint>();

        //add positions
        linePositions = new Vector3(linePoints.Length);
        for (int i = 0; i < linePoints.Length; i++)
        {
            linePositions(i) = linePoints(i).transform.position;
        }
    }

    public void SetPointsToLine()
    {
        //create old positions if they dont match
        if( linePositionsOld.Length != linePositions.Length )
        {
            linePositionsOld = new Vector3(linePositions.Length);
        }

        //check if line points have moved
        bool moved = false;
        for( int i = 0; i < linePositions.Length; i++ )
        {
            //compare
            if( linePositions(i) != linePositionsOld(i) )
            {
                moved = true;
            }
        }

        //update if moved
        if( moved == true )
        {
            LineRenderer line = this.GetComponent<LineRenderer>();

            //get smoothed values
            Vector3() smoothedPoints = LineSmoother.SmoothLine( linePositions, lineSegmentSize );

            //set line settings
            line.positionCount = smoothedPoints.Length;
            line.SetPositions( smoothedPoints );
            line.startWidth = lineWidth;
            line.endWidth = useCustomEndWidth ? endWidth : lineWidth;
        }
    }

    void OnDrawGizmosSelected()
    {
        Update();
    }

    void OnDrawGizmos()
    {
        if( linePoints.Length == 0 )
        {
            GetPoints();
        }

        //settings for gizmos
        foreach( CurvedLinePoint linePoint in linePoints )
        {
            linePoint.showGizmo = showGizmos;
            linePoint.gizmoSize = gizmoSize;
            linePoint.gizmoColor = gizmoColor;
        }
    }
}

The result in the end is some cubes in this case 5 that are connected with lines and a transform that move on the positions of the lines not between the curved points(Cubes) but moving between the positions of the lines :

Result

The problem is with the last script. When the game is running and then when I’m selecting one of the curved points(Cube) and drag it around in the scene window I see it changing it’s position and the line also change but in fact it’s not changing the positions of the line and the position of the curved point in the moving script the first script.

The moving platform is keep moving on the old positions as before and never moving on the new positions.

In this screenshot I moved the fourth curved point(Cube) dragged it around to the right top but the platform is still moving on the old line positions of the fourth curved point(Cube) position it was before I moved it.

Moved one of the Cubes(Curved Point) at run time but the transform(platform) is keep moving on the old positions of the old line and not the new positions on the line after moved the cube

I want to do that when I change the curved points(Cubes) and it’s changing also the lines positions that it will update the transform that should move on this positions.

If I’m not mistaken the last script should do it but it’s not.

In the last script in the Update hasReseted is false all the time :

public void Update () 
    {
        if (ResetLineRendererPositions.hasReseted == false)
        {
            GetPoints();
            SetPointsToLine();
        }
    }

even if I set for a second the hasReseted to true and then to false again and it’s clearing the LineRenderer all lines and positions and re generating them over again the transform platform will keep moving on the old positions.

dnd 5e – Can I use Pact Magic spell slots gained on a short rest to gain sorcery points?

Yes, Flexible Casting doesn’t specify where the spell slot comes from, just that you expend one to gain points. This means that you can expend a spell slot that you have from Pact Magic to satisfy its requirement, and thus gain sorcery points from it.

And yes, this has been confirmed as the correct reading by Jeremy Crawford, the lead rules designer for D&D 5e, for exactly the use you’re asking about (though Crawford’s tweets are no longer considered official rulings):

Bill Cavalier @dungeonbastard · 6 May 2015
@JeremyECrawford Can a warlock/sorcerer covert warlock spell slots to sorcery points?

Jeremy Crawford‏ @JeremyECrawford · 6 May 2015
The sorcerer’s Flexible Casting feature is omnivorous, able to turn spell slots from any class into sorcery points.

Bill Cavalier‏ @dungeonbastard · 6 May 2015
@JeremyECrawford The use case is: convert warlock slots to sorc points, short rest, regain warlock slots. Turning a short rest asset to long

Jeremy Crawford‏ @JeremyECrawford · 6 May 2015
@dungeonbastard Yep, that works. Similarly, a paladin/warlock can use warlock slots for Divine Smite. Warlocks have so few slots on purpose!

algorithms – How to modify the following Dijkstra/ Uniform-cost search to return the result for all end points?

I know there is a lot of code out there that does this, but in particular, I’m trying to modify the following code to not just return the goal node/ one end point, but all endpoints. How do I go about it? I tried thinking of keeping a seen/visited set, but that seems redundant and kills the whole point of the reached map.

def best_first_search(problem, f):
    "Search nodes with minimum f(node) value first."
    node = Node(problem.initial)
    frontier = PriorityQueue((node), key=f)
    reached = {problem.initial: node}
    while frontier:
        node = frontier.pop()
        if problem.is_goal(node.state):
            return node
        for child in expand(problem, node):
            s = child.state
            if s not in reached or child.path_cost < reached(s).path_cost:
                reached(s) = child
                frontier.add(child)
    return failure

Question – Donating FP points | Forum Promotion

algebraic number theory – Weierstrass points in Artin-Schreier extensions of the rational function field in characteristic $p$

I encountered a problem regarding the orders at non-Weierstrass points ($n$ is an order of the point $P$ if there is some holomorphic differential $omega$ with order $n$ at $P$) when working out the details of this paper. More specifically, on page 3, the author uses the claim:
enter image description here

to conclude that:

enter image description here

I do not see how this result follows from the claim and the author does not explicitly work out the details. This result would follow if we knew that given $a$ an element of $k$ distinct from the $a_i$, there exists an element $b$ in $k$ such that $v_a(y-b)$ (the valuation of $y-b$ at the place corresponding to $a$) is one. In order to prove this, I tried the following argument. Let $a$ be in $k$. Notice that $t^p-t=frac{f(a)}{prod_{i=1}^{n}(a-a_i)^{m_i}}$ has a root $b$ in $k$ because of it being algebraically closed. In fact, $b+i$ for all $iin F_p$ is a root for the polynomial. Thus, we have $prod_{iinmathbb{F_p}}(y-(b+i))=y^p-y-frac{f(a)}{prod_{i=1}^{n}(a-a_i)^{m_i}}=frac{f(x)}{prod_{i=1}^{r}(x-a_i)^{m_i}}-frac{f(a)}{prod_{i=1}^{n}(a-a_i)^{m_i}}$. I am trying to show that $v_a(y-(b+i))=1$ for some $i$. It can be shown through the triangle inequality that $v_a(y-(b+i))geq 0$ for all $iinmathbb{F}_p$.

We can also use the fact that $f(x)$ has degree less than $m_1+cdots+m_r$ to conclude that $v_a(frac{f(x)}{prod_{i=1}^{r}(x-a_i)^{m_i}}-frac{f(a)}{prod_{i=1}^{n}(a-a_i)^{m_i}})leq m_1+cdots+m_r$. However, $x=a$ is a root of $frac{f(x)}{prod_{i=1}^{r}(x-a_i)^{m_i}}-frac{f(a)}{prod_{i=1}^{n}(a-a_i)^{m_i}}$. Thus, we must have $1leq v_a(frac{f(x)}{prod_{i=1}^{r}(x-a_i)^{m_i}}-frac{f(a)}{prod_{i=1}^{n}(a-a_i)^{m_i}})leq m_1+cdots+m_r$. However, I have no idea how to proceed from this point. I am not even certain if this proof strategy would work, but I see no other way of proving the result. Any help would be appreciated.

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123