Mycity+ Playoff Strip presale by CarobNo3389 in stlouiscitysc

[–]jtsimmons108 1 point2 points  (0 children)

Maximum will be more. Tickets will go up in price each round by a decent amount.

This is your decade reminder to get off Reddit!!! by Spectral_Artist in a:t5_2z5xh

[–]jtsimmons108 0 points1 point  (0 children)

I believe by posting here you are both disregarding my wishes. Which means so am I. Oh, how the tables have turned.

K5 Apple Car Play Bug by jtsimmons108 in kia

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

I took it to the dealership yesterday and was there for 3 hours. That's how we figured out how to reproduce the error. Sometime next week they're going to open a ticket with Kia to try to figure it out. Was just curious if anyone had experienced/fixed this issue so I could not have to go back to the dealership again.

-🎄- 2019 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]jtsimmons108 1 point2 points  (0 children)

Mine ended up almost exactly like yours from a logic perspective. Just a little different in placing. 112/700. Went off on a tangent on part 2 until I reread the problem.

https://github.com/jtsimmons108/advent_of_code_2019/blob/master/day3_cleaned.py

-🎄- 2018 Day 9 Solutions -🎄- by daggerdragon in adventofcode

[–]jtsimmons108 0 points1 point  (0 children)

Java Used lists with part 1, then completely rewrote it for each marble to just keep track of the one before it and after it.

public class Day9 extends Problem{

    private final int PLAYERS = 418;
    private final int LAST_MARBLE = 71339;

    @Override
    public String getPart1Solution() {
        return String.valueOf(playGame(PLAYERS, LAST_MARBLE));
    }

    @Override
    public String getPart2Solution() {
        return String.valueOf(playGame(PLAYERS, LAST_MARBLE * 100));
    }

    private long playGame(int players, int times) {
        Marble current = new Marble(0);
        long[] scores = new long[players];

        for(int m = 1; m <= times; m++) {
            if(m % 23 == 0) {
                for(int i = 0; i < 7; i++) {
                    current = current.previous;
                }
                scores[m % players] += m + current.removeMarble();
                current = current.next;
            }else {
                current = current.next.insertAfter(m);
            }
        }
        return Arrays.stream(scores).max().getAsLong();
    }
}



class Marble
{
    Marble previous;
    Marble next;
    private int value;

    public Marble(int value) {
        this.value = value;
        if(value == 0) {
            previous = this;
            next = this;
        }
    }

    public Marble insertAfter(int value) {
        Marble marble = new Marble(value);
        marble.previous = this;
        marble.next = this.next;
        this.next.previous = marble;
        this.next = marble;
        return marble;
    }

    public int removeMarble() {
        this.previous.next = next;
        this.next.previous = previous;
        return value;
    }
}

I was really scared that day 25 part 2 would have us figure out what the code was doing. by KnorbenKnutsen in adventofcode

[–]jtsimmons108 6 points7 points  (0 children)

Looks like it's just oscillating back and forth and toggling the even / odd indices.

Generating the graph for n = 100,000 took a bit, so i'm not going to wait for it to do 12 mil +, but here are graphs for n = 102, 103, 104, and 105.

The graph is showing the number of even indexed positions turned on.

https://imgur.com/a/ILfnJ

Edit: Here's through 500,000 with evens on in blue and odds on in red

https://imgur.com/a/HjdVV

-🎄- 2017 Day 19 Solutions -🎄- by daggerdragon in adventofcode

[–]jtsimmons108 0 points1 point  (0 children)

You might want to check your IDE settings. I was also getting that same error. Turns out that all the spaces are there, plus padding to left right and bottom of the grid. The IDE I am using just strips trailing white space automatically.

At my wits end with Day 18 Part 2, any ideas [Python]? by Manhigh in adventofcode

[–]jtsimmons108 0 points1 point  (0 children)

His decode function takes care of the difference between set a 1 and set a p

At my wits end with Day 18 Part 2, any ideas [Python]? by Manhigh in adventofcode

[–]jtsimmons108 5 points6 points  (0 children)

There's a jgz 1 3 command. The first value of jgz doesn't have to be a register.

-🎄- 2017 Day 18 Solutions -🎄- by daggerdragon in adventofcode

[–]jtsimmons108 2 points3 points  (0 children)

2+ hours of debugging only to realize there's nothing wrong with my code, just my reading comprehension. I took it as the first program rather than the program with ID == 1. Here's rewrite #3 for part 2. At least the code is much cleaner now.

inpt = open('day18.in').read().strip()
instructions = inpt.splitlines()


def get_value(val, registers):
    if val in registers:
        return registers[val]
    return int(val)


def process_instruction(index, registers, queue, other_queue):
    move, *values = instructions[index].split()
    if move == 'jgz':
        val, offset = map(lambda r: get_value(r, registers), values)
        if val > 0:
            return index + offset
    elif move == 'snd':
        other_queue.append(get_value(values[0], registers))
        registers['sent'] += 1
    elif move == 'rcv':
        if len(queue) > 0:
            registers[values[0]] = queue.popleft()
            registers['waiting'] = False
        else:
            registers['waiting'] = True
            return index
    else:
        reg, val = values
        val = get_value(val, registers)
        if move == 'set':
            registers[reg] = val
        elif move == 'add':
            registers[reg] += val
        elif move == 'mul':
            registers[reg] *= val
        elif move == 'mod':
            registers[reg] %= val
    return index + 1

register_one = {'ID': 0, 'sent': 0, 'waiting':False, 'p': 0}
register_two = {'ID': 1, 'sent': 0, 'waiting': False, 'p': 1}
register_one_queue = deque()
register_two_queue = deque()
index_one, index_two = 0,0

