Writing a list of names, with a limited amount of “active” letters at a time. Algorithm to sort the names to reduce the amount of swapping letters?

While making name-tags for a dinner seating, I stumbled upon a problem which I can’t find any algorithm to solve, and I’m not sure where to begin.

The goal is to write the name of each dinner guest on a card, completing one name at a time. The names are written with old-fashioned rubber stamps, so only 6 letters can be "active" at any given time. When a new letter is required, one of the active letters has to be swapped out for the new letter.

The problem is to sort the names in such an order, that I need to do the least amount of letter-swapping.

I want to write the names:

  • Jack
  • Julie
  • Chuck

I can do this with 3 letter-swaps
Initial letters: J A C K H U
Write: Jack, Chuck

{swap A, C, K with L, I, E}

New active letters: J L I E H U
Write: Julie

Now I want to find an algorithm that, given a list of names and a limit of active characters, provide the order of names and which letters to swap at each name, to reduce the total amount of letter-swaps.

Any ideas or pointers are welcome.

Amount of spells wizard can prepare

Looking at the Dungeon Worlds’s Wizard playbook Prepare Spells move, it seems quite clear how it works at the first reading:

When you spend uninterrupted time (an hour or so) in quiet contemplation of your spellbook, you:

  • Lose any spells you already prepared
  • Prepare new spells chosen from your spellbook whose total levels don’t exceed your own level +1
  • Prepare your cantrips which never count against your limit

So, assuming that wizard reaches 9th level (not very realistic in DW, but just for sake of argument), and decides to take one of the 9th lvl spells, he will have two spells prepared – his 9th level and some other 1st level. If he had chosen proper moves while advancing, he could possibly prepare 9th level and 3 1st level spells, but that’s it.

Do I understand it correctly, that regarding spells, wizard is a one-trick pony, unless he reaches high level and decides to stick with only with low-level spells?

What is the maximum amount of damage per turn for a 7th level player character? [closed]

I’m making an appearance in a friend’s game as a visiting mercenary and I’d like for my character to make an impression. I was thinking about putting 5 levels into Battle Master Fighter to be able to get the sharpshooter feat, and then putting 2 levels into war cleric to get the +10 to offset sharpshooter, but I’m wondering if there are even greater heights of possible maximization that I’m missing.

Is the languague L={, M accepts a finite amount of words} decdidable?

Is $ L=\{<M> | L(M) \ is \ finite\} $ decidable ? M is a TM.

I think its relative simple to proof with the theorem of rice. But I am interested in a solution which does not use the Rice theorem.

This my try : Let f(<m,w>) be a function which works in the following way :

  1. Run w on M
  2. If M accepts Construct a TM Mwhich accepts only the word w and return M
  3. If M rejects Construct a TM Mwhich accepts everything. Return M

So if m is in $ A_{TM}= \{<M,w>|M \ accepts \ w\}$ we know that f(<m,w>) is in L. If m is not in A then we know that f(<m,w>) does accept every word and therefore infinity words. So f(<m,w>) not in L.

Is this a correct mapping reduction ?

What’s the highest amount of ranged attacks a pure fighter can make in one turn consistently?

I’ve been working on a 20th level character concept for a while and trying to optimize it for use in a future game, the requirements would be as follows:

  • Only 3.X WotC handbooks (No 3rd party books, no magazines, no online-only content except for web enhancements of handbooks, no adventure-specific content).
  • Only handbooks from the D&D 3E standard setting/Greyhawk (no eberron, faerun, dragonlance, etc).
  • The only base class used must be fighter, any prestige class is ok as long as it doesn’t grant any magical abilities (includes psionics, incarnum, etc), also no martial powers.
  • Optimized for ranged damage output, without relying on allies, consumables, or very low frequency abilities (1/day stuff and the like).

Given that, the concept I’ve got so far is a pure SAD dexterity fighter dual wielding auto-realoading hand-crossbows, boosting damage with feats Dead Eye and Crossbow Sniper, plus specialization and mastery feats. The damage per attack is not too bad (1d4+31), and I’m now looking for ways to increment the number of attacks I could make.

So far I get 4 attacks from BAB, 3 from TWF, 1 from Rapid Shot, and 1 from Haste, for a total of 9 attacks.

I’m specifically looking for methods to increase the number of attacks per full attack action. But I’d also welcome any general advice to improve the build given the previous requirements.

Minimization of amount in the change coins problem using the dynamic programing approach

I’m learning the dynamic programming approach to solve the coins change problem, I don’t understand the substitution part

Given: amount=9, coins = [6,5,1],

the instructor simplified it with this function:

minCoins = min {(9-6)+1 , (9-5)+1, (9-1) +1} = min{4, 5, 9} = 4

I don’t understand the logic of this min method: why we say that to change amount of 9 coins, we can simply, take the minimum of: 9 – {all coins} +1 ?

here’s a Gif that visualizes the instructor’s approach: https://i.stack.imgur.com/Zx2cG.gif

(*taken from the Algorithmic Toolbox course/ instructor: Prof. Pavel A. Pevzner)

what determines the amount of threads you can use

what determines the amount of threads you can use ? (in order to get more done in the same amount of time)

the reason im asking is because i have seen some posts say they would need minimum 16GB of ram,
but also that GSA SER is 32 bit & that anything over 3GB of ram would not make any difference.

ive taken account of various things to try & make it more efficient etc. & keeping an eye of
memory & cpu usage at bottom of GSA SER interface.

i have 4gb of ram, so would getting more ram make any difference ?

Woocommerce Booking – Display selected block amount or duration

I am using Woocommerce Booking plugin and I would like to display the number of blocks a user is about to book.


  • Create bookable product with 30 minute blocks, min:1, max;4
  • User selects start:9:00, end:10:30
  • Front end displays calculated price and “3 Blocks”

Is this possible? and how would I go about doing this? Is there a hook or is it a template change?

Minimum amount of time for two enemies to reach their destinations?

Given an undirected, unweighted, and connected graph $ G = (V, E)$ , what is the minimum amount of time it takes for party $ X$ to go from $ s_x$ to $ t_x$ and party $ Y$ to go from $ s_y$ to $ t_y$ ? At each unit of time, $ X$ and $ Y$ can either move to a vertex adjacent to their current position or not move at all. However, $ X$ and $ Y$ are enemies with each other and if they go less than a distance of $ k$ to each other they will go to war. The distance of $ X$ and $ Y$ is defined as the number of edges between them. What is an efficient algorithm to find the two optimal paths such that $ X$ and $ Y$ do not go to war and they both reach their destinations in the minimum amount of time? Note that the two paths can share edges as long as $ X$ and $ Y$ do not go less than k units of each other during their traversal. In the example below with $ k$ = 1 the optimal path for $ X$ is in blue and y is in red. This allows for both $ X$ and $ Y$ to reach their destination in two units of time Notice, if $ X$ instead took the black path, this would be suboptimal as $ Y$ would have to rest for one unit of time as $ X$ moved out of the way. (This would take 3 units of time.) enter image description here

So far I’ve started by computing the shortest paths between all pairs of vertices in $ V$ by doing a BFS at each vertex. This will take $ O(EV)$ Then, I suggest the following greedy algorithm:

At each time tick, $ X$ and $ Y$ should move to the vertex that is closest to their destination. If that vertex is less than k edges from the other party, choose the next closest vertex and so on. If no such vertex exists, then the current party will rest until the other party moves at least k units away from any of the adjacent vertices. Give priority to $ X$ or $ Y$ based on who has fewer options.

However, I don’t think the greedy solution will work. Some other ideas include A* or a max flow reduction.