dnd 5e – Character class and race comparisons between Warhammer 40k and D & D 5e

I play Dnd 5e with a group of friends and we have been Dnd players for years, but one of our friends has been obsessed with Warhammer for several years. We decided to give it a try, especially the Warhammer 40k RPG.

It seems to be a fairly complex game. I think the problem is that none of us know anyone who has ever played it firsthand. I watched YouTube videos, the obsessed friend made a small RPG game, two members of the group balked at the latest "rule book" and tried games at night, and occasionally five of us tried to play together. Unfortunately, every time it's a comedy with mistakes, because we decide that the rules work differently each time and it never seems right. But in any case, everything is fun.

Here's my question: The races seem to be extremely different between D&D and the Warhammer 40k RPG game, and I'm struggling to find similarities between the classes. Does anyone know how to compare any races or classes between the two games? For example, would a Space Marine in the Warhammer 40k RPG game be something like a paladin in dnd 5e?

Does somebody know?

How can you predict the number of comparisons QuickSort will make if you know the percentage by which the array is pre-sorted?

I have found that when you use a logarithmic scale, the number of comparisons made by a naive implementation of QuickSort is related to the percentage of items already sorted:
Curly bracket-shaped curve
How can this curve be described mathematically in the form of a curly bracket (the red curve represents the behavior of the c ++ "sort" function and appears to be much more complicated)? If exactly possible, you can accurately predict how many comparisons QuickSort would make by simply traversing the array, counting the number of elements for which array (i) <array (i + 1), and inserting that number into a Formula. I tried to find a mathematical formula that approximates using a genetic algorithm. In the end I found the following:


Here it says & # 39; f & # 39; for the number of comparisons made by QuickSort, & # 39; n & # 39; for the number of elements in the array and & # 39; s & # 39; for the proportion of elements that are already sorted: -1 if the array is in reverse order, 1 if it is already sorted, and approximately 0 if it is mixed randomly.

Can you think of a better formula?

java sorting algorithms – find comparisons and motions

    package faculdade;

import java.util.Random;

public class Ordenacao {

    public static long comparacao;

    public static long movimentacao;

