What is the correct interpretation of the Gambling Results table in Xanathar’s Guide to Everything?

In Xanathar’s Guide to Everything, one of the downtime options provided in “Downtime, Revised” allows a character to gamble during their downtime to earn extra money.

Gambling

Games of chance are a way to make a fortune—and perhaps a better way to lose one.

[…]

Gambling Results
\begin{array}{|l|l|} \hline \text{Result} & \text{Value} \ \hline \text{0 Successes} & \text{Lose all the money you bet, and accrue a debt equal to that amount.} \ \hline \text{1 Success} & \text{Lose half the money you bet.} \ \hline \text{2 Successes} & \text{Gain the amount you bet plus half again more.} \ \hline \text{3 Successes} & \text{Gain double the amount you bet.} \ \hline \end{array}

—Xanathar’s Guide to Everything, pg. 130

So if I place a bet of 100gp and make my checks against this table, how much would I have, for each category?

How can I correct this code to get an answer?

I need to calculate matrix m1 according to following algorithm. Then, I have to put it in the differential equation. However, matrix m1 is complex and therefore the differential equation does not work.
How can I correct this code to get an answer?

 m = {{0, WP[t], WP[t], WP[t], 0}, {WP[t], -FSR, 0, 0, -WS[t]}, {WP[t],  0, 0, 0, WS[t]}, {WP[t], 0, 0, FSR, -WS[t]}, {0, -WS[t],   WS[t], -WS[t], 0}};   q = Eigenvectors[m]; qq1 = Normalize[q[[1]]]; qq2 = Normalize[q[[2]]]; qq3 = Normalize[q[[3]]]; qq4 = Normalize[q[[4]]]; qq5 = Normalize[q[[5]]];   Ali1 = {{D[qq1, t][[1]], 0, 0, 0, 0}, {D[qq1, t][[2]], 0, 0, 0,    0}, {D[qq1, t][[3]], 0, 0, 0, 0}, {D[qq1, t][[4]], 0, 0, 0,    0}, {D[qq1, t][[5]], 0, 0, 0, 0}};  Vali1 = ConjugateTranspose[Ali1];  Kazi1 = Ali1.Vali1;   Ali2 = {{D[qq2, t][[1]], 0, 0, 0, 0}, {D[qq2, t][[2]], 0, 0, 0,    0}, {D[qq2, t][[3]], 0, 0, 0, 0}, {D[qq2, t][[4]], 0, 0, 0,    0}, {D[qq2, t][[5]], 0, 0, 0, 0}}; Vali2 = ConjugateTranspose[Ali2]; Kazi2 = Ali2.Vali2;  Ali3 = {{D[qq3, t][[1]], 0, 0, 0, 0}, {D[qq3, t][[2]], 0, 0, 0,  0}, {D[qq3, t][[3]], 0, 0, 0, 0}, {D[qq3, t][[4]], 0, 0, 0,  0}, {D[qq3, t][[5]], 0, 0, 0, 0}}; Vali3 = ConjugateTranspose[Ali3]; Kazi3 = Ali3.Vali3;  Ali4 = {{D[qq4, t][[1]], 0, 0, 0, 0}, {D[qq4, t][[2]], 0, 0, 0,  0}, {D[qq4, t][[3]], 0, 0, 0, 0}, {D[qq4, t][[4]], 0, 0, 0,  0}, {D[qq4, t][[5]], 0, 0, 0, 0}}; Vali4 = ConjugateTranspose[Ali4]; Kazi4 = Ali4.Vali4;   Ali5 = {{D[qq5, t][[1]], 0, 0, 0, 0}, {D[qq5, t][[2]], 0, 0, 0,   0}, {D[qq5, t][[3]], 0, 0, 0, 0}, {D[qq5, t][[4]], 0, 0, 0,    0}, {D[qq5, t][[5]], 0, 0, 0, 0}};  Vali5 = ConjugateTranspose[Ali5];  Kazi5 = Ali5.Vali5;   m1 = Kazi1 + Kazi2 + Kazi3 + Kazi4 + Kazi5;   sol1 = NDSolve[{D[c[t], t] == (m1).c[t],  c[0] == {1, 0, 0, 0, 0}}, c, {t, 0, 2 tf}];   ans = Evaluate[c[t] /. sol1[[1]]][[5]];  ans1 = Abs[ans]^2;  Plot[ans1, {t, 0, 2 tf}, Frame -> True]  

Hi friends, I need to calculate matrix m1 according to following algorithm. Then, I have to put it in the differential equation. However, matrix m1 is complex and therefore the differential equation does not work.
How can I correct this code to get an answer?

Which is the correct rules text for Darkvision?

Reading the PHB sections on races, e.g. Dwarf p. 20, it says …

