dnd 5e – Are conditional, sequential and looping instructions understood by an Unseen Servant?

A bit late to the party, but the wording is clear:

RAW, Unseen Servant can be used to implement an arbitrary computer or command, even given the most conservative reading of the rules.

However, this is not obvious, and may require some tricks. Your questions might be considered leading questions, and the answers are generally “yes… but not for the reason you may think”.

I will go over examples of how a single Unseen Servant can be programmed to be Turing-complete.

The relevant excerpts are as follows:

invisible, mindless, shapeless force that performs simple tasks at your command until the spell ends

People often confuse mindless with unable to process information. Obviously a computer is mindless, but is able to do things like read and process text. A GM may even opt to treat a mindless entity as having an Int/Wis score sometimes (e.g. whether you treat an avatar of an evil witch in a magic mirror, as having an avatar creature with an Int/Wis stat, or forwarding effects to/from the real witch)… not that it’s necessarily a good thing to do in general.

Obviously a mindless force cannot understand things. ‘Understanding’ though is not the same as “processing something” or “effecting action based on something”. For example a computer need not understand sound in order to do text-to-speech synthesis. A corollary is that an Unseen Servant itself has no consciousness, sentience, or (in D&D universe) no soul. By definition of ‘subjective’, it may not make ‘subjective’ decisions*. (However, an Unseen Servant may theoretically act as a brain for a composite entity thinking entity, whose mind is the code run by the Unseen Servant, and whose brain is the Unseen Servant. See the Chinese Room thought experiment. Mind=software, brain=hardware.)

*(this is actually a bit complicated… one might say that an image recognition task performed by a computer is subjective, when it is in fact just finding the maximal probability. Consequently if one just said something like “Unseen Servant, I mentally command you to indicate ‘cat’ or ‘dog’ with this rock based on what my ally Bob the Paladin would hypothetically give the answer as!”… that would certainly be logically sound. However, it would not work for other reasons we’ll get to below.)

springs into existence in an unoccupied space on the ground

Once on each of your turns as a bonus action, you can mentally command the servant to move up to 15 feet and interact with an object. The servant can perform simple tasks that a human servant could do, such as fetching things, cleaning, mending, folding clothes, lighting fires, serving food, and pouring wine. Once you give the command, the servant performs the task to the best of its ability until it completes the task, then waits for your next command.

Some important things to note:

  • The servant can perform lengthy tasks without having to control it every action; it just needs an initial mental command (which may be done as a bonus action). Proof: all these tasks cannot be done in a single action.
  • The servant can perform complicated tasks that might take a minutes-long Youtube video to explain. These examples just illustrate the phrasing “simple tasks a human servant could do“. That is the core of the spell. It even goes so far as to list examples that would require multiple different Interact With Object such as:
    • possibly different Interact With Object actions like serving wine (into a glass), serving (different types of) food (though this is technically ambiguous but the context clearly implies it is not)
    • actions which require complicated tradeskill knowledge like ‘mending’ e.g. a quilt, and possibly tools
    • multiple different Interact With Object actions such as lighting (multiple) fireS (plural).

Thus for all intents and purposes, the servant can be ‘loaded’ or queued with any “simple task a human servant could do”, subject to the constraint that the servant has no free will (is mindless). (Corollary: thus the task may not depend on the mental state of the servant, which doesn’t exist… though may potentially depend on the introspection of what the servant is doing and has been doing right now.)

(As a sidenote, one might ponder what mechanism might make an Unseen Servant ‘work’ behind the scenes. There are quite a few possibilities the GM might come up with, e.g. it pulls from the subconscious of the caster and/or nearby allies; it is pre-programmed and run by an otherworldly CPU; it is a narrativium-style black box, etc.)

