dnd 5e – How can I build an effective weapon kata character?

Concept of character

For a new campaign I had the idea of ​​playing a John Wick-style construction that maximizes the effectiveness of hand crossbows with double grip. I want him to be a former mafia agent who escapes the law.

Optimizing

I want to optimize this character for Get the maximum number of crossbow attacks per turn. I have the following restrictions:

  • Use the standard matrix for the generation of statistics
  • Optimize for a character that ends at level 10
  • Make sure that my character is useful both in close combat and in the middle.
  • Have the necessary mobility to avoid fighting big enemies from head to toe.
  • The characteristics and multiclassification are fine.
  • The content of any published WotC book (excluding UA) is allowed
  • I can not assume access to any magical object.

What race, class levels and feats should I take to optimize this construction? Also, in what order should I take the levels and skills of level 1?

My hope is that my turn can replace an AOE spell by killing / almost killing several small enemies that are grouped together.

l5r – Like a Mirumoto bushi, should I learn the Kata Spinning Blades?

I am planning to create a bus from Num Mirumoto school for L5R 5e, and I was surprised to see that the Rank 2 Kata that was available in rank 1 was the Iaijutsu Cut: Rising Blade and not the Spinning Blades Style.

After reading the text of the Kata Spinning Blades, I realized that to use the Kata, I should not use the technique of the Mirumoto school (which makes sense after all). But I also realized that this is the case with the Mirumoto master technique of rank 6 (which is quite similar to the rotating blades).

Here are my questions:

  • Is it worth Spinning Blades, since I can not use it together with my school's technique (except in round 1 if I have initiative)?
  • Although the Spinning Blade is a bit more difficult to perform and does not have the same effect, is not the Master Technique a bit useless if I have the Spinning Blades from Rank 2?

As a reminder:

Rotating knife technique: (p.180) When performing a Martial Art [Melee or Unarmed] In action, you can take advantage of as many opportunities as you can to watch your target to inflict damage with another weapon (the damage increases if the target is stunned).

Path of the Dragon (School Skill): (p.68) Whenever they attack you, you can use a weapon ready to inflict a malus on your attacker or get a bonus in your next attack against him. This weapon can not be used for attack actions until the end of your next turn.

Heart of the Dragon (Mastery Skill): (p.68) Once per round, when performing an attack action, you can use the opportunity to perform a Strike action with another weapon prepared.

(Codewars Kata) Record cut memoised

