u/simonbaars

2,282 post karma · 470 comment karma · joined Sep 2016 · moderator

  1. 0points

    I made Rhythm Champ for iOS - a Rhythm Heaven inspired for mobile (v.redd.it) [Promotion]

    6 comments · source

  2. 0points

    I created Rhythm Champ, an iOS-native rhythm game! (old.reddit.com) [Mobile Rhythm Game]

    3 comments · source

  3. 1points

    Rhythm Champ is live! (i.redd.it)

    0 comments · source

  4. 1points

    Welcome to the Rhythm Champ reddit community (i.redd.it)

    0 comments · source

  5. 3points

    I built a free online multiplayer Scrabble game that supports 26 languages (self.scrabble)

    0 comments

  6. 3points

    Why is my SSD so slow? (see comments for details) (i.redd.it)

    1 comments · source

simonbaars

not yet planned! depending on how the iOS launch goes, I may do an Android/PC port.

simonbaars

Since she wants to play in both English and French, she might like https://mlscrabble.com/ — it's a free multiplayer Scrabble game that supports 26 languages including both English and French. You can pick which languages to allow when creating a game. It doesn't use the official Scrabble dictionary but has its own word lists for each language. It runs in the browser so it should work fine on any device at her care facility.

simonbaars

Late to this, but I recently built exactly this: https://mlscrabble.com/ — it's a free online multiplayer Scrabble game with 26 languages. You can even mix multiple languages in the same game, so both players can play words in whichever language they want. No sign-up needed, just create a game and share the link.

simonbaars

I have an Asus Vivobook on which I installed ArcoLinux with encrypted partitions. Ever since I installed it, the disk has been performing extremely slow. The whole system hangs if any file operation is in progress. Is this because the SSD is crap or is there a problem with the system?

lsblk -d -o name,rota,size,model
NAME    ROTA   SIZE MODEL
nvme0n1    0 476.9G SOLIDIGM SSDPFKNU512GZ
simonbaars

As far as I understood, it's to keep people from reverse engineering the way AoC works wrt generating puzzles, and thus allowing someone to copy the entire concept (eg a corporation wanting to commercialize it)

simonbaars

It was already mentioned not to share your puzzle input, so I will not repeat that.

I ran my solution on this input, and it finds the tree. So I would suggest debugging your code.

simonbaars

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day16.java

Many grid days this year! By now I have my grid utilities at the ready, yesterday I made a `recurse` function which helps implement BFS types of searches, so I used it in both parts.

simonbaars
simonbaars

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day12.java

Took me a while to merge the two parts, but I think I did a pretty good job.

simonbaars

It's fun to think that one day we will probably have the kind of computers that can brute force these kinds of problems, perhaps even just the normal kind of machines that everyone will have in their homes. If the number of resistors keep scaling like they have, at least.

simonbaars

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day10.java

Did a bunch of refactoring and extracting higher-order logic to distill it down to this piece of code:

InfiniteGrid g = new InfiniteGrid(dayGrid());
return transformStream(
  g.findAll('0').map(l -> new Pair<>(l, l)),
  s -> split(s, (s1, s2) -> zip(s1, g.around((c1, c2) -> Character.getNumericValue(c1) + 1 == Character.getNumericValue(c2), s2.map(p -> p.b()), false)).flatMapToObj((a, b) -> b.map(l -> new Pair<>(a.a(), l)))),
  p -> g.getOptimistic(p.b()) == '9'
);

So, I already had a Grid class (made in previous years) that had a couple of useful function. findAll would find all occurrences of a character, which I use to find all zero's. Then around gives a stream of everything around that. I made a little transformStream abstraction that continuously applies a function till a predicate is met by all elements in the resulting stream. So I just keep getting the positions around zero, keep incrementing, till everything's a '9'.

The above was simple, but I needed a bunch of glue to be able to know which top was reached by which start point. So I sprinkled a bunch of pairs over everything to keep track of where we started.

With this solution, part 1 is a distinct().count() and part 2 is a count().

simonbaars

Depending on where you are in the Netherlands, there are some upcoming events.

Utrecht (tomorrow): https://www.meetup.com/infi-developers-meetup/events/304793236/

Nijmegen (next week Tuesday): https://www.meetup.com/nimma-codes-meetup-group/events/303824683/

Not sure about other places. But I'm sure you'd find some people with leaderboards there!

simonbaars

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day8.java

Boi did I have fun with streams on this one. With my utilities, part 1 compresses down to:

var in = new InfiniteGrid(dayGrid());
return getAntennasByFrequency(in).stream().flatMapToObj((c, locs) ->
  allPairs(locs).flatMap(p -> Stream.of(
    p.a().translate(l -> l * 2).move(new Loc(-p.b().x, -p.b().y)),
    p.b().translate(l -> l * 2).move(new Loc(-p.a().x, -p.a().y))
  ).filter(in::contains))
).distinct().count();

For part 2, I slightly modified the inner map:

var in = new InfiniteGrid(dayGrid());
return getAntennasByFrequency(in).stream().flatMapToObj((c, locs) -> {
  return allPairs(locs).flatMap(p -> {
    long dx = p.b().x - p.a().x;
    long dy = p.b().y - p.a().y;
    long gcd = gcd(Math.abs(dx), Math.abs(dy));
    long stepX = dx / gcd;
    long stepY = dy / gcd;
    return Stream.concat(
      appendWhile(l -> l.move(stepX, stepY), in::contains, p.a()),
      appendWhile(l -> l.move(-stepX, -stepY), in::contains, p.a())
    );
  });
}).distinct().count();
simonbaars

It's usual for weekend problems to be easier. It gives time to enjoy time with family :)
Personally I enjoy this kind of breather every now and then.

simonbaars

[Language: Java]

Oooh this is the kind of day where I love my data mapper utility:

public record Line(long tgtVal, List<Long> nums) {}

private long calcTotalCalibRes(boolean inclConcat) {
  return dayStream()
    .map(s -> readString(s, "%n: %ln", " ", Line.class))
    .filter(l -> canBeTrue(l.tgtVal, l.nums, 0, l.nums.get(0), inclConcat))
    .mapToLong(l -> l.tgtVal)
    .sum();
}

Part 2 was just adding a single if-statement.

Code: https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day7.java

simonbaars

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day6.java

First day I ended up with the regular nested loop mess. Though my solution was relatively easily extensible to part 2.

simonbaars
simonbaars

[LANGUAGE: Java]

paste

Had fun with my utilities here.

simonbaars

Done!