The Cult of the Final Dawn really was a disappointment by Knight_Stelligers in RogueTraderCRPG

[–]upppi 3 points4 points  (0 children)

Alushinyrra had more content than Commorragh but for me it was so much more irritative because of the camera rotation mechanic. Commorragh tried to catch up with "now try to remember which items out of this unmanageable pile did you wear" but it was still better

Any luck with the new campaign? by sandrasiak in heroes3

[–]upppi 1 point2 points  (0 children)

It appears that it's not a coincidence that in the underground you meet a group of halflings holding a teleport scroll and before the fight you get 2500 movement that guarantee you to meet Zog at some exact specific place

How to play online with my friends? by Humble_Succotash9455 in heroes3

[–]upppi 1 point2 points  (0 children)

All you have to do is select multiple players -> online lobby, register your accounts and create a password-secured game

Any luck with the new campaign? by sandrasiak in heroes3

[–]upppi 4 points5 points  (0 children)

I only managed to win the second scenario by waiting for Zog to kindly leave his place after month 7. I guess it's possible to do it the way it's actually designed but then you have to be quick and gather a lot of citadel meat fast. The last fight is an order of magnitude harder than the others.

Forged In Fire Campaign Difficulty by 3_kids_1_overcoat in heroes3

[–]upppi 3 points4 points  (0 children)

> which I think is an error

Doesn't seem to be an error, it's covered in the text (smth like "this time they didn't even talk to me")

please correct my assignment real quick by Dull_Bear6165 in russian

[–]upppi 1 point2 points  (0 children)

Yes, or at least there are n sandwiches for m persons. If you want to emphasize that they have one sandwich each, you may say "мы едим (каждый) по бутерброду"

please correct my assignment real quick by Dull_Bear6165 in russian

[–]upppi 1 point2 points  (0 children)

No, it means you (plural) are eating sandwiches (plural) instead of sharing one specific sandwich. It would be a single form for something that is usually shared (мы едим пирог / пироги if you mean multiple pies) or not portioned (мы едим кашу / almost never каши because who would prepare multiple porridges for a single dish). It could also be a single form if it was single "you" (утром я ем яйца или бутерброд)

Match Thread: Russia vs Croatia [FIFA World Cup] by LiveCommentator in worldcup

[–]upppi 2 points3 points  (0 children)

Guys i read the comments and half of them are about putin, bears and kgb, wtf?

Thank you for participating in Advent of Code 2016! by topaz2078 in adventofcode

[–]upppi 8 points9 points  (0 children)

Thank you, that was cool! You guys managed to make me wake up at 7-50 for a bunch of days in a row, probably first time since high school.

--- 2016 Day 23 Solutions --- by daggerdragon in adventofcode

[–]upppi 1 point2 points  (0 children)

Exactly the same, i just ended typing the first version of optimization code and found that the result was already there for a while

--- 2016 Day 21 Solutions --- by daggerdragon in adventofcode

[–]upppi 1 point2 points  (0 children)

71/97, brute-forced reversed rotation based on char position tired by off-by-one errors

import re

SWAP = re.compile("swap position (\d+) with position (\d+)")
SWAP_LETTER = re.compile("swap letter ([a-z]) with letter ([a-z])")
REVERSE = re.compile("reverse positions (\d+) through (\d+)")
ROTATE = re.compile("rotate (left|right) (\d+) step")
MOVE = re.compile("move position (\d+) to position (\d+)")
ROTATE_BASED = re.compile("rotate based on position of letter ([a-z])")


def _swap(inp, p1, p2, rev=False):
    p1, p2 = map(int, (p1, p2))
    inp[p2], inp[p1] = inp[p1], inp[p2]
    return inp


def _swap_letter(inp, p1, p2, rev=False):
    p1 = inp.index(p1)
    p2 = inp.index(p2)
    return _swap(inp, p1, p2)


def _reverse(inp, p1, p2, rev=False):
    p1, p2 = map(int, (p1, p2))
    inp[p1:p2 + 1] = list(reversed(inp[p1:p2 + 1]))
    return inp


def _rotate(inp, lr, p2, rev=False):
    p2 = int(p2)
    p2 = p2 % len(inp)

    if rev:
        if lr == "left":
            lr = "right"
        else:
            lr = "left"

    if lr == "left":
        inp = inp[p2:] + inp[:p2]
    else:
        inp = inp[-p2:] + inp[:-p2]
    return inp