    public static void main(String() args) {
        int() vetor = new int(1000);
        System.out.println("Vetor criado:");
        // show(vetor);
        // tempo inicial
        long tempoInicial = System.currentTimeMillis();
        //quickSort(vetor, 0, vetor.length - 1);
        // tempo final
        long tempoFinal = System.currentTimeMillis();

        System.out.println("Executado em = " + (tempoFinal - tempoInicial) + " ms");
        System.out.println("n Comparações: " + comparacao + " Movimentaçoes: " + movimentacao);


    public static void selectionSort(int() vetor) {
        comparacao = 0;
        movimentacao = 0;
        for (int i = 0; i < vetor.length - 1; i++) {
            int menor = i;
            for (int j = i + 1; j < vetor.length; j++) {
                if (vetor(j) < vetor(menor)) {
                    menor = j;

            swap(vetor, i, menor);
            // show(vetor);

    public static void bubbleSort(int() vetor) {
        movimentacao = 0;
        comparacao = 0;
        for (int i = vetor.length; i >= 1; i--) {
            for (int j = 1; j < i; j++) {
                if (vetor(j - 1) > vetor(j)) {
                    swap(vetor, j, j-1);

    public static void insertionSort(int() vetor) {
        comparacao = 0;
        movimentacao = 0;
        for (int i = 1; i < vetor.length; i++) {
            int current = vetor(i);
            int j = i - 1;
            while (j >= 0 && current < vetor(j)) {
                vetor(j + 1) = vetor(j);
            // at this point we've exited, so j is either -1
            // or it's at the first element where current >= a(j)
            vetor(j + 1) = current;


    public static void quickSort(int vetor(), int esquerda, int direita) {

        int esq = esquerda;
        int dir = direita;
        int pivo = vetor((esq + dir) / 2);
        int troca;

        while (esq <= dir) {
            while (vetor(esq) < pivo) {
                esq = esq + 1;

            while (vetor(dir) > pivo) {
                dir = dir - 1;

            if (esq <= dir) {
                troca = vetor(esq);
                vetor(esq) = vetor(dir);
                vetor(dir) = troca;
                esq = esq + 1;
                dir = dir - 1;

        if (dir > esquerda) {
            quickSort(vetor, esquerda, dir);


        if (esq < direita) {
            quickSort(vetor, esq, direita);



    public static void fill(int() vetor) {
        Random r = new Random();
        for (int i = 0; i < vetor.length; i++) {
            vetor(i) = r.nextInt(100);

    public static void show(int() vetor) {
        for (int i = 0; i < vetor.length; i++) {
            System.out.print(vetor(i) + " ");

    public static void swap(int() vetor, int a, int b) {
        int aux = vetor(a);
        vetor(a) = vetor(b);
        vetor(b) = aux;



At runtime, the comparison number corresponds to the train number. I think that's wrong

SQL Server – How do I avoid tons of lower (column) in the WHERE clause for multiple LIKE comparisons?

I need to filter data in a string column and therefore compare the column with NOT LIKE to a series of strings. I use SQL Server. Now my code looks like this:

SELECT history.date,
FROM   item_history history, 
       owned_resource   res
WHERE  (history.attr_name = 'resource_contact' OR history.attr_name = 'Kontakt-UUID')
       AND res.inactive = 0 
       AND history.com_par_id = res.own_resource_uuid
       AND lower(history.new_value) NOT LIKE '%tp für%'
       AND lower(history.new_value) NOT LIKE '%rücklieferung%'
       AND lower(history.new_value) NOT LIKE '%rückläufer%'
       AND lower(history.new_value) NOT LIKE '%stoerreserve%'
       AND lower(history.new_value) NOT LIKE '%zentrallager%'
       AND lower(history.new_value) NOT LIKE '%bhs-pool%'
       AND lower(history.new_value) NOT LIKE '%lager halle%'        
       AND lower(history.new_value) NOT LIKE '%lager logistik%'
       AND lower(history.new_value) NOT LIKE 'reserve %'
       AND lower(history.new_value) NOT LIKE '%igeko%bhs%'
       AND lower(history.new_value) NOT LIKE '%service%ecg%'
       AND lower(history.new_value) NOT LIKE '%multifunktionsdrucker%'
       AND lower(history.new_value) NOT LIKE 'nn%gisa%raum%'
       AND lower(history.new_value) NOT LIKE '%citrix%admins%'
       AND lower(history.new_value) NOT LIKE '%personalwesen%'
       AND lower(history.new_value) NOT LIKE '%etagendrucker%'
       AND lower(history.new_value) NOT LIKE '%schulungsraum%'
       AND lower(history.new_value) NOT LIKE '%team%raum%'
       AND lower(history.new_value) NOT LIKE  '%beratungsraum%'
       AND lower(history.new_value) != 'reserve'

I think the performance is not the best, which keeps calling "lower ()". As a programmer my nails roll up and see so much redundant code.
Unfortunately, I have not found a good way to use a variable or similar.
(I'd like to add that I can NOT just add a new computed column, which is a good option since I am only authorized to read data.)

Does anyone have a good idea to make the code smarter? Thank you in advance!


Use of variables in jQuery comparisons

Hello, I have two divs, one with the data-coc = "2" and the other with the data-coc = "1". My problem is that when I use a variable to hide the divs, both are hidden, but when I use a value, it works correctly

Use variable

var testing = "1";
$('.bookitem').not('(data-coc ~= testing)').hide();

Use value

$('.bookitem').not('(data-coc ~= "1")').hide();

Sort – sort or data structure with the fewest comparisons, if the list is mostly sorted

For example, suppose you have a list of about 50 items that are already sorted, and you add three items either at the bottom of the list or at an unsorted midway point. Now you want to reorder the list with as few comparisons as possible. Which sorting algorithm or data structure would you use?


I am writing an online sorter app in which the comparisons are subjective. Consider the case in which you want to find out who you want to invite to your wedding n (eg 200) persons and m < n (eg 100) seats. They want a way to find the top m most important people to invite.

In this use case, the comparisons are the only important processing time because user input is required. The actual sorting of such a small number of elements takes place within a fraction of a second behind the scenes. Regardless of how inefficient the sorting is, it is not compared to the time spent comparing two persons / families.

I have found for thoroughly mixed lists that an AVL tree (with stored comparisons) is indeed the most efficient, although it is one of the least efficient self-balancing trees in the real world. For 58 elements it beats Quicksort by an average of 17 comparisons and merges the sort order by 73.

Suppose the user sorts his list and then notes three people he forgot to add. Your inputs are now sorted, but instead of doing what they probably do not know is a paste sort, just add the items to the bottom of their list and click the Sort button again. At this point, we do not yet know that the list is mostly sorted or that only the last three elements are new. Therefore, we can not do any insertion sorting ourselves. I specify options and descriptions for various sorting algorithms so they can choose which algorithm is most efficient for them. For unsorted lists, the AVL tree algorithm is best suited. For "mostly sorted" lists I introduce another algorithm option.

If the list is already sorted, ideally this is what is needed n-1 Comparisons. If there are 3 unsorted elements, this is required 3n Comparisons in the worst case and ~3n/2 on average, assuming that the elements belong in the middle of the list.

My instinct says Bubble Sort – another unlikely algorithm – would be best for my scenario, but I do not know enough about the numerous sorting algorithms to be sure. (I could be wrong too if the paste is impossible / inefficient.)

Operators – Why do string comparisons produce different results and how does "locale" affect string operations?

Why do string comparisons yield different results, and how can software be developed to achieve a desired result if the "locale" affects the string operations?

Reference – Would "I" ~ == "i" be true or false? Does the answer change when you execute the code in Turkey?

Software Engineering Stack Exchange is a Q & A site for professionals, academics, and students working in the system development lifecycle.

To ask about:

  • Methods and practices of software development
  • Requirements, architecture and design
  • Quality assurance and testing
  • Configuration, build and release management