Determine whether there exists a one-to-one character mapping from one string to another

The task

Determine whether there exists a one-to-one character mapping from one string s1 to another s2.

For example, given s1 = abc and s2 = bcd, return true since we can map a to b, b to c, and c to d.

Given s1 = foo and s2 = bar, return false since the o cannot map to two characters.

My solution

const s1 = "foo"; const s2 = "bar";  const isMapable = (s1, s2) => new Set(s1).size === new Set(s2).size;;  console.log(isMapable(s1, s2)); 

Seems to be too easy…not sure whether I miss something…

How to play a character with a disability or mental disorder without being offensive?

Two character concepts I’ve had recently are as follows.

  1. Someone who has been permanently deafened by their master as a symbol of their subservience. (NPC)

  2. Someone who has had a significantly traumatic experience, and as a result, has PTSD. (PC with the haunted one background)

Both of these concepts require a nuanced approach. For example, I recognize that concept 1 would have trouble communicating verbally, and I don’t want to play this character with an off-the-cuff Hellen Keller impression.

How can I explore these and other character concepts in a way that would not be offensive to any affected parties?

Help/Feedback: Interaction with virtual character

Hey guys, I'm conducting a short psychological study for my thesis on social interactions. First, you'd do me huge favor if you participated (it's of course anonymous): https://www.soscisurvey.de/animation/ THANK YOU!

Also, as you will see I'm using a virtual character in the study and would love to receive constructive criticism in order to optimize it. However, for the study please ignore the potential weak points of the presentation and just imagine the situation. :D

Thanks a lot!

strcat returning wrong character

I am using strcat to build a string. It works except for when I want to append characters that represent numbers from an array. The line that uses:

strcat(JsonDataStr, numsToSend[i]); 

for example appends the character ‘c’ instead of ‘1’. If I manually put the character in using double quotes it works, but i want to have a one dimensional array with characters only.

char JsonDataStr[20];  void buildJsonString(){      int offset;     char strtStr[] = "[{\""  ;     char numStr[4];     char numsToSend[4] = {'1', '2','3','4'};      offset = sizeof(strtStr);      strcat(JsonDataStr, strtStr);      for(i = 0 ; i < 2 ; i++){            strcat(JsonDataStr, JsonDataName);            ByteToStr(i, numStr);            strcat(JsonDataStr, numsToSend[i]);            strcat(JsonDataStr, "\":\"");     }     strcat(JsonDataStr, "\"}]"); } 

Any idea why this is happening.

Finds a Character based on distance and health

I need to improve the efficiency of my program and, using the profiler, have narrowed the problem down to 2 key areas, but I am having trouble coming up with ways to make the program run better.

Based on my profiler’s report, it seems to be telling me that my if functions are inefficient. Whats a better way to achieve a better result?

Character* FindAttackTarget() const         {             float weakestHp = FLT_MAX;             Character* weakestEnemy = nullptr;             uint64_t weakestCharId = INT64_MAX;              //Only attack characters that are within attack range             auto& gameChars = m_pGame->m_gameCharacters;               for (size_t i = 0; i < gameChars.size(); ++i)             {                 auto& c = gameChars[i];                 if (Location.Dist(c.GetLocation()) <= AttackRange &&                     c.HP > 0 &&                     c.Team != Team)                 {                     //We want the weakest with the lowest ID number - this keeps consistent results when re-playing the same part of the game (eg. after a load game)                     if (c.HP < weakestHp || (c.HP == weakestHp && c.ID < weakestCharId))                     {                         weakestEnemy = &gameChars[i];                         weakestHp = c.HP;                         weakestCharId = c.ID;                     }                 }             }              return weakestEnemy;         } 

How long does it take to use first aid to save a dying character?

In the PHB, it says that a character can perform first aid in order to stabilize a dying character. The Heal DC is 15 and if the character makes it, then the character immediately stops losing HP and is stabilized. This takes one standard action. (Given that you get a move and a standard action in one round and one round is 6 seconds, then this action takes approximately 3 seconds to perform.)

Yet on page 138 under “The Combat Round”, it says

Anything a person could reasonably do in 6 seconds, your character can do in one round.

My issue is the discrepancy here. You cannot reasonably stabilize someone and stop them from losing blood, etc. in 3 seconds; it’s impossible without some form of magical aid. So how is it a person can perform a Heal check in 3 seconds and stabilize a dying person, when doing so is unreasonable?

How does the 27 character wide search box recommended length apply to Asian languages and Russian?

I work for a multinational company. We have a global site, and individual country sites. I am trying to set a width for the search box that will accommodate all of our sites and languages. We’ve got Japanese, Taiwanese, Thai, Chinese, Korean, and Russian to contend with, as well as several European languages.

Does anyone know if this 27 character width recommendation is global, or are there different width suggestions for languages that don’t use Roman lettering?

Does the “Pierce Magical Concealment” feat allow a character to see magically concealed characters?

One of the players of the oneshot campaign that I’m writing chose the feat Pierce Magical Concealment (Complete Arcane, p.81), as a DM I’m not sure how it would work in an encounter I am planning.

The manual states about the Pierce Magical Concealment feat:

You ignore the miss chance provided by certain magical effects.

Your fierce contempt for magic allows you to disregard the miss chance granted by spells or spell-like abilities such as darkness, blur, invisibility, obscuring mist, ghostform (see page 109), and spells when used to create concealment effects (such as a wizard using permanent image to fill a corridor with illusory fire and smoke). In addition, when facing a creature protected by mirror image, you can immediately pick out the real creature from its figments. Your ability to ignore the miss chance granted by magical concealment doesn’t grant you any ability to ignore nonmagical concealment (so you would still have a 20% miss chance against an invisible creature hiding in fog, for example).

This doesn’t specify if a character with this feat can actually see an enemy that is, for example, under the effect of the spell Invisibility (Player’s Handbook, p. 245).

I am planning an encounter in which the party will be invited by a wizard for dinner, an assassin under the effect of invisibility will pretend to be an Unseen Servant (Player’s Handbook, p. 297) until the wizard gives him the signal to attack the party.

Will the character that has the Pierce Magical Concealment feat be able to see the assassin, or at least have any advantage in noticing he is not an Unseen Servant?

What is the longest distance a player character can jump?

After asking What is the longest distance a 13th-level monk can jump while attacking on the same turn?, my curiosity got piqued.

By RAW, what is the longest distance a player character can jump?

The jumping rules state:

Long Jump.

When you make a long jump, you cover a number of feet up to your Strength score if you move at least 10 feet on foot immediately before the jump. When you make a standing long jump, you can leap only half that distance. Either way, each foot you clear on the jump costs a foot of movement.

This rule assumes that the height of your jump doesn’t matter, such as a jump across a stream or chasm. […]

Rules for answering this question:

  • Only classes from the books; multiclassing is allowed.
  • You can make the character(s) level 20 (if required).
  • The jumping character has allies that can aid in increasing the jump distance.
  • For starting ability scores, use the standard array of 15, 14, 13, 12, 10, 8.
  • Spells are allowed, preferably without casting Wish (because of its unreliability).
  • Magic Items are allowed, but only from the official books.
  • There is no time limit for preparing the epic jump.

Related: What happens when you run out of movement while jumping?

Is knowing the character enough to determin the representation

Let V be a complex représentation of finite dimension of the symmetric group $ S_n$ and $ χ$ the character of $ V$ .

prove $ V=V\otimes_{\Bbb C}\varepsilon$ iff $ χ(\sigma)=0$ for every odd permutation, where $ \varepsilon$ is the signature.

The prove is straightforward $ χ(\sigma) = χ(\sigma) \varepsilon(\sigma) = – χ(\sigma) \Leftrightarrow χ(\sigma)=0$ .

But I am not sure if $ χ(\sigma) = χ(\sigma) \varepsilon(\sigma)\Leftrightarrow V=V\otimes_{\Bbb C}\varepsilon $ ?

Thank you for your help.