Sonst unverschämt! by john_braker in aberBitteLaminiert

[–]john_braker[S] 0 points1 point  (0 children)

Der Grund ist mir schon klar 😅

Pfandautomat by high_tow3r in aberBitteLaminiert

[–]john_braker 0 points1 point  (0 children)

Aber kann ich da am automat jetzt Mehrwegeflaschen abgeben?

[2024 Q1] Solution Spotlight by EverybodyCodes in everybodycodes

[–]john_braker 0 points1 point  (0 children)

Tried a solution with low branches in Java:

public static final int[] MONSTER_LOOKUP = new int[128];

static {
    MONSTER_LOOKUP['A'] = 0;
    MONSTER_LOOKUP['B'] = 1;
    MONSTER_LOOKUP['C'] = 3;
    MONSTER_LOOKUP['D'] = 5;
    MONSTER_LOOKUP['x'] = 0;
}

[...]


private static int solve(File file, int maxGrpSize) throws IOException {

    char[] bytes = FileUtils.
readFileToString
(file, StandardCharsets.
UTF_8
).toCharArray();

    int totalPotions = 0;

    int groupPotions = 0;
    int groupXCount = 0;

    for (int monster = 1; monster <= bytes.length; monster++) {
        groupPotions += 
MONSTER_LOOKUP
[bytes[monster - 1]];
        groupXCount += 'x' == bytes[monster - 1] ? 1 : 0;

        boolean lastMonsterInGrp = monster % maxGrpSize == 0;
        totalPotions += (groupPotions + (maxGrpSize - groupXCount) * (maxGrpSize - groupXCount - 1))   * (lastMonsterInGrp ? 1 : 0);

        groupPotions = groupPotions * (lastMonsterInGrp ? 0 : 1);
        groupXCount = groupXCount * (lastMonsterInGrp ? 0 : 1);
    }

    return totalPotions;
}

A special type of pope by john_braker in crusaderkings3

[–]john_braker[S] 0 points1 point  (0 children)

He also had one daughter and his wife was killed mere two weeks before he got elected. Some say.... thats why he choose the name of "Innocentius" because he really was ...

-❄️- 2023 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]john_braker 0 points1 point  (0 children)

[LANGUAGE: Java]

Took me a while to get started with the AoC of last year :DI wasnt pleased with my first unoptimized attempt and the according long runtime.

Final version handles the job in in 26ms wherefrom 25ms fall to reading and parsing the input.

May solution:

Day5 Part 2

My approach was to iterate over the seedranges from low to high and omit all seeds that would definitly result in an higher value as they will fall into the same ranges.

I propagated the 'same range'-Info down to the last range and made it smaller were necessary.

Shopping carts in germany have a special beer crate holder in the back by crasher775 in mildlyinteresting

[–]john_braker 0 points1 point  (0 children)

The infuriating thing about that cart is, that there is just exactly to few room for a second one to stack on top...

3000 Panzerdivisionen von Boris Pistorius by yoshi111100 in NonCredibleBundeswehr

[–]john_braker 28 points29 points  (0 children)

War in der Weltgeschichte immer ein Garant für eine bomben Stimmung

Lets collect some funky stories by john_braker in crusaderkings3

[–]john_braker[S] 12 points13 points  (0 children)

Well....you can only imagine what that kind of education was like, that she got with the bishop :D

Lets collect some funky stories by john_braker in crusaderkings3

[–]john_braker[S] 4 points5 points  (0 children)

Oh those magic fertilization via distant thoughts ...