Darkvision. Accustomed to life underground, you have superior vision in dark and dim conditions. You can see in dim light within 60 feet of you as if it were bright light, and in darkness as if it were dim light. You can’t discern color in darkness, only shades of gray.

But at PHB p.184 it doesn’t mention dim lighting conditions, only what Darkvision does in full darkness. It says …

Darkvision: Many creatures in the worlds of D&D, especially those that dwell underground, have darkvision. Within a specified range, a creature with darkvision can see in darkness as if the darkness were dim light, so areas of darkness are only lightly obscured as far as that creature is concerned. However, the creature can’t discern color in darkness, only shades of gray.

So the various character races can see in darkness as if it were dim, and in dim light as if it were bright, whereas "creatures" can only see in darkness as if it were dim?

Is my understanding of strictness correct in this proof of a `foldl` rule?

Exercise G in Chapter 6 of Richard Bird’s Thinking Functionally with Haskell asks the reader to prove

foldl f e . concat  =  foldl (foldl f) e 

given the rule

foldl f e (xs ++ ys)  =  foldl f (foldl f e xs) ys 

There’s no mention whether the given rule applies to infinite lists, nor does the answer in the book mention infinite lists. If my reasoning is correct, they are indeed both valid for infinite lists, provided f is strict.

The undefined case for the given rule requires this additional proof:

-- f is strict  ⟹  foldl f is strict  (i.e., foldl f undefined = undefined)        foldl f undefined xs       =        undefined xs  -- case undefined       foldl f undefined undefined         undefined undefined --   =  {foldl.0}                        =  {?}       undefined                           undefined  -- case []       foldl f undefined []                undefined [] --   =  {foldl.1}                        =  {?}       undefined                           undefined  -- case (x:xs)       foldl f undefined (x:xs)            undefined (x:xs) --   =  {foldl.2}                        =  {?}       foldl f (f undefined x) xs          undefined --   =  {f is strict}       foldl f (undefined x) xs --   =  {?}       foldl f undefined xs --   =  {induction}       undefined xs --   =  {?}       undefined 

As an aside, my proof for the dual of the above rule for foldr:

-- f x is strict  ⟹  foldr f is strict  (i.e., foldr f undefined = undefined)        foldr f undefined xs       =        undefined xs  -- case undefined       foldr f undefined undefined         undefined undefined --   =  {foldr.0}                        =  {?}       undefined                           undefined  -- case []       foldr f undefined []                undefined [] --   =  {foldr.1}                        =  {?}       undefined                           undefined  -- case (x:xs)      foldr f undefined (x:xs)             undefined (x:xs) --  =  {foldr.2}                         =  {?}      f x (foldr f undefined xs)           undefined --  =  {induction}      f x (undefined xs) --  =  {?}      f x undefined                      --  =  {f x is strict}      undefined 

The given rule:

-- f is strict  ⟹  foldl f e (xs ++ ys)  =  foldl f (foldl f e xs) ys        foldl f e (xs ++ ys)       =        foldl f (foldl f e xs) ys  -- case undefined       foldl f e (undefined ++ ys)         foldl f (foldl f e undefined) ys --   =  {++.0}                           =  {foldl.0}       foldl f e undefined                 foldl f undefined ys --   =  {foldl.0}                        =  {f is strict  ⟹  foldl f is strict}       undefined                           undefined ys --                                       =  {?}                                           undefined  -- case []      foldl f e ([] ++ ys)                 foldl f (foldl f e []) ys --  =  {++.1}                            =  {foldl.1}      foldl f e ys                         foldl f e ys  -- case (x:xs)      foldl f e ((x:xs) ++ ys)             foldl f (foldl f e (x:xs)) ys --  =  {++.2}                            =  {foldl.2}      foldl f e (x : (xs ++ ys))           foldl f (foldl f (f e x) xs) ys --  =  {foldl.2}                         =  {induction}      foldl f (f e x) (xs ++ ys)           foldl f (f e x) (xs ++ ys) 

My solution to the exercise:

-- f is strict  ⟹  foldl f e . concat  =  foldl (foldl f) e        foldl f e (concat xs)       =       foldl (foldl f) e xs  -- case undefined       foldl f e (concat undefined)        foldl (foldl f) e undefined --   =  {concat.0}                       =  {foldl.0}       foldl f e undefined                 undefined --   =  {foldl.0}       undefined  -- case []       foldl f e (concat [])               foldl (foldl f) e [] --   =  {concat.1}                       =  {foldl.1}       foldl f e []                        e --   =  {foldl.1}       e  -- case (x:xs)       foldl f e (concat (x:xs))           foldl (foldl f) e (x:xs) --   =  {concat.2}                       =  {foldl.2}       foldl f e (x ++ concat xs)          foldl (foldl f) (foldl f e x) xs --   =  {f is strict  ⟹  foldl f e (xs ++ ys)  =  foldl f (foldl f e xs) ys}       foldl f (foldl f e x) (concat xs) --   =  {induction}       foldl (foldl f) (foldl f e x) xs 

