vole

joined 2 years ago
MODERATOR OF
[–] vole 4 points 5 days ago

I was a bit unenthusiastic going into this episode, thinking that it might be some drawn-out flashback. While the flashbacks were long, I found the whole episode to be a fun trek through Natsuko's inadvertent romcom maneater adolescence.

Each flashback had little surprises, while also emphasizing how Natsuko is 200% dedicated to her craft.

Fukushima's (the animation studio's president) perspective was also interesting. Drawing a parallel between Natsuko and the director of A Tale of Perishing (who, unlike the bird, is smiling in Fukushima's recollection), and challenging Natsuko to surpass her current limitations.

[–] vole 1 points 5 days ago (1 children)

The PV linked above is from 3 years ago and is for the first novel. Here's a PV from 10 hours ago for the anime. The new PV is mostly just review quotes.

[–] vole 2 points 1 week ago (1 children)

This is called localization.

Information or brevity will always be lost in translation (and communication in general), so the translator needs to pick what information to convey and how to convey it. Sometimes it can be difficult to find a satisfactory localized translation, like translating a pun. Or if the translation has been localizing the Japanese name-honorifics system as whatever the characters in an English speaking country would call each other, but then there is a long dialogue in the show discussing how they are addressing each other; that dialogue can throw a wrench in the translation.

For Love is War, the source joke word was probably ちんちん (chinchin) which is both a childish way to say "penis" (like "poopoo" is a childish way to say 💩, or like "peepee") and a dog trick where the dog sits and begs (it might also have additional meanings). The translator probably had to think about how to make a similar gag with the existing visuals.

[–] vole 3 points 2 weeks ago (1 children)

Hmm, I can't think of an anime that matches the trailer. That is to say, an anime that is an action-horror demon-world adventure with modern military weapons.

Hole in the ground with horror monsters makes me think of Made in Abyss.

There's a gluttony of anime with monsters in dungeons, like DanMachi, Arifureta, and Solo Leveling.

There's Chained Soldier, which technically takes place in a hell-ish place with monsters that is connected to regular earth. And there's some military element to it.

There's a gate to another world and modern military in Gate: Thus the JSDF Fought There!, but no monsters that I recall.

Just throwing some other out there: Hellsing Ultimate, Seraph of the End, WorldEnd, Dimension W, .

When I hear arctic demon, I can't help but think about The Thing, which isn't anime.

You can try crossposting to [email protected], which is more active. Or post in their next weekly discussion thread.

[–] vole 2 points 2 weeks ago

We get some, uh, character development with Destiny, we get introduced to Justice (and actual character development), and we have a brief encounter with lady-bird.

It was a bit hard to watch the end with all the foreshadowing that Natsuko was going to mess things up.

[–] vole 3 points 1 month ago

Also, I like how the village chief's attire serves as an excuse for Destiny's clothing, but they don't force feed you this excuse.

Also,

The only one who could make Luke smile from the bottom of his heart was Destiny.

meanwhileServal Cat Mask becomes the heroine.

[–] vole 1 points 1 month ago (2 children)

Hm, at the end it looks like Natsuko is noticing some of the suspicious behavior, which might not have been in the original story. Or maybe it was in the story and Natsuko is just playing it cool.

@[email protected]

More Screenshots

That is my... Beautiful!

いけー

Victory!

[–] vole 1 points 1 month ago

Raku

I resisted the urge to solve part 2 manually and I was eventually able to get a working solution. Well it's an approximate solution, taking advantage of the AoC input being not-so-mungled. I ended up using a couple of validity checks for part2. Specifically:

  • Is the input of a gate (or the output going to zXX) the right gate type?
    • e.g. All gates to zXX should be XOR gates that take in a gate that generates a carry bit. (z00 and z45 excluded)
  • Does the output appear the correct number of times for this kind of gate?
    • e.g. a XOR(xXX, yXX) gate's output should appear twice. (z00 excluded)

This also takes advantage of the fact that all the inputs are correct, it is only gate outputs that is messed up. Using this fact you can distinguish between XOR gates that are calculating the partial addition of xXX + yXX and the XOR gates used to get the final zXX bit. Same story for the AND gates.

And I guess this also takes advantage of the fact that the input circuit is a standard adder without any extra gates.

Code

sub MAIN($input) {
    grammar Input {
        token TOP { <wire>+%"\n" "\n\n" <gate>+%"\n" "\n"* }
        token wire { (\w+) ": " (\d) }
        token gate { (\w+) " " (\w+) " " (\w+) " -> " (\w+) }
    }
    my $parsed = Input.parsefile($input);
    my %initial-wires = $parsed<wire>.map({.[0].Str => .[1].Int.Bool});
    my %gates = $parsed<gate>.map({.[3].Str => (.[1].Str, (.[0].Str, .[2].Str).sort.List)});

    my $part1-solution = wires-to-int(%initial-wires, %gates, "z");
    say "part1 solution: $part1-solution";

    # z00   = XOR(x00, y00)
    # z00c  = AND(y00, x00)
    #
    # z01p  = XOR(x01, y01) # partial addition
    # z01   = XOR(z01p, z00c) # addition including carry-int
    # z01nc = AND(x01, y01) # normal x+y carry over
    # z01cc = AND(z01p, z00c) # x|y + c-in carry over
    # z01c  = OR(z01nc, z01cc) # carry-out. Only one branch can be true, so a XOR would work as well
    #
    # z02p  = XOR(x02, y02)
    # z02   = XOR(z02p, z001c)
    # z02nc = AND(x02, y02)
    # z02cc = AND(z02p, z01c)
    # z02c  = OR(z02nc, z02cc)

    # Only the gate outputs are swapped, in other words the inputs are always correct
    my %unknown-outputs := %gates.keys.SetHash;
    my %known-wrong-outputs is SetHash;
    my %zXp-outputs;
    my %zX-outputs;
    my %zXnc-outputs;
    my %zXcc-outputs;
    my %zXc-outputs;

    for %unknown-outputs.keys -> $uo {
        my ($op, $input-wires) = %gates{$uo};
        if $op eq "XOR" {
            my $is-xy-inputs = $input-wires[0].substr(0,1) eq "x";
            if $is-xy-inputs {
                %zXp-outputs{$uo} = $input-wires[0].substr(1,2).Int;
            } else {
                # any XOR gates that are not for zXp are for zX
                # but we don't know for sure what zX gate it is for
                %zX-outputs{$uo} = Nil;
            }
            %unknown-outputs{$uo}--;
        }
        if $op eq "AND" {
            my $is-xy-inputs = $input-wires[0].substr(0,1) eq "x";
            if $is-xy-inputs {
                %zXnc-outputs{$uo} = $input-wires[0].substr(1,2).Int;
            } else {
                # any AND gates that are not for zXnc are for zXcc
                # but we don't know for sure what zXcc gate it is for
                %zXcc-outputs{$uo} = Nil;
            }
            %unknown-outputs{$uo}--;
        }
        if $op eq "OR" {
            %zXc-outputs{$uo} = Nil;
            %unknown-outputs{$uo}--;
        }
    }
    # z00, z00c are special
    # leaving z00 off of zX-outputs and putting z00nc onto zXc-outputs is useful
    # maybe?
    for %gates.keys -> $wire {
        %zXc-outputs{$wire} = Nil if %zXnc-outputs{$wire}:exists && %zXnc-outputs{$wire} == 0;
    }
    # Let's just look for structural issues, having the wrong inputs for a given gate type
    # A zXnc input would be invalid for a XOR gate
    # A zXp input would be invalid for an OR gate
    # Two gates of the same type would be invalid for all, but it'd be hard to tell which on is wrong
    for %zX-outputs.keys -> $wire {
        if $wire !~~ /^z\d\d$/ {
            # All zX gates should output to a zX wire
            %known-wrong-outputs{$wire}++;
        }
        my $found-zXp = Nil;
        my $found-zXc = Nil;
        for %gates{$wire}[1].Seq {
            if %zXp-outputs{$_}:exists {
                $found-zXp = True;
            } elsif %zXc-outputs{$_}:exists {
                $found-zXc = True;
            } else {
                %known-wrong-outputs{$_}++;
            }
        }
    }
    for %gates.keys -> $wire {
        if %zX-outputs{$wire}:exists && $wire.substr(0,1) ne "z" {
            %known-wrong-outputs{$wire}++;
        }
    }
    for %zXc-outputs.keys -> $wire {
        next if %zXnc-outputs{$wire}:exists && %zXnc-outputs{$wire} == 0;
        my $found-zXnc = Nil;
        my $found-zXcc = Nil;
        for %gates{$wire}[1].Seq {
            if %zXnc-outputs{$_}:exists {
                $found-zXnc = True;
            } elsif %zXcc-outputs{$_}:exists {
                $found-zXcc = True;
            } else {
                %known-wrong-outputs{$_}++;
            }
        }
    }
    for %zXcc-outputs.keys -> $wire {
        my $found-zXp = Nil;
        my $found-zXc = Nil;
        for %gates{$wire}[1].Seq {
            if %zXp-outputs{$_}:exists {
                $found-zXp = True;
            } elsif %zXc-outputs{$_}:exists {
                $found-zXc = True;
            } else {
                %known-wrong-outputs{$_}++;
            }
        }
    }
    # zXp wires should appear 2 times each
    # zXnc wires should appear 1 time each
    # zXc wires outputs should appear 2 times each
    # zXcc wires should appear 1 time each
    # zX wires should appear 0 time each
    my %wire-to-created-outputs;
    for %gates.keys -> $output {
        my ($op, $input-wires) = %gates{$output};
        for $input-wires.Seq {
            %wire-to-created-outputs.push($_ => $output);
        }
    }
    for %gates.keys -> $wire {
        my $created-outputs = %wire-to-created-outputs{$wire}:exists ?? %wire-to-created-outputs{$wire}.elems !! 0;
        my $was = %known-wrong-outputs{$wire};
        %known-wrong-outputs{$wire}++ if %zXp-outputs{$wire}:exists && $created-outputs != 2 && $wire ne "z00";
        %known-wrong-outputs{$wire}++ if %zXnc-outputs{$wire}:exists && $created-outputs != 1 && %zXnc-outputs{$wire} != 0;
        %known-wrong-outputs{$wire}++ if %zXc-outputs{$wire}:exists && $created-outputs != 2;
        %known-wrong-outputs{$wire}++ if %zXcc-outputs{$wire}:exists && $created-outputs != 1;
        %known-wrong-outputs{$wire}++ if %zX-outputs{$wire}:exists && $created-outputs != 0;
    }
    %known-wrong-outputs{"z45"}--; # z45 is fine, but it uses OR instead of XOR, because there is no x45/y45
    my $part2-solution = %known-wrong-outputs.keys.sort.join(",");

    say "part2-solution: $part2-solution";
}

sub wires-to-int(%wires, %gates, $prefix) {
    my $int = 0;
    if $prefix eq <x y>.any {
        for %wires.keys {
            next if .substr(0,1) ne $prefix;
            $int += 1 +< .substr(1,*).Int if %wires{$_};
        }
    } else {
        for %gates.keys {
            next if .substr(0,1) ne $prefix;
            resolve-gates(%wires, %gates, $_);
            $int += 1 +< .substr(1,*).Int if %wires{$_};
        }
    }
    return $int;
}

sub resolve-gates(%wires, %gates, $gate) {
    my ($op, @input-wires) := %gates{$gate};
    my @input-values = @input-wires.map({resolve-gates(%wires, %gates, $_) if %wires{$_}:!exists; %wires{$_}});
    %wires{$gate} = (given $op {
        when "AND" { [&&] @input-values }
        when "XOR" { [!=] @input-values }
        when "OR"  { [||] @input-values }
    });
}

[–] vole 2 points 2 months ago

Raku

My actual solution ran in about 2.5 seconds, but I optimized it to run in about 1 second.

sub MAIN($input) {
    my $file = open $input;
    my @connection-list := $file.slurp.trim.lines>>.split("-")>>.List.List;

    my %connections;
    my %all-computers is SetHash;
    for @connection-list -> @c {
        my ($first, $second) = @c.sort;
        %connections{$first} = [] if %connections{$first}:!exists;
        %connections{$second} = [] if %connections{$second}:!exists;
        %connections{$first}.push($second);
        %all-computers{@c.all}++;
    }
    for %connections.values -> $list is rw {
        $list = $list.sort.List;
    }

    my $part1-solution = 0;
    for %connections.keys -> $c1 {
        for %connections{$c1}.Seq -> $c2 {
            for (%connections{$c1} ∩ %connections{$c2}).keys -> $c3 {
                next unless ($c1, $c2, $c3).any.substr(0,1) eq "t";
                $part1-solution++;
            }
        }
    }
    say "part1 solution: $part1-solution";

    my $part2-solution = find-max-party((), %connections, %all-computers).join(",");
    say "part2 solution: $part2-solution";
}

sub find-max-party(@party, %connections, %available-members) {
    my @max-party = @party;
    for %available-members.keys.sort -> $c1 {
        my @new-party := (|@party, $c1);
        my %new-available-members := %available-members ∩ %connections{$c1};
        my @max-party-candidate = find-max-party(@new-party, %connections, %new-available-members);
        @max-party = @max-party-candidate if @max-party-candidate.elems > @max-party.elems;
        last if @max-party.elems == @party.elems + %available-members.elems;
    }
    return @max-party;
}
[–] vole 1 points 2 months ago (1 children)

Raku

I spent way to much time tweaking the part 2 code to get a working solution. The solution itself is quite simple, though.

sub MAIN($input) {
    grammar Input {
        token TOP { <register-a> "\n" <register-b> "\n" <register-c> "\n\n" <program> "\n"* }
        token register-a { "Register A: " (\d+) }
        token register-b { "Register B: " (\d+) }
        token register-c { "Register C: " (\d+) }
        token program { "Program: " (\d)+%"," }
    }
    my $parsed = Input.parsefile($input);
    my $register-a = $parsed<register-a>[0].Int;
    my $register-b = $parsed<register-b>[0].Int;
    my $register-c = $parsed<register-c>[0].Int;
    my @program = $parsed<program>[0]>>.Int;

    my $part1-solution = run-program($register-a, $register-b, $register-c, @program).join(",");
    say "part1 solution: $part1-solution";

    my $part2-solution = search-for-quine(0, $register-b, $register-c, @program, 0);
    say "part2-solution: $part2-solution";
}

sub run-program($a, $b, $c, @program) {
    my ($register-a, $register-b, $register-c) Z= ($a, $b, $c);
    my $pc = 0;
    my @output;
    while $pc < @program.elems {
        my ($opcode, $operand) Z= @program[$pc, $pc+1];
        my $combo = (given $operand {
            when 0..3 { $operand }
            when 4 { $register-a }
            when 5 { $register-b }
            when 6 { $register-c }
            when 7 { Nil }
            default { say "invalid operand $operand"; exit; }
        });
        given $opcode {
            when 0 { $register-a = $register-a div (2 ** $combo); }
            when 1 { $register-b = $register-b +^ $operand; }
            when 2 { $register-b = $combo mod 8; }
            when 3 { $pc = $operand - 2 if $register-a != 0; }
            when 4 { $register-b = $register-b +^ $register-c; }
            when 5 { @output.push($combo mod 8); }
            when 6 { $register-b = $register-a div (2 ** $combo); }
            when 7 { $register-c = $register-a div (2 ** $combo); }
            default { say "invalid opcode $opcode"; exit; }
        }
        $pc += 2;
    }
    return @output;
}

sub search-for-quine($a, $b, $c, @program, $idx) {
    return $a if $idx == @program.elems;
    for ^8 {
        my $test-solution = $a * 8 + $_;
        my @output = run-program($test-solution, $b, $c, @program);
        my @program-slice = @program[*-1-$idx..*];
        if @program-slice eqv @output {
            my $found = search-for-quine($test-solution, $b, $c, @program, $idx+1);
            if $found {
                return $found;
            }
        }
    }
    # Time to back track...
    return False;
}
[–] vole 2 points 2 months ago (1 children)

Raku

Pretty straight-forward problem today.

sub MAIN($input) {
    my $file = open $input;
    my @map = $file.slurp.trim.lines>>.comb>>.Int;

    my @pos-tracking = [] xx 10;
    for 0..^@map.elems X 0..^@map[0].elems -> ($row, $col) {
        @pos-tracking[@map[$row][$col]].push(($row, $col).List);
    }

    my %on-possible-trail is default([]);
    my %trail-score-part2 is default(0);
    for 0..^@pos-tracking.elems -> $height {
        for @pos-tracking[$height].List -> ($row, $col) {
            if $height == 0 {
                %on-possible-trail{"$row;$col"} = set ("$row;$col",);
                %trail-score-part2{"$row;$col"} = 1;
            } else {
                for ((1,0), (-1, 0), (0, 1), (0, -1)) -> @neighbor-direction {
                    my @neighbor-position = ($row, $col) Z+ @neighbor-direction;
                    next if @neighbor-position.any < 0 or (@neighbor-position Z>= (@map.elems, @map[0].elems)).any;
                    next if @map[@neighbor-position[0]][@neighbor-position[1]] != $height - 1;
                    %on-possible-trail{"$row;$col"} ∪= %on-possible-trail{"{@neighbor-position[0]};{@neighbor-position[1]}"};
                    %trail-score-part2{"$row;$col"} += %trail-score-part2{"{@neighbor-position[0]};{@neighbor-position[1]}"};
                }
            }
        }
    }

    my $part1-solution = @pos-tracking[9].map({%on-possible-trail{"{$_[0]};{$_[1]}"}.elems}).sum;
    say "part 1: $part1-solution";

    my $part2-solution = @pos-tracking[9].map({%trail-score-part2{"{$_[0]};{$_[1]}"}}).sum;
    say "part 2: $part2-solution";
}
[–] vole 1 points 2 months ago

Raku

Solution

sub MAIN($input) {
    my $file = open $input;
    my @map = $file.slurp.lines>>.comb>>.List.List;
    my %freqs;
    for 0..^@map.elems -> $row {
        for 0..^@map[0].elems -> $col {
            if @map[$row; $col] ne "." {
                my $freq = @map[$row; $col];
                %freqs{$freq} = [] if %freqs{$freq}:!exists;
                %freqs{$freq}.push(($row, $col));
            }
        }
    }
    my %antinodes is SetHash;
    for %freqs.kv -> $freq, @locations {
        for (0..^@locations.elems) X (0..^@locations.elems) -> ($loc1, $loc2) {
            next if $loc1 == $loc2;
            my @base = @locations[$loc1].List;
            my @vector = @locations[$loc2].List Z- @base;
            my @antinode1 = @base Z+ @vector.map(* * 2);
            %antinodes{@antinode1.List.raku}++ if point-is-in-map(@map, @antinode1);
            my @antinode2 = @base Z+ @vector.map(* * -1);
            %antinodes{@antinode2.List.raku}++ if point-is-in-map(@map, @antinode2);
        }
    }
    my $part1-solution = %antinodes.elems;
    say "part 1: $part1-solution";


    my %antinodes2 is SetHash;
    for %freqs.kv -> $freq, @locations {
        for (0..^@locations.elems) X (0..^@locations.elems) -> ($loc1, $loc2) {
            next if $loc1 == $loc2;
            my @base = @locations[$loc1].List;
            my @vector = @locations[$loc2].List Z- @base;
            # make integer unit-ish vector
            for 2..@vector[0] -> $divisor {
                if @vector[0] %% $divisor and @vector[1] %% $divisor {
                    @vector[0] = @vector[0] div $divisor;
                    @vector[1] = @vector[1] div $divisor;
                }
            }
            for 0..max(@map.elems, @map[0].elems) -> $length {
                my @antinode = @base Z+ @vector.map(* * $length);
                if point-is-in-map(@map, @antinode) {
                    %antinodes2{@antinode.List.raku}++ 
                } else {
                    last
                }
            }
            for 1..max(@map.elems, @map[0].elems) -> $length {
                my @antinode = @base Z+ @vector.map(* * -$length);
                if point-is-in-map(@map, @antinode) {
                    %antinodes2{@antinode.List.raku}++ 
                } else {
                    last
                }
            }
        }
    }
    my $part2-solution = %antinodes2.elems;
    say "part 2: $part2-solution";
}

sub point-is-in-map(@map, @point) {
    return False if !(0 <= @point[0] < @map.elems);
    return False if !(0 <= @point[1] < @map[0].elems);
    return True;
}

 

What anime are you looking forward to watching in the Winter 2024 season?

Winter 2024 anime: https://myanimelist.net/anime/season/2024/winter

 

cross-posted from: https://lemmy.world/post/2395857

I just finished watching Skip and Loafer, which aired this most recent spring season. I'm here to tell you: you should watch it too!

It's a coming of age story about a girl moving from the countryside to Tokyo to go to a better high school. It's full of heart-warming moments as these kids become friends and try to figure out how they should interact with the world.

The characters, story, animation, and sound are all fantastic. The show brings a comforting warmth, with a little drama to keep things interesting. Don't let this show pass you by!

Links:

9
submitted 2 years ago by vole to c/anime
 

I just finished watching Skip and Loafer, which aired this most recent spring season. I'm here to tell you: you should watch it too!

It's a coming of age story about a girl moving from the countryside to Tokyo to go to a better high school. It's full of heart-warming moments as these kids become friends and try to figure out how they should interact with the world.

The characters, story, animation, and sound are all fantastic. The show brings a comforting warmth, with a little drama to keep things interesting. Don't let this show pass you by!

Links:

 

Streams:

Show information:

 

Streams:

Show information:

 

Streams:

Show information:

 

Streams:

Show Information:

 

Streams:

Show Information:

 

Streams:

Show Information:

 

Streams:

Show Information:

 

Streams:

Show Information:

 

Streams:

Show Information:

view more: next ›