Some obvious questions we might ask ourselves:

  1. Can an Unseen Servant read?

    • It can certainly recognize letters and symbols, just like it can mend clothes, or pour a cup of water until it is full. It can react to those symbols and act based on those symbols. Because it is mindless, it cannot write out a literary analysis of a text involving any original thought.
    • However, does that mean it understands Common? That is, can you give it written orders? See #5.
  2. Does an Unseen Servant have a concept of relative and/or absolute time?

    • Can it do things like wait a round, wait until noon, etc.? The answer is probably up to the GM here. It would be very awkward if it could not. The workaround for players would just be to carry around a stopwatch to give to the servant (or set up a sundial). Multiple Unseen Servants could synchronize off one another because they (as Creatures on the map) are a physical process (e.g. Force energy) in the multiverse (unless the GM rules otherwise).
  3. Can an Unseen Servant hear and speak?

    • This is not explicitly stated. In fact, the GM might rule that an Unseen Servant cannot react sounds and high-frequency vibrations (though I personally would not). Just because it is described as ‘Unseen’ and typically does silent labor, does not necessarily mean it is unheard and cannot hear; the nomenclature brings to mind a certain mental imagine that is not necessarily canon. This is a GM decision; it would be weird for it not to be able to hear though.
    • If the GM rules the Unseen Servant cannot make sound, one can have it tap rocks on the ground in a pattern.
  4. Can the Unseen Servant ‘know’ things the player cannot?

    • Clearly so, if the player is for example Blinded.
    • Being Mindless, the Unseen Servant cannot ‘know’ things, but can react on things.
    • What happens if the player says “If this goblin is actually a polymorphed fae, move this rock.”? Can it detect stealthed creatured like an Alarm spell? Can one say “If I say the answer to the sphinx’s riddle, move this rock”? The GM should not allow this because it would break the game, but limited versions are possibly for GMs who like certain mechanistic worldbuilding (perhaps Unseen Servants have Perception despite with +0 int modifier… a magical world, the notion of computability may be trumped by Divination…… sidenote: Though, then I believe that would just create an infinite hierarchy of Divinition-magic-aware computability and Divinition-magic-on-Divination-magic-aware-computability etc., see mention of oracles of the Busy Beaver function in this article).
    • In any case, it would be strange for the Unseen Servant to have knowledge of how to do things the caster did not. For example, if the caster never knew how to perform mending on a quilt, would the Unseen Servant be able to? Up to the GM.
  5. Can an Unseen Servant process auditory, visual, or mental orders from other entities the caster gives permission to?

    • Up to the GM. I would rule no.
    • However, if the GM rules ‘no’, there is a simple workaround of having it implement a simple Turing machine out of rocks. (That is a reason perhaps to rule ‘yes’.)
  6. Does the Unseen Servant have access to a method to deal existential instantiation? Can it randomly pick between abstract concepts? Can it randomly pick between physical objects?

Now that we have some basic questions out of the way, we need to analyze a very specific word:

simple tasks that a human servant could do

What’s ‘simple’? The notion of Kolmogorov complexity implies that simplicity is always relative to your set of pre-understood assumptions (you cannot say “execute plan C” and expect the GM to understand, unless you have previously described what plan C is in normal English (or whatever language you’re playing in)). Thus there is a notion of simplicity i.e. if you tell this to the GM, will it bog down the game? As the contrapositive, is it always obvious what the next part of the task is? (What happens if the next part is no longer obvious? Probably the Unseen Servant stops and awaits further orders.) The GM might reasonably rule on various definitions of ‘simple’, such as GM fiat. I’d personally additionally rule:

  • with no more than a low-resolution sketch with at most a few symbols, fewer than a certain number of words, and up to 30 seconds of additional (‘psychic’) explanation… can the player explain a task unambiguously? without bogging down the game to prep this?

If yes, then I’d say it works, subject to all the above restrictions and caveats. That would mean for example you could describe an incredibly simple Turing machine, or something effectively almost as good and even simpler. For example:

“I psychically command this Unseen Servant to whenever these pebbles are in any of the formations on this piece of paper in relation to its (metaphorical) hand, to rearrange them and move its unseen hand 1 inch to the right or left as shown.”