Does this work? If so, is it often the case that rules restricted to finite lists can be made to work for all lists given additional strictness requirements like this?

There are several lines above with {?} given as my reasoning. They could be replaced by {undefined x = undefined}, but I am just guessing there. If that is true, how could it be justified?

What is the correct damage for Vicious Weapon?

While typing up my answer for Where are Vicious Weapons detailed? I noticed there’s an inconsistency with the description for Vicious Weapon between what’s written in the DMG and the SRD.

The DMG states:

When you roll a 20 on your attack roll with this magic weapon, the target takes an extra 7 damage of the weapon’s type.

Whereas the SRD says:

When you roll a 20 on your attack roll with this magic weapon, the target takes an extra 2d6 damage of the weapon’s type.

I checked the DMG errata and there hasn’t been a correction added there.

Has this been updated elsewhere and which text is meant to be the correct damage for Viscious Weapon: 7 or 2d6?

P.S I know the average roll of 2d6 is going to be about 7 anyway but that’s not the point.

Correct application of the CFL Pumping Lemma

I came across this question about showing that the language $ L = \{w \epsilon \{a, b, c\}^*: n_a(w) + n_b(w) = n_c(w)\}$ is context-free but not linear in the book by Peter Linz. That is easily doable by the separate pumping lemma for linear languages (as given in Linz’s book), but my question is different.

Evidently this is a CFL, and a pushdown automaton can be constructed for it. But if I apply the pumping lemma for CFLs, I find that I’m able to pump strings that don’t belong to the language, which would mean that the language is not a CFL. Clearly I’m doing something wrong.

Going by the "game-like" format given in Linz, say you pick $ w = a^mb^mc^{2m}$ , $ |w| \ge m$ . The adversary can choose a number of decompositions $ w = uvxyz$ , they can look like -:

  • $ v = a^k, y = a^l$ : The case where $ |vxy|$ is contained within the $ a$ ‘s of the string. Pump $ i = 0$ , and then $ w_0 = a^{m – (k + l)}b^mc^{2m}$ cannot be in the language since the equality no longer holds.
  • $ v = a^k, y = b^l$ : The case where $ v$ is in the $ a$ section, $ x$ spans across the $ a$ ‘s and $ b$ ‘s, and $ y$ is in the $ b$ section. Again, pump $ i = 0$ . $ w_0 = a^{m – k}b^{m – l}c^{2m}$ cannot be in the language.

There are more cases like these. Where am I going wrong in the application of the CFL PL?

What are the correct steps in solving polygon monotone triangulation?

I am working out enter image description here step by step and I am stuck on vertex 7. I got that it was a regular vertex and helper(e_i-1) is not a merge vertex so I look for the leftmost edge in the sweep line. My question is, would e6 be considered to the left of it, or is it none? Any already completed examples that I could see would help me understand this greatly.

Is my recursive algorithm for Equivalent Words correct?

Here is my problem.

Problem Given two words and a dictionary, find out whether the words are equivalent.

Input: The dictionary, D (a set of words), and two words v and w from the dictionary.

Output: A transformation of v into w by substitutions such that all intermediate words belong to D. If no transformation is possible, output “v and w are not equivalent.”

I need to write both recursive and dynamic programming algorithm. As for recursion, I came up with this algorithm. Is it correct?

 EquivalentWordsProblem(v, w, D)  1.m <- len (v)  2.n <-  len (w)  3.substitutions = [] #array to save substitutions   4.if m != n:  5.  return "v and w are not equivalent"  6.else  7.for i <- m to 1 <-1 do  8.  for j <- n to j <- 1 do  9.    if v[i] != w[j]:  10.           substituted_word <- v[1…i-1]+v[j] #we substitute v[i] for w[j]  11.              if substituted_word in D:  12.                substitutions.append(substituted_word)  13.                   return EquivalentWordsProblem(v[1…m-i], w, D) #recur on the string of length m - i  14.   else:          return EquivalentWordsProblem(v[1…m-1], w, D) #recur on the string decreasing its length by 1  15.if len(substitutions) != 0:  16.  return substitutions   17.else  18.   return (“v and w are not equivalent”)  

Why does my digital bank need my phone date and hour to be correct?

I’m not from Information Security or any IT related area. But I want to know if there is any security reason for my digital bank to demand my phone to be on "Automatic Date & Time"?

For example, if I’m abroad, i cannot transfer some money to a friend for because it says my date & time is incorrect.

Is that a badly programmed software or does it have a purpose?