(I'm not sure of the official CS name for the problem in question, so I just gave it the name of the kata).


issue

CLEAR CUTTER NEEDS YOUR HELP!

The Clear Cutter & # 39; s lumber company earns its money by optimizing the price-length ratio of each record they cut before selling them. An example of one of your price tables is included:

# So a price table p
p = [ 0,  1,  5,  8,  9, 10]

# You can imagine how:
# length i | 0 1 2 3 4 5 * in feet *
# price pi | 0 1 5 8 9 10 * in money * 

They hired an intern last summer to create a recursive function so that they can easily calculate the most profitable price for a record of length n using the price table p as follows:

def cut_log (p, n):
yes (n == 0):
return 0
q = -1
for i in rank (1, n + 1)
q = max (q, p[i] + cut_log (p, n-i))
come back

An example of the work code:

# 5 feet = $ 10, BUT 2 feet + 3 feet = 5 feet -> $ 5 + $ 8 = $ 13 that is greater in value

However, his senior software engineer realized that the number of recursive calls in the function gives him a horrible execution time of 2 ^ n (since this function is repeated in ALL the possibilities of 2 ^ n-1 for a record of length n).

Having discovered this problem just when he has arrived for his internship, he responsibly delegates the problem.

Using the power of Stack Overflow and Google, you want to create a solution that runs on Θ (n ^ 2) so that it does not take 5 hours to calculate the optimal price for a size 50 record. (It also suggests investigating the problem using the keywords on the labels)

(Note that if your algorithm is not efficient, you will try to observe 2 ^ 49 = 562949953421312 nodes instead of 49 ^ 2 = 2401 … The solution will fail automatically if it takes more than 6 seconds … what happens on the right around Log 23)


Solution

def cut_log (p, n):
for i in range (2, len (p)):
P[i] = max (p[i-k] + p[k] for k in range ((i // 2) +1))
return p[n]

Pass all the tests. I will put it for review because I am quite proud of it and of the experience that has shown me that, in general, some improvements must be made.

java – Mix of strings Code Wars Kata

Problem Statement

Given the two chains s1 and s2, we want to visualize how different the two chains are. We will only consider the lowercase letters (from A to Z). First, let's count the frequency of each lowercase letter in s1 and s2.

s1 = "A yyyy bb c"

s2 = "& aaa bbb c d"

s1 is 4 & # 39 ;, 2 & # 39; b & # 39 ;, 1 & # 39; c & # 39; c & # 39;

s2 is 3 & # 39 ;, 3 & # 39 ;, 1 & # 39 ;, 1 & # 39; d & # 39;

Then the maximum for & # 39; a & # 39; in s1 and s2 is 4 from s1; the maximum for & # 39; b & # 39; is 3 of s2. In what follows we will not consider the letters when the maximum of their occurrences is less than or equal to 1.
We can resume the differences between s1 and s2 in the following string: "1: yyyy / 2: bbb" where 1 in 1: yyyy means string s1 and yyyy because the maximum for a is 4. In the same way 2: bbb represents the string s2 and bbb because the maximum for b is 3.
The task is to produce a string in which each lowercase letter of s1 or s2 appears as many times as many if this maximum is strictly greater than 1; These letters will be preceded by the number of the chain where they will appear with their maximum value and :. If the maximum is in s1 and in s2, the prefix is ​​=:.

In the result, substrings (a substring is for example 2: nnnnn or 1: hhh; contains the prefix) will be in descending order of their length and when they have the same length ordered in ascending lexicographical order (letters and digits - more precisely ordered per code point); The different groups will be separated by & # 39; / & # 39 ;. See examples and "Sample tests".
Hopefully, other examples can clarify this.
s1 = "my & friend & Paul has heavy hats! &"
s2 = "my friend John has many friends and"
mix (s1, s2) -> "2: nnnnn / 1: yyyy / 1: hhh / 2: mmm / 2: yyy / 2: dd / 2: ff / 2: ii / 2: rr / =: ee / = : H.H "

s1 = "mmmmm m nnnnn and & friend & Paul has heavy hats! &"
s2 = "my frie n d Joh n has ma n y ma n and frie n ds n &"
mix (s1, s2) -> "1: mmmmmm / =: nnnnnn / 1: yyyy / 1: hhh / 2: yyy / 2: dd / 2: ff / 2: ii / 2: rr / =: ee / = : H.H " 
s1 = "Are the children at home? aaaaa fffff" s2 = "Yes, they are here! aaaaa fffff" mix (s1, s2) -> "=: aaaaaa / 2: eeeee / =: fffff / 1: tt / 2: rr / =: hh" Note for Swift, R, PowerShell The prefix =: is replaced by E: s1 = "mmmmm m nnnnn and & friend & Paul has heavy hats! &" s2 = "my frie n d Joh n has ma n y ma n and frie n ds n &" mix (s1, s2) -> "1: mmmmmm / E: nnnnnn / 1: yyyy / 1: hhh / 2: yyy / 2: dd / 2: ff / 2: ii / 2: rr / E: ee / E : H.H "

Here is my solution:

public class StringMixKata {

Private static final set uniqueAlphabets = new LinkedHashSet <> ();
Private static end string LOWER_CASE_ALPHABET_NEGATED_REGEX = "[^a-z]+ ";
Final static private string EQUALITY = "=";
Private static end string COLON = ":";
Private static end string FORWARD_SLASH = "/";
Private static end string EMPTY_STRING = "";
Private static end string EMPTY_CHARACTER = " 0";
static end private int MINIMUM_FREQUENCY_REQUIRED = 2;


String static private StringMix (String s1, String s2) {
s1 = removeAllCharactersExceptLowerCaseAlphabets (s1);
s2 = removeAllCharactersExceptLowerCaseAlphabets (s2);
Map s1CharacterFrequencyMap = calculateFrequency forEachAlphabetAndAddEachAlphabetToSetOfUnique (s1);
Map s2CharacterFrequencyMap = calculateFrequency forEachAlphabetAndAddEachAlphabetToSetOfUnique (s2);
List finalList = createListOfFrequenciesForFinalString (s1CharacterFrequencyMap, s2CharacterFrequencyMap);
return formatString (finalList);
}

Private static string removeAllCharactersExceptLowerCaseAlphabets (final string entry) {
return input.replaceAll (LOWER_CASE_ALPHABET_NEGATED_REGEX, EMPTY_STRING);
}

/ **
* Calculate the frequency of each character in the string and return the frequencies
* of the characters as a {@link Map} with the characters like the key and the frequency
* as the value of the map. This function also adds each character to a {@link Set} of Unique
* alphabets
* @param input
* @return Map
* /
Static private map CalculateFrequencyForEachAlphabetAndAddEachAlphabetToSetOfUnique (final entry of String) {
Map alphabetFrequency = new HashMap <> ();
for (char alphabet: input.toCharArray ()) {
uniqueAlphabets.add (alphabet);
if (alphabetFrequency.containsKey (alphabet)) {
int frequency = alphabetFrequency.get (alphabet) +1;
alphabetFrequency.put (alphabet, frequency);
}plus{
alphabetFrequency.put (alphabet, 1);
}
}
return alphabetFrequency;
}

/ **
* Create a list of objects {@link AlphabetFrequencyAndOrigin}.
* The final list contains the most frequent alphabets with their origin.
* This list only contains elements for each alphabet. 
* For example if there is a character & # 39; a & # 39 ;. Now a map has a frequency of 3 and the map Other has * a frequency of 4. Therefore, any entry will be added to the return list with a frequency of 4 with the origin * Set as the last. Before returning the list, this function will also sort the list according to the frequencies * of the alphabets. If the frequencies are equal for two alphabets, then the elements would be compared alphabetically. * @param s1CharacterFrequencyMap * @param s2CharacterFrequencyMap * @return List * / Private static list createListOfFrequenciesForFinalString (final map s1CharacterFrequencyMap, final map s2CharacterFrequencyMap) { final list finalList = new LinkedList <> (); for (alphabet of characters: uniqueAlfabetos) { if (bothTheMapsContainTheAlphabetWithSameFrequency (s1CharacterFrequencyMap, s2CharacterFrequencyMap, alphabet)) { if (s1CharacterFrequencyMap.get (alphabet) <MINIMUM_FREQUENCY_REQUIRED) continues; finalList.add (new AlphabetFrequencyAndOrigin (null, alphabet, s1CharacterFrequencyMap.get (alphabet))); } if (bothTheMapsContainTheAlphabet (s1CharacterFrequencyMap, s2CharacterFrequencyMap, alphabet)) { if (s1CharacterFrequencyMap.get (alphabet) < s2CharacterFrequencyMap.get(alphabet)){ finalList.add(new AlphabetFrequencyAndOrigin(2,alphabet,s2CharacterFrequencyMap.get(alphabet))); } if(s1CharacterFrequencyMap.get(alphabet) > s2CharacterFrequencyMap.get (alphabet)) { finalList.add (new AlphabetFrequencyAndOrigin (1, alphabet, s1CharacterFrequencyMap.get (alphabet))); } }plus{ if (s1CharacterFrequencyMap.get (alphabet)! = null && s1CharacterFrequencyMap.get (alphabet)> = MINIMUM_FREQUENCY_REQUIRED) finalList.add (new AlphabetFrequencyAndOrigin (1, alphabet, s1CharacterFrequencyMap.get (alphabet)); if (s2CharacterFrequencyMap.get (alphabet)! = null && s2CharacterFrequencyMap.get (alphabet)> = MINIMUM_FREQUENCY_REQUIRED) finalList.add (new AlphabetFrequencyAndOrigin (2, alphabet, s2CharacterFrequencyMap.get (alphabet)); } } Collections.sort (finalList); return finalList; } static boolean private, bothMapsContainTheAlphabet (final map s1, final map s2, final character alphabet) { return s1.containsKey (alphabet) && s2.containsKey (alphabet); } static static boolean, bothMapsContainTheAlphabetWithSameFrequency (final map) s1, final map s2, final character alphabet) { return both TheMapsContainTheAlphabet (s1, s2, alphabet)? s1.get (alphabet) .equals (s2.get (alphabet)): Boolean.FALSE; } / ** * Create a string where each alphabet is denoted by its origin & # 39;: & # 39; number of times the character is repeated. Y * Each character is linked by & # 39; / & # 39 ;. Then an example would be:
* 1: mmmmmm / =: nnnnnn / 1: yyyy / 1: hhh / 2: yyy / 2: dd / 2: ff / 2: ii / 2: rr / =: ee / =: ss.
*
* The equality character means that the origin is null. * @param finalSet * @he came back * / String of private static string format (final list finalSet) { StringBuilder builder = new StringBuilder (); for (AlphabetFrequencyAndOrigin item: finalSet) { if (item.getOrigin () == null) builder.append (EQUALITY); else builder.append (item.getOrigin ()); constructor.append (COLON); builder.append (repeatAlphabet (item.getAlphabet (), item.getFrequency ())); builder.append (FORWARD_SLASH); } constructor = removeTheLastForwardSlash (constructor); returns builder.toString (); } / ** * This method returns a string "yyyy" if it happens & # 39; a & # 39; as the character and 4 as the frequency. This method * is an implementation of the character multiplication operation. Copied the implementation from * * Simple way to repeat a string in java. . This is really smart. * @param alphabet * @param frequency * @return String * / Private static string repeatAlphabet (final character alphabet, final int frequency) { returns new string (new char[frequency]) .replace (EMPTY_CHARACTER, String.valueOf (alphabet)); } StringBuilder static private removeTheLastForwardSlash (generator of StringBuilder final) { return builder.replace (builder.lastIndexOf (FORWARD_SLASH), builder.length (), EMPTY_STRING); } }; / ** * A class that contains the number of String to which the alphabet belongs and the frequency of the alphabet. * This is just a container class that also helps classify by implementing the {@link Comparable} interface. * If the origin is set to null, it is assumed that the alphabet is present in both the compared string. * * / The AlphabetFrequencyAndOrigin class implements Comparable{ private final whole origin; Private final character alphabet; Private final integer frequency; Public AlphabetFrequencyAndOrigin (origin of integer, character alphabet, frequency of integer) { this.original = origin; this.alphabet = alphabet; this.frequency = frequency; } Integer public getOrigin () { origin of return; } Public character getAlphabet () { return alphabet } Public integer getFrequency () { return frequency } @Cancel public int compareTo (AlphabetFrequencyAndOrigin o) { if (origin == null && o.getOrigin () == null && frequency.compareTo (o.getFrequency ()) == 0) return alphabet.compareTo (o.getAlphabet ()); return frequency.compareTo (o.getFrequency ()) == 0? alphabet.compareTo (o.getAlphabet ()): o.getFrequency (). compareTo (frequency); } }

I programmed the solution in Java 7. The reason why I did it is because I have a hard time understanding the flows and the provider, the concepts of consumers in Java 8 (I do not know why Java is becoming a functional programming language) . I know that the solution can be drastically improved in java 8.

The order of the chains in the output would not match some sample inputs provided. The author specifically said lexicographical order and wrote the compare with Work that way only. Am I doing something wrong here or have I misinterpreted something?

Is there any space for improvements here? Is there something wrong with my approach? I need your opinions.