One might use this with a reasonably large program consisting of pages and pages (assuming it is near instantaneous for the GM to implement or they are okay with ruling that it just works), but for a reasonably compact Turing machine like the one above, that one can conceptualize and explain simply, you might not even need the paper.

Of course, then one might perhaps make the technomage roll to try to reinvent computer science, with a very high DC… it might take a while to figure out, akin to trying to invent a powerful homebrew spell, to… rederive fundamental mathematics de novo. Or maybe the GM is fine with clever players helping their Barbarians with combat tactics. I’m in the latter camp, but at some point one may need to invoke the “trying to rederive mathematics” check.

Anyway, actually compiling into this pebble-based Unseen Servant language and extracting output from it would require… an infrastructure of a lot of Unseen Servants, and/or a lot of time manipulation and/or miniaturization. For practical purposes, here are how I’d answer OP’s original questions:

Can an Unseen Servant fulfill conditional tasks? (ex : “pour wine into each empty glass” – in other words, if the glass if already filled, don’t pour wine in it, else do it)

Yes (conditions happen all the time in simple tasks). This only works because the task is simple. If one tried to write 50 nested conditions, it would no longer be simple, and no longer work.

Can it fulfill sequential tasks? (ex: “pour wine into my glass, then bring it to me”)

Yes, because it is a simple task. If one tried to write a sequence of 50 things, it would no longer be simple, and no longer work.

Can it fulfill looping tasks? (ex: “Pour wine into my glass every minute for 20 minutes”)

In general yes, because a loop is simple. However, due to the way this was phrased, it is up to the GM, because Unseen Servants do not necessarily have internal clocks (but probably do; the workaround is trivial).

If it can do all three separately, can it do them all together? (ex: “Every minute for 20 minutes, for each empty glass, if it’s empty, pour wine into it then bring it to their respective owner, else don’t touch it”)

In general yes, but if this was very complicated, no, because it must once again be a “simple task” a human servant could do.

Can an Unseen Servant be fed a series of instructions via text (ex: “do what is written on this paper”) or speech (ex: “do what any of my Magic Mouths will tell you to do when one starts giving orders” – so if you have several Magic Mouths, the trigger of the second Magic Mouth’s speech might be something caused by one of the first Magic Mouth’s instructions to the Unseen Servant… which essentially results in something like a function call in programming)? For this to work, the Unseen Servant must either have sight+reading abilities, or hearing+language abilities. The spell specifies you give telepathic commands to the Servant, but does not say if textual/verbal commands from your own voice work as well. The closest thing is a comparison to a human servant, so it might or might not work out.

Up to the GM. If the GM rules no (one might reasonably rule that the the Unseen Servant has no understanding of symbols on a page other than the fact that they are symbols in certain recognizable patterns, in which case the only way to react to them is the meaning your character has; alternatively one might rule that it can understand Common just like a human servant), it still possible to have the Unseen Servant notice the fact that the Magic Mouth is talking. In this manner, the “triggering condition” verbiage of the Magic Mouth spell may be used as input to the task of an Unseen Servant.

I’d rule that an Unseen Servant can read lips, but because scientific papers in real life have noticed that even experienced lip-readers are only semi-accurate, this is an inference task, and thus in rare circumstances may suffer from existential instantiation if say there is a tie and the priors are underspecified. Unless the GM allows a compendium of illustrations of mouths and rules for resolving ambiguity (which might… make the task take hours…), one might have to implement one’s own lip-reading algorithm by compiling down the the Unseen-Servant-manipulating-pebbles programming language described earlier.

Can an Unseen Servant wait for a given time interval before doing a task step ? (how it would work out : as it takes a turn (6 seconds) for an Unseen Servant to move 15 feet, it therefore takes it 1 second to move 2.5 feet, so if you tell an Unseen Servant to move in circles for 2.5X feet before doing a step, then you essentially delay the step by X seconds)

Up to the GM, but since it’s reasonable and the workaround (burning piece of cord) is easy, I’d allow it.