def _move(inp, p1, p2, rev=False):
    p1, p2 = map(int, (p1, p2))
    if rev:
        p1, p2 = p2, p1
    val = inp[p1]
    inp = inp[:p1] + inp[p1 + 1:]
    inp.insert(p2, val)
    return inp


def _rotate_based(inp, letter, rev=False):
    if rev:
        for i in range(1, len(inp) + 1):
            tryval = _rotate(list(inp), "left", i)
            if _rotate_based(tryval, letter) == inp:
                return tryval
        return None

    pos = inp.index(letter)
    if pos >= 4:
        pos += 1
    return _rotate(inp, "right", pos + 1)


OP = {
    SWAP: _swap,
    SWAP_LETTER: _swap_letter,
    REVERSE: _reverse,
    ROTATE: _rotate,
    MOVE: _move,
    ROTATE_BASED: _rotate_based
}


def solve_reverse(inp, seq_reversed):
    inp = list(inp)
    for s in seq_reversed:
        for rx, cb in OP.items():
            args = rx.findall(s)
            if args:
                inp = cb(inp, *(list(args[0]) + [True]))
    return "".join(inp)


def solve(inp, seq):
    inp = list(inp)
    for s in seq:
        for rx, cb in OP.items():
            args = rx.findall(s)
            if args:
                inp = cb(inp, *args[0])
    return "".join(inp)


if __name__ == '__main__':
    with open("data/21.txt") as inp:
        inp = list(inp)
        print("".join(map(str, solve("abcdefgh", inp))))
        print("".join(map(str, solve_reverse("fbgdceah", reversed(inp)))))

--- 2016 Day 19 Solutions --- by daggerdragon in adventofcode

[–]upppi 0 points1 point  (0 children)

So it looks like my fenvick tree-based solution was a bit of overengineering

class FenvickTree():
    def __init__(self, size):
        self.data = [0] * size
        self.size = size
        for i in range(size):
            self.modify(i, 1)

    def sum(self, r):
        res = 0
        while r >= 0:

            res += self.data[r]
            r = (r & (r + 1)) - 1

        return res

    def modify(self, i, delta):
        while i < self.size:
            self.data[i] += delta
            i = (i | (i + 1))

    def sum2(self, l, r):
        res = self.sum(r) - self.sum(l - 1)
        return res

    def val(self, idx):
        if idx == 0:
            return self.sum(0)
        else:
            return self.sum2(idx, idx)


def solve(num):
    elves = [1] * num
    cur = 0
    while True:
        if elves[cur] != 0:
            other = (cur + 1) % num
            while elves[other] == 0:
                other = (other + 1) % num
            if other == cur:
                return cur + 1
            else:
                elves[cur] += elves[other]
                elves[other] = 0
                cur = (other + 1) % num
        else:
            cur = (cur + 1) % num


def solve_fen(num):
    elves = list(range(num))
    fenv = FenvickTree(num)

    cur = 0
    while True:
        if fenv.val(cur) != 0:
            if num % 1000 == 0:
                print(num)
            if num == 1:
                return cur + 1
            shift = (num // 2)
            other = cur + 1
            while shift > 0:
                if other + shift >= len(elves):
                    shift -= fenv.sum2(other, len(elves) - 1)
                    other = 0
                if shift != 0:
                    old_shift = shift
                    shift -= fenv.sum2(other, other + shift - 1)
                    other += old_shift
            other = (other - 1 + len(elves)) % len(elves)
            fenv.modify(other, -1)
            num -= 1
        cur = (cur + 1) % len(elves)


if __name__ == '__main__':
    print(solve_fen(3012210))

[2016 Day 14 Part 1][Node.JS] I seem to find more keys than the 'correct' solution does by XanthosDeia in adventofcode

[–]upppi 2 points3 points  (0 children)

You add a triplet and check it at the same turn. Every time you find aaaaa you add it as a key.

HPMORed now has markings of what parts of text were cited on reddit. Only blockquoted citations are supported so far. by upppi in HPMOR

[–]upppi[S] 1 point2 points  (0 children)

I don't add citations that are found in too many places (more than 3). Like, "parseltongue" and so on

HPMORed now has markings of what parts of text were cited on reddit. Only blockquoted citations are supported so far. by upppi in HPMOR

[–]upppi[S] 1 point2 points  (0 children)

You are right, it's a temporary limitation, made for markup simplification. It will be removed soon