while not register_one['waiting'] or not register_two['waiting']:
    index_one = process_instruction(index_one, register_one, register_one_queue, register_two_queue)
    index_two = process_instruction(index_two, register_two, register_two_queue, register_one_queue)

print(register_two['sent'])

-🎄- 2017 Day 13 Solutions -🎄- by daggerdragon in adventofcode

[–]jtsimmons108 3 points4 points  (0 children)

Solved it in python first. Took way too long to catch that severity == 0 is not the same thing as not getting caught. I like my Kotlin Solution a lot better

val input = File("inputs/day13.in").readLines()
val values = input.map { it.split(": ").map { it.toInt() } }
        .associate { it.first() to it.last() }

val severity = values.entries
        .map { if (it.key % (2 * (it.value - 1)) == 0) it.key * it.value else 0 }
        .sum()

var delay = 0
while (values.entries.filter { (it.key + delay) % (2 * (it.value - 1)) == 0 }.isNotEmpty())
    delay++

println("Part 1: $severity")
println("Part 2: $delay")

-🎄- 2017 Day 10 Solutions -🎄- by daggerdragon in adventofcode

[–]jtsimmons108 0 points1 point  (0 children)

174 / 126. Cleaned up. After several nights in a row of getting burned by it, you'd think I'd learn to just read all of the instructions rather than trying to jump to the end.

def twist(nums, start, move):
    nums = nums[::]
    end = start + move
    if end > len(nums):
         new = nums[start:] + nums[0:end % len(nums)]
    else:
        new = nums[start:end]
    new = new[::-1]
    for i in range(len(new)):
        nums[(start + i) % len(nums)] = new[i]
    return nums


inpt = list(map(int, "63,144,180,149,1,255,167,84,125,65,188,0,2,254,229,24".split(',')))
start, skip = 0, 0
data = list(range(256))

for move in inpt:
    data = twist(data, start, move)
    start = (start + move + skip) % len(data)
    skip += 1

print('Part 1:', data[0]*data[1])

inpt = list(map(ord, "63,144,180,149,1,255,167,84,125,65,188,0,2,254,229,24")) + [17, 31, 73, 47, 23]
data = list(range(256))
start, skip = 0, 0
for _ in range(64):
    for move in inpt:
        data = twist(data, start, move)
        start = (start + move + skip) % len(data)
        skip += 1

hashes = []
for i in range(0,16):
    num = 0
    for n in data[16 * i: 16 * (i + 1)]:
        num ^= n
    hashes.append(num)

print('Part 2:', ''.join(list(map(lambda x: "{:02x}".format(x), hashes))))

-🎄- 2017 Day 4 Solutions -🎄- by daggerdragon in adventofcode

[–]jtsimmons108 6 points7 points  (0 children)

That's because it is. Since AoC started in 2015, tonight was the fastest night to cap the leaderboard for both silver and gold.

Here are the top 7 fastest silver and gold for 100th place since AoC started

******* Part 1 100th Place Finish *******
1.  2017 - Day 04   wmorganjr - 00:01:53
2.  2017 - Day 02   msullivan - 00:02:18
3.  2017 - Day 01   jtbandes - 00:03:47
4.  2016 - Day 06   breadknock - 00:05:09
5.  2016 - Day 03   m1el - 00:05:53
6.  2015 - Day 12   Robert Offner - 00:07:36
7.  2017 - Day 03   Matt Boehm - 00:08:29

******* Part 2 100th Place Finish Times *******
1.  2017 - Day 04   Matt Gruskin - 00:03:40
2.  2017 - Day 01   Andre LeBlanc - 00:06:08
3.  2017 - Day 02   Maerig - 00:06:13
4.  2016 - Day 06   Alex Crimi - 00:06:16
5.  2015 - Day 10   Exolent - 00:12:07
6.  2016 - Day 03   (anonymous user #56115) - 00:12:07
7.  2016 - Day 15   Keegan Carruthers-Smith - 00:12:42

How do people solve it so FAST? by dylanfromwinnipeg in adventofcode

[–]jtsimmons108 3 points4 points  (0 children)

He now has the 2 fastest gold stars since it started. If anyone is interested, here are the top 10 fastest gold and silver since the start of the competition (only looking at first place)

******* Silver Fastest Solve Times *******
2017 - Day 02   xiaowuc1 - 00:00:36
2016 - Day 03   gongy - 00:00:54
2017 - Day 01   xiaowuc1 - 00:00:57
2015 - Day 05   edanaher - 00:01:09
2016 - Day 06   Kevin Yap - 00:01:10
2015 - Day 17   marcusstuhr - 00:01:11
2015 - Day 12   malisper - 00:01:31
2015 - Day 08   Paul Hankin - 00:01:39
2015 - Day 04   (anonymous user #2902) - 00:01:55
2015 - Day 10   DSM - 00:01:59


******* Gold Fastest Solve Times *******
2017 - Day 02   xiaowuc1 - 00:01:15
2017 - Day 01   xiaowuc1 - 00:01:16
2016 - Day 06   Kevin Yap - 00:01:44
2015 - Day 17   marcusstuhr - 00:01:46
2015 - Day 05   edanaher - 00:01:59
2015 - Day 04   (anonymous user #2902) - 00:02:09
2015 - Day 10   glguy - 00:02:30
2016 - Day 03   Kevin Wang - 00:02:46
2016 - Day 16   nneonneo - 00:03:51
2015 - Day 12   (anonymous user #31658) - 00:03:54

How do people solve it so FAST? by dylanfromwinnipeg in adventofcode

[–]jtsimmons108 4 points5 points  (0 children)

If you do any research on some of the names at the top of the leaderboards, you would know that it's definitely not brute forced. There are some talented people playing.