Even with a conservative interpretation of the rules, one may have perhaps three Unseen Servants implementing the above Turing machine (or some other Turing machine). Thus, theoretically, a general purpose computer may be made with Unseen Servants… but it would of course be really slow. Anything in combat-time will likely be at the dictates of the GM.

operating systems – How are semaphores and test-and-set instructions connected?

Semaphores are an abstract mechanism to control access to a shared resource. Other such mechanisms exist, for example locks and monitors. These are the counterparts of abstract data structures – they specify an API for a mechanism and its semantics, but not its implementation.

Implementing such mechanisms correctly requires hardware support. One way to implement semaphores is using test-and-set. Another popular instruction is compare-and-swap. Both of these are examples of atomic instructions, which are instructions performing several operations that cannot be interrupted in the middle. Such atomic instructions are necessary to correctly implement mechanisms such as semaphores.

Typically these control mechanisms are implemented by the operating system. For example, POSIX-compliant systems implement POSIX semaphores. Semaphores are just one more service provided by the operating system. Under the hood, semaphores are implemented using atomic instructions provided by the CPU.

permissions – cron does not execute some instructions

I have used (in Ubuntu 14.04) sudo crontab -e to set up a crontab for root. In the tab, I call a couple of scripts in /usr/bin a different times. The scripts permissions are -rwxr-xr–

They (these scripts) do get executed alright, and i know this because they add things to log files every time. However, both scripts contain instructions that get skipped. One of these instructions is “/usr/sbin/service network-manager restart”, the other is just “reboot”.

If i do execute the scripts manually using sudo those instructions do get executed (I see the network restarting or the laptop rebooting). However when cron executes these scripts this does not happen (instructions are skipped), and i don’t understand why.

So in summary it looks like these instructions (“/usr/sbin/service network-manager restart” and “reboot”) are skipped only when cron executes the scripts, but when i execute the scripts manually with sudo they do get executed.

It somehow feels like a privilege problem but i don’t understand really what’s going on …
Anyone has any idea?


optimization – What x86 instructions do todays best compilers use and/or ignore?

I am working on a compiler and am interested in x86 machine code statistics.

enter image description here

But what about all the rest of the instructions? How much work does a team put into a compiler to get more optimization out of it by using different optimized instructions?

Specifically, there are instructions like for crypto operations (eg CRC32). There are advanced bit manipulation instructions (eg BEXTR). There are MMX and SSE instructions (tons and tons of these), and floating point instructions. Etc.

Other than these top 20, what do compilers typically take advantage of. If it’s all over the place, that would be good to know, but I’m mainly looking for a sense of what the cutting edge is in terms of today’s compiler implementations, what instructions or groups of instructions they use, and what they ignore.

interaction design – How do I express these instructions to a user in the most user-friendly way?

Here I have a screen which is intended for the user to search for and outline their yard with a set of tools in the toolbar (The pen and scissor tool is toggled when tapped).

enter image description here

I need to explain the use of each button in the toolbar as well as instruct the user to outline the entirety of their yard with the pen tool and then outline the part of their yard with the scissor tool which is not grass (houses, sheds, driveways, etc.)

enter image description here

enter image description here

enter image description here

What would work best here? Interactive tutorial? A video? How and where do I explain the functions and steps to keep it as simple as possible? I have tried creating a dialog with slides explaining each button’s function but didn’t really like the outcome. Since I wrote the app, it’s really hard knowing if what I write is simple enough and/or user-friendly.

python – Program to move in a 2d array given instructions, array and starting position

Original problem (not in English): https://pokval21.kattis.com/problems/pokval21.robotdammsugaren

How can my code be optimized?

import sys
j = 0
instructions = ()
room = ()
for i in sys.stdin:
    inp = i.split()
    if(j == 0):
        r = int(inp(0))
        c = int(inp(1))
        k = int(inp(2))
        instructions = list(inp(0))
    if(j >= 2):
    if(len(room) == r):
    j += 1
def findStartPos(c, room):
    for y, sublist in enumerate(room):
        pos = ()
        if c in sublist:
            x = room(y).index(c)
            return pos
    return -1
botPos = findStartPos("O", room) # (x, y)
x = botPos(0)
y = botPos(1)
i = 0
visited = (botPos)
clean = 1
append = visited.append
for i in instructions:
    if(i == ">"):
        while room(y)(x+1) != "#":
            if((x+1, y) in visited):
                append((x+1, y))
                botPos = (x+1, y)
                clean += 1
            x += 1
        botPos = (x, y)
    elif(i == "<"):
        while room(y)(x-1) != "#":
            if((x-1, y) in visited):
                append((x-1, y))
                botPos = (x-1, y)
                clean += 1
            x -= 1
        botPos = (x, y)
    elif(i== "^"):
        while room(y-1)(x) != "#":
            if((x, y-1) in visited):
                append((x, y-1))
                botPos = (x, y-1)
                clean += 1
            y -= 1
        botPos = (x, y)
    elif(i == "v"):
        while room(y+1)(x) != "#":
            if((x, y+1) in visited):
                append((x, y+1))
                botPos = (x, y+1)
                clean += 1
            y += 1
        botPos = (x, y)

What I’m doing is taking an input where the first line is r c k.
r is the max y value in the 2d array starting from 1, c is the max x value starting from 1 arr(y)(x) and k is the amount of instructions.
the second is a line of instructions eg. <>^v for left, right, up and down.

In the function findStartPos I am iterating though the 2d array of strings I created from the rest of the input eg,

((#, #, #, #), (#, O, #, ., #), (#, . ., ., #), (#, #, ., ., #), (#, #, #, #))
to find the starting cordinates of O.

In the rest of the code I go though the instructions and moving the O around to count how many unique points it has been on. It can’t be on a #. eg.

###### instuction: <
###### instuction: ^
###### instuction: <
###### instuction: None
been on 5 unique "squares"


5 5 4
returns: 6

8 10 14
returns: 33

Hope the code is readable enough to be understood.

argument patterns – passing splice instructions

Consider some passing splice instructions using start,stop,step pattern

r`data = Range@10;
r`f[data_, start_: 1, stop_: - 1, every_: 1] :=
  data[[start ;; stop ;; every]] 
  1. Is there a performance penalty if the splice is effectively a non-splice i.e. [[1;;-1;;1]] or [[1;;;;1]] or [[;;Length@data;;]] etc compared to say returning data? The reason I ask is if so, must I specifically skip splicing in such casses?

  2. Consider the case when multiple splice instrcutions have to be passed: start1,stop1,step1, start2,stop2,step2…. How to structure this compactly in func arguments? e.g. is there something better than r`f[data_, splice1_:{-1,1,1},...]

What terminology should I reference to learn how to break down CISC instructions?

I’m trying to learn the fundamentals needed in order to be able to analyze CISC architecture executable binary instructions and break down each instruction into its components including the opcode and address.

The following diagram I found here is almost exactly what I’m looking for, but whereas I’m new to the subject, the diagram or accompanied article doesn’t elaborate on certain terms, symbols, and concepts, which leaves me trying to search the subject to learn more so I can understand what’s going on, but Google doesn’t return useful results with the terms I’m searching.

enter image description here

Perhaps it’s just an issue of not knowing what terms to search. What terminology should I be using to reference what I’m looking for?

development – Using pdf libraries but didn’t get the instructions

Hello generous internet users, friends! I want to publish an Android app but I'm a newbie to Android programming. However, I hope I can overcome hardship by enthusiasm and YOUR help.

So the app is a PDF wrapped in an.apk file and here is the library for that. I did coding copying from YouTube videos but couldn’t go further.

So I want to add a scroll bar to that PDF app.

Here is the instructions but I didn’t get that.

So could you please tell me what should I code and where? (Is it Mainactivity.java or somewhere else?)

Thanks in advance.