#AdVENt of Code

1 messages · Page 6 of 1

tranquil vapor
#

SO MUCH TEXT

real hinge
#

you map stuff

#

there I gave you simplest explaination

tranquil vapor
#

WHY ARE NUMBERS SO LARGE

#

INSANE

real hinge
#

dont worry it definiletly wont take 25 minutes to do part 2 by brute forcing

#

dont mind largeness

sullen fiber
#

damn it manti use cargo clippy

#

and cargo fmt

real hinge
#

sorry

#

i didnt know those existed

tranquil vapor
#

what..

real hinge
#

btw this progress is completely wrong

tranquil vapor
#

oh its int64

real hinge
#

I couldnt bother fixing it since it wasnt taking so long

tranquil vapor
#

okay part 1 was actually easy

solar tide
#

do def solve { file }

tranquil vapor
# tranquil vapor okay part 1 was actually easy

||

def solve(file)
  smallest_location_number = Int64::MAX

  lines = File.read_lines(file)
  seeds = lines.shift.split(":").last.strip.split(" ").map { |s| s.to_i64 }

  did_map = false
  seeds.each do |seed|
    number = seed

    lines.each do |line|
      if line.ends_with? "map:"
        did_map = false
        next
      end
      next if did_map |​| line.empty?

      dest_range_start, source_range_start, range_length = line.split(" ").map { |s| s.to_i64 }
      if number >= source_range_start && number < source_range_start + range_length
        number = dest_range_start + (number - source_range_start)
        did_map = true
      end
    end

    smallest_location_number = [smallest_location_number, number].min
  end

  puts file, smallest_location_number
end

||

#

crystal language server is nonexistent

solar tide
#

(part 2 is where the fun begins)

tranquil vapor
#

LOL

#

I SEE NOW

#

time to brute force

solar tide
#

I could do yesterday's in like 5 lines of crystal and today's... lol

native pewter
#

cant tell if im doing it wrong, are you only allowed to apply a map rule once to an element for part one?

real hinge
native pewter
#

parallelism is experimental in crystal.

solar tide
#

multithreading on crystal is preview

#

do -Dpreview_mt

native pewter
solar tide
#

ok

sullen fiber
#

@real hinge hwo do u run

#

ur workspace

native pewter
real hinge
#

cargo run -p day05 --release

sullen fiber
#

ty

solar tide
#

rustasian

native pewter
tranquil vapor
#

okay brute force time

native pewter
#

like

tranquil vapor
native pewter
#

for uhh

tranquil vapor
solemn python
#

It goes once per map

tranquil vapor
#

lets see how long this takes

solemn python
#

seed-to-soil converts it to soil so you then have to move onto the next map

#

If that's what you meant

native pewter
#

fert to water, for 53 it maps to 49 and then 49 to 32 no?

solemn python
#

Yeah it's only once

native pewter
#

ah

solemn python
#

When you apply the map, it's now in a different "category"

native pewter
#

okokok

#

bleh thats kinda meh

tranquil vapor
sullen fiber
#

it prob wont take that long

#

actually idk what lang ur using

tranquil vapor
#

well it's a single threaded solution

#

in crystal

sullen fiber
#

compiled staticly typed

#

probably sane

tranquil vapor
#

||

def solve2(file)
  smallest_location_number = Int64::MAX

  lines = File.read_lines(file)
  seeds = lines.shift.split(":").last.strip.split(" ").map { |s| s.to_i64 }

  did_map = false
  (0...seeds.size).step(by: 2) do |i|
    (seeds[i]..(seeds[i] + seeds[i + 1])).each do |seed|
      number = seed

      lines.each do |line|
        if line.ends_with? "map:"
          did_map = false
          next
        end
        next if did_map |​| line.empty?

        dest_range_start, source_range_start, range_length = line.split(" ").map { |s| s.to_i64 }

        if number >= source_range_start && number < source_range_start + range_length
          number = dest_range_start + (number - source_range_start)
          did_map = true
        end
      end

      smallest_location_number = [smallest_location_number, number].min
    end
  end

  puts file, smallest_location_number
end

||

#

brute force code

#

my fan is so loud lmao

#

its just the dumbest synchronous approach

#

its still running trolley

native pewter
real hinge
#

its not dumbest

#

there are people who use arrays

sullen fiber
#

@real hinge rate my bruteforce

tranquil vapor
#

i came up with a way to do non brute force

real hinge
#

only 1 second????

#

how

tranquil vapor
#

will try that after i see how long brute force took

#

its still running 11 minutes later

real hinge
#

did you nuke overlaps or smthn

tranquil vapor
sullen fiber
#

||nah there are none||

native pewter
real hinge
sullen fiber
#

no its 1 second

tranquil vapor
#

HOW

native pewter
#

:shoggy:

real hinge
sullen fiber
#

||instead of looping thru all seeds and getting minimum result, i reverse the mappings and go up the locations from 0 and when i find a result in the seed range i stop||

real hinge
#

oh that works

sullen fiber
#

also yes --release made it like 10x faster

tranquil vapor
#

oh guh

real hinge
#

||but that only works because minimum number is increadibly low||

tranquil vapor
#

i should release

#

BUT I DONT WANNA CANCXEL NOW

#

okay i built release

#

running now

sullen fiber
# sullen fiber ||instead of looping thru all seeds and getting minimum result, i reverse the ma...

||```rs
use std::ops::Range;

struct Step {
source: Range<i64>,
destination: Range<i64>,
}

fn main() {
// part 2
let contents = include_str!("input.txt");

let mut all_steps: Vec<Vec<Step>> = Vec::new();
let mut seeds: Vec<Range<i64>> = Vec::new();

contents.split("\n\n").for_each(|group| {
    if let Some((_, group_steps)) = group.split_once('\n') {
        let mut steps: Vec<Step> = Vec::new();
        group_steps.split('\n').for_each(|step| {
            let values: Vec<i64> = step.split(' ').map(|s| s.parse::<i64>().unwrap()).collect();
            let [dest_start, source_start, range_len] = values[..] else {
                unreachable!()
            };

            steps.push(Step {
                source: source_start..(source_start + range_len),
                destination: dest_start..(dest_start + range_len),
            });
        });

        all_steps.push(steps);
    } else {
        group
            .split_once(':')
            .unwrap()
            .1
            .trim()
            .split(' ')
            .map(|n| n.parse::<i64>().unwrap())
            .collect::<Vec<i64>>()
            .chunks_exact(2)
            .for_each(|seed_range| {
                let [min, len] = seed_range else {
                    unreachable!()
                };
                seeds.push(*min..(min + len))
            });
    }
});

let mut reverse_steps: Vec<Vec<Step>> = Vec::new();
for steps in all_steps.iter().rev() {
    let mut reverse_step: Vec<Step> = Vec::new();
    for step in steps.iter() {
        reverse_step.push(Step {
            source: step.destination.clone(),
            destination: step.source.clone(),
        });
    }
    reverse_steps.push(reverse_step);
}

let mut min = 0i64;
loop {
    let mut mapped = min;

    for steps in reverse_steps.iter() {
        for step in steps {
            if step.source.contains(&mapped) {
                mapped = mapped - step.source.start + step.destination.start;
                break;
            }
        }
    }

    if seeds.iter().any(|seed| seed.contains(&mapped)) {
        println!("Found min from seed: {}", mapped);
        break;
    }

    min += 1;
}

println!("Min: {}", min);

}

tranquil vapor
#

SO LONG

sullen fiber
#

i modified manti's part 2 cus i didnt wanna do from scratch

tranquil vapor
#

well i do so many allocations every loop

#

i should move the parsing to top level

#

^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D

native pewter
#

what do end does to a mf

tranquil vapor
#

okay i optimised it a bit

#

now try brute force again

#

OMG SO MUCH FASTER

solar tide
#

skill issue

sullen fiber
#

REAL

tranquil vapor
#

it already did 20%

sullen fiber
#

cracked

tranquil vapor
#

holy shit all i did was move the parsing outside of the loop

#

before i had it parse every map line for every single seed

#

now i parse it on the top and its so much faster

#

unsane

#

allocations sooooo expensive

sullen fiber
#

I WAS JUST GIVEN THE WONDERFUL IDEA

#

OF MULTITHREADING MY BRUTEFORCE IN UIUA

tranquil vapor
#

ok its 90% done

#

if i multithread the brute force it can be like 20s

#

LAST SEED RANGE SOOOO LONG

#

WTF

#

ok nvm im dumb

#

end is 20 not 10

#

im at 14 now

real hinge
solar tide
tranquil vapor
#

||

def solve2(file)
  smallest_location_number = Int64::MAX

  lines = File.read_lines(file)
  seeds = lines.shift.split(":").last.strip.split(" ").map { |s| s.to_i64 }

  mappings = [] of Array(Array(Int64))
  curr_chunk = [] of Array(Int64)
  lines.skip(1).each do |line|
    if line.empty?
      mappings << curr_chunk
      curr_chunk = [] of Array(Int64)
      next
    end
    next if line.ends_with? "map:"

    curr_chunk << line.split(" ").map { |s| s.to_i64 }
  end
  mappings << curr_chunk

  (0...seeds.size).step(by: 2) do |i|
    puts i
    (seeds[i]..(seeds[i] + seeds[i + 1])).each do |seed|
      number = seed

      mappings.each do |map|
        did_map = false
        map.each do |line|
          dest_range_start, source_range_start, range_length = line

          if number >= source_range_start && number < source_range_start + range_length
            number = dest_range_start + (number - source_range_start)
            did_map = true
          end
        end
        smallest_location_number = [smallest_location_number, number].min
      end
    end
  end

  puts file, smallest_location_number
end

||

high lintel
#

part two is killing me i need to optimize sm

tranquil vapor
#

18

real hinge
tranquil vapor
#

almost done

#

95% done

sullen fiber
#

LMAO

solar tide
#

lmao

tranquil vapor
#

WHY IS IT TAKING SO LONG FOR LAST RANGE

solar tide
#

ven :3

tranquil vapor
#

btw are there overlaps in the seeds im too lazy to check

sullen fiber
#

a watched pot never boils

high lintel
#

should.t

tranquil vapor
#

DONE after 8 minutes trolley

#

WRONG ANSWER

sullen fiber
#

in my input there were no range overlaps anywhere

tranquil vapor
#

it came out as 0

#

wait dont tell me int64 is not big enough

sullen fiber
#

it is

#

i did part2 in typescript originally

tranquil vapor
#

do u have to use bigint in node

#

unsane

sullen fiber
#

nah

tranquil vapor
#

how

sullen fiber
#

i used numbers

tranquil vapor
#

okay time to implement non brute force posttroll

sullen fiber
#

they're all like around 32 bits

#

all the input numbers

real hinge
#

since your code takes longer to run than 5

#

also did you not use example

tranquil vapor
#

my idea is: || for each mapping line, check the overlap with the current seed range. then split the existing seed range(s) into 3 new ranges with the overlapping part converted. finally we end up with an array of like a few hundred ranges, then just find the lowest number in these ranges ||

#

is that good

sullen fiber
#

no actually

#

they are all uint32s

tranquil vapor
tranquil vapor
#

ok

sullen fiber
#

yea im assuming crystal's int32 is signed

#

so u lsoe a bit

#

and it cries like waaa waaaa waaa

tranquil vapor
#

yep u32 works

sullen fiber
tranquil vapor
#

wait no

sullen fiber
#

its prob less pain in crysal

tranquil vapor
#

using Uint32

sullen fiber
#

WTF what number

#

send ur input

high lintel
#

mine are u64

#

some at least

delicate crane
#

||is there not a good NPM package for a js range with unions and subtractions||
I thought of a good solution that isn't brute force while eep, but I don't want to make that shit myself

tranquil vapor
sullen fiber
#

INSANE

#

look at my input i got lucky

tranquil vapor
sullen fiber
#

well it didnt affect me really but

#

should i start a typescript repo for generating large inputs @proper totem

#

and add you

tranquil vapor
#

462648396

#

one single number thats bigger than u32

#

xd

sullen fiber
#

lol insane

tranquil vapor
#

oh wait no

#

wait

#

im so confused

#

i made it print all numbers that are > Uint32::MAX

#

and it printed nothing

#

yet when i tried to parse to u32 it explodes

sullen fiber
#

yea also that number is 29 bits

#

crystal meth

tranquil vapor
#

yeah that number is from smth else LOL

#

thats my part 1 solution

sullen fiber
#

oh true

tranquil vapor
#

OHHH

#

ITS FROM WHEN I DO MATH

sullen fiber
#

oh true

tranquil vapor
#
if number >= source_range_start && number < source_range_start + range_length
#

this line

sullen fiber
#

ohh

#

basically the input has all u32s but they represent u64 ranges

delicate crane
sullen fiber
#

it hurt

tranquil vapor
#

crystal ranges actually dont seem to help me in any way

high lintel
#

im gonna smash my fucking head

delicate crane
#

I am glad to know it is not in fact easy

sullen fiber
#

||range splitting math spoilers||

#

pain

tranquil vapor
#

HORROR

delicate crane
tranquil vapor
#

i love crystal syntax for typing arrays:

numbers = [] of UInt64
delicate crane
#

At least it has a type system

sullen fiber
#

||thats true for before tho||

delicate crane
#

A

solar tide
tranquil vapor
#

pov: you use a language where end is a reserved keyword

start, ending = range
harsh marsh
#

use stop

solar tide
tranquil vapor
#

nop

solar tide
#

yop

tranquil vapor
#

I HATE MATH

sullen fiber
#

you love math

#

the math sucked i had to l ike

#

draw 6 different cases

#

and mentally sanity check them all with my math

tranquil vapor
#

i should turn off copilot for this

sullen fiber
#

DEF

tranquil vapor
#

its giving me code

#

for range checking

sullen fiber
#

AND IT WILL BE SLIGHTLY WRONG

tranquil vapor
#

GIOJGIJOSGJIOJIOGE WHY IS THIS SO BRAINFUCK

#

i could cheat

#

crystal has binary search on range

sullen fiber
#

i would have done that but

#

u cant really

tranquil vapor
#
seedRange.bsearch do |i|
  mapRange.includes? i
end
sullen fiber
#

that only rly tells you that there is some overlap

#

not really where it is and how to split it

tranquil vapor
#

ohhh true

sullen fiber
#

enjoy pain

tranquil vapor
#

i think this is a good start, now we know there is overlap

sullen fiber
#

TRUE

tranquil vapor
#

im cracked wtf

#

NVM

sullen fiber
#

||make sure ur keeping track of if ur ranges are inclusive or exclusive||

tranquil vapor
#

NOT CORRECT

#

making them all inclusive

#

cause i love queer people ❤️

sullen fiber
#

real

tranquil vapor
#

OMG MY HEAD IS FRYING

#

KOPJIKOPFSOADJIKGOHJNDESAIOJFWQAJOIFWAIOJFEHIOUJFGEIOHUGEWHIOUEWGIOHUJEGRIJNOHU

#

okay i finished my logic

#

and it ran very fast

#

but idk if its correct yet xd

real hinge
#

its not

tranquil vapor
#

yop so wrong

#

IDK WHERE MY LOGIC ERROR IS

warped dust
#

the entire code

tranquil vapor
#

YES

teal mountain
#

it's a bug in the language

#

you have faulty RAM

tranquil vapor
#

IM CLOSE I THINKL

#

OJIK=FJIOFGJIOGJIOJIKOWOKPWIKOPJFJIKOPEFGJOIE

#

PART 1 SOLVED SUCCESSFULLY

#

BUT PART 2 IS 0

#

PLEASE WHY IS IT 0

sullen fiber
#

F

real hinge
#

the reason was I was parsing numbers wrong

native pewter
#

sadness my solution works for example but breaks on real

real hinge
#

so when numbers were
12 58 24 52
it was doing
12- 70 first
58-72
24-74 etc

#

middle one isnt supposed to exist

tranquil vapor
#

IM SO CLOSE

#

example is 46

real hinge
#

substract 3 from answer

#

it will work alhamdulillah

tranquil vapor
#

nop wrong

real hinge
#

how

tranquil vapor
#

0 AGAIN

real hinge
#

@steady fog do aoc

real hinge
#

I will fix

tranquil vapor
#

nop

sullen fiber
#

@warped dust help

#

im literally reversing adjectives

#

when i text things sometimes

#

rtl is a virus

warped dust
#

UIUA BRAINROT

#

it's not evbn actually rtl like that

#

u read functions in same direction

sullen fiber
#

not me

#

i think of it as rtl

#

i dont think of it as reverse(x)

warped dust
#

ur a stack machine

sullen fiber
#

i think of it as ```
x
|> reverse

#

so rtl piping

tranquil vapor
#

IJFEIOJGIOEJGJIOPEWIWEFUJJIOEGQFJIKO=PEFGJIOGWEDJIOGEDOJI

#

I FIXED IT

#

DO YOU WANNA KNOW THE FIX

#
-       unmapped_ranges.each do |range|
+       unmapped_ranges.clone.each do |range|
#

IM GONNA KILL YMSEFL NOW

steady fog
#

@tranquil vapor

real hinge
#

@tranquil vapor help me

#

my phone is sending 300 telemetry request every second

#

instagram literally sends events for no reason

tranquil vapor
real hinge
#

did u do range mapping

tranquil vapor
#

yeah

real hinge
#

loooove

tranquil vapor
sullen fiber
#

huge thats probably faster than my typescript one

#

LMAO

tranquil vapor
#

that's with file reads

#

not embedded or anything

real hinge
#

what if you rewrote it in golang now

tranquil vapor
#

why

real hinge
tranquil vapor
#

nah

#

crystal is very fast

#

biased source but yeah

real hinge
#

I dont know why but while reading other peoples aoc codes I feel dumb

#

I can not undrestand

tranquil vapor
#

i even wrote an assert function and spammed assert statements in all branches posttroll

#

only to fucking realise the issue was mutating the same array i was looping over

real hinge
#

its weird that crystal lets you do that

tranquil vapor
#

yeah java throws an error

#

better

real hinge
#

all languages I know explodes when you do that

#

ConcurrentModificationException blahblhg

tranquil vapor
#

crystal

warped dust
#

duh bitc

#

im saying ruby

native pewter
warped dust
#

never

#

she doesn't deserve it

native pewter
#

im too dumb to do range split rn

real hinge
#

@tranquil vapor

tranquil vapor
#

why is the crystal extension useless

#

the demo gif shows intellisense...

#

but im not getting any

real hinge
tranquil vapor
real hinge
#

I never managed to get vlang language server running too

#

actually wait I did but it was working extremely slow

tranquil vapor
#

its not actually like that

native pewter
#

lmao

real hinge
#

clickbaits on programming languages smh

tranquil vapor
#

its sad that these languages are ruined by bad LSP

real hinge
#

yeah

tranquil vapor
#

cause i dont wanna use a language that has poor IDE support

#

i think the language with the best IDE support is typescript

real hinge
#

language server is the thing that makes language usable

tranquil vapor
#

and java / kotlin

real hinge
#

and easy to learn

tranquil vapor
#

ruby language server is pretty shit as well

sullen fiber
#

i didnt know u could do [obj.a] = x

#

in js

#

fire

tranquil vapor
#

fake

sullen fiber
tranquil vapor
#

WHAT THE FUCK

sullen fiber
#

LOL

tranquil vapor
#

BAD BOT

#

@burnt light BANGER IDEA FOR HIDDENPHOX

sullen fiber
#

oh true

#

OH TRUE

tranquil vapor
real hinge
#

js is so scary

#

why can you do that

sullen fiber
#

theyre pointers

burnt light
#

yeah i can implement that real quick

tranquil vapor
#

one thing to note

real hinge
tranquil vapor
#

if codeblock contains || it will break

burnt light
#

|| ```js
deez || nuts

#

damn

tranquil vapor
#

you can put ZWSP between them

burnt light
#

yeah might have to

#

"why code no work from copypasting"

tranquil vapor
#

yeah true

burnt light
#

i mean

tranquil vapor
#

maybe u can add a warning

burnt light
#

vscode has invisible character detection so

#

but yeah ill still add warning

tranquil vapor
#

**solution.cr: **Line 7 - ⚠️ zero width spaces have been added to the code

# ITS SO OVER
burnt light
#

ye

tranquil vapor
#

i mean you likely already add ZWSP between ` too, no?

tranquil vapor
#

xd

#

u dont

#

probably should tho

sullen fiber
#

what if discord was good

sullen fiber
#

uh not really but kinda

#

i handle the cases but not as separately as you

#

but its basically the same yea

#

||basically i just drew each of the 6 possible cases on paper, and wrote down a formula for each of the 3 ranges (before, mapped, after), and then map mapped and set unmapped to after||

burnt light
#

spoilers implemented and breaking codeblocks fixed thumbsup

sullen fiber
#

LMWAO

native pewter
#

:troley

daring marlinBOT
burnt light
#

guh

#

its cause i did \s+ for the end not \s*

sullen fiber
#

one of thse days the aoc solution will be oriented around whitespace and the presence of that zwsp warning will be a spoiler too

#

trust

sullen fiber
daring marlinBOT
burnt light
tranquil vapor
sullen fiber
#

its a lot terser

#

same complexity

#

less readable

#

also apparently my code has a bug but it doesnt affect my answer so fire

tranquil vapor
#

NaN

sullen fiber
#

TYPESCRIPT SUCKS

tranquil vapor
#

soo false

sullen fiber
#

??????!!!!!!!!!######

tranquil vapor
#

classes suck in ts

#

they don't infer types from parent classes or interfaces

#

it's stupid

#

that's why vencord and really anything uses definePlugin()

#

cause that's the only way to get automatic typing in an object declaration

sullen fiber
#

i havent noticed that before because ive only ever seen two cases where they actually handle it really good

#

which is inheritence, and forcing ur overrides to have the same signature

#

but this SUCKs

#

JUST INFER

tranquil vapor
#

it only enforces

#

you still need to explicitly specify types and then it goes uhh can't assign to parent

sullen fiber
#

belehe blheble hhleblh eblhlbehljhbe

#

hegrws

#

?!?!?!

#

Currently, this code is OK: for(;;);

proper totem
sullen fiber
#

okok

tranquil vapor
#

send large input for day 5

#

I wanna try

proper totem
#

I feel like you could make a larger input by just generating more random numbers to put on the seeds line

#

but ig more mappings would be good too

tranquil vapor
#

more seeds would hardly do anything

#

but like 200.000 mappings would

#

actually mm

#

my solution likely would oom on 200k mappings

#

cause of exponential growth of subranges xd

#

that'd be interesting

#

it'd force you to re-join ranges

sullen fiber
#

yea i was gonna add a Range.flatten(Range[]): Range[]

#

but i DIDNT CARE enough cus i didnt need to

tranquil vapor
#

i should check how many ranges I end up at the end

#

i wonder

#

cause it really is exponential growth lol

#

oh thats not too many

sullen fiber
#

@tranquil vapor how many mappings should i do per

#

and how many seeds

tranquil vapor
#

do 1000 seeds and 10000 mappings

sullen fiber
#

kk

tranquil vapor
#

if u wanna try my program on ur generated input

just put example.txt and input.txt in the same dir as the binary and run

#

wait can u run it without those files present and tell me if it leaks my file paths lol

im curious now cause it does for me

sullen fiber
#

i gtg for a bit

#

go on wsl and strings it

tranquil vapor
#

wdym wsl 😭

#

im on linux....

sullen fiber
#

oh i htought u were win11

tranquil vapor
#

lol yeah

#

silly

#

i noticed cause of the stacktrace

#

i wonder if theres a way to have it strip those things

sullen fiber
#

U can prob just mask it out

tranquil vapor
#

wait --no-debug is bigger than normal build

#

lol

warped dust
#

congratulations you just found a flaw every compiler seems to make somehow

tranquil vapor
#

oh cause i didnt release

#

there we go

#

so --no-debug does work

warped dust
#

yop

tranquil vapor
#

i'd expect that to be disabled by default in release builds

#

weird

#

like in dev builds its very useful but not release

#

it could just do relative paths or just filenames and still be useful

warped dust
#

or not do any paths and not leak information about source code

tranquil vapor
#

crystal is lovely tho

#

i would use it a lot if it had a good LSP

sullen fiber
#

Same w Julia

#

I really wanna learn Julia but it's crazy that the lsp has no intellisense support or good type information on hover

tranquil vapor
#

yeahh

#

crystal lsp is basically worthless

#

it reports errors but thats it xd

#

0 hover info or intellisense

warped dust
#

vee do erlang tomorrow

tranquil vapor
#

is it a lisp

#

i forgot

warped dust
#

no*

#

ignore the asterisk just do it

tranquil vapor
#

WAIT

#

WHY ARE THESE OPTIONS DISABLED BY DEFAULT

proper totem
#

vencord rewrite in crystal soon

tranquil vapor
#

YOP

warped dust
#

oh yes i would like my lsp to not function as one

#

give em a choice for that

#

leave it as default

#

😭

tranquil vapor
#

and now its actually usable

warped dust
#

you will use the whatsapp erlang lsp

tranquil vapor
#

WTF IS THAT

#

HORROR

warped dust
#

malware

tranquil vapor
#

thats terrifying

warped dust
#

wheres the whatsapp car

tranquil vapor
#

people will stop putting random languages on codeblocks that just contain documentation

warped dust
#

Usage: Erlang LS

#

real executable name

warped dust
tranquil vapor
#

tbh i dont get the obsession with writing everything in the language its for xd

#

its kinda counter intuitive

#

cause you're reimplementing the same shit in every language

#

it'd make much more sense to just steal some other languages LSP and adapt it for ur own lang

warped dust
#

exactly rust-analyzer shouldve been written in C

tranquil vapor
#

YOP

warped dust
#

but the real answer is for interpreted languages its super easy to introspect

#

hell compiled languages can use part of the compiler to analyze (im p sure rust-analzer does that)

#

why do bots keep following me on github

tranquil vapor
#

my bad

warped dust
#

this is not a real person

#

they lack any signs of life

tranquil vapor
#

so many followers

#

insane

#

nor is he part of the org

warped dust
#

fire

tranquil vapor
#

well, claims to have anyway

warped dust
#

i barely use github how do people find me

tranquil vapor
warped dust
#

wtf is that

#

can i sb someone on github

warped dust
#

😭

#

took it to the moon 🚀🚀🚀🚀🚀🚀v

tranquil vapor
#

get repo with many stars (supposedly)
"i want to help others"
become grifter

#

so normal

warped dust
#

his name is nevo hes totally the guy who invented novu

tranquil vapor
#

he doesnt even follow u

#

did u block

warped dust
#

yes

#

lmao

tranquil vapor
#

unsane

#

where is it...

warped dust
#

dead ❤️

tranquil vapor
#

gonna pr gopher.png

#

do u think they will kill me

warped dust
#

yes

native pewter
#

i hope

native pewter
#

they rly be smoking meth over there

sullen fiber
#

LMAO

sullen fiber
#

crystal has macros?

#

@tranquil vapor are they good

tranquil vapor
#

dunno didnt use

sullen fiber
#

i dont expect them to be rust good but

#

Macros are methods that receive AST nodes at compile-time and produce code that is pasted into a program
this does sound fire

#

im gonna learn this so i can code on my phone for AOC

native pewter
#

i saw that but ngl

#

looks kinda wack

sullen fiber
#

cant even use it on mobile anyways it doesnt work from just vscode

#

needs some "talon" program

#

it looks pretty fire for what it is

#

voice coding

native pewter
#

me personally ima just wait for bmi

sullen fiber
#

what is bmi

#

oh

#

brain machien infer

#

ter

native pewter
#

too bad zed already stole that slogan

sullen fiber
#

ffffffff

#

what is zed

native pewter
#

stroke?

#

editor

sullen fiber
#

what is stroke

native pewter
#

but mac only

#

stroke is when a blood vessel in your brain goes oofie

sullen fiber
#

oh lmao

sullen fiber
#

VOICE CODING AT THE SPEED OF THOUGHT

#

multiplayer code editor FIRE

native pewter
sullen fiber
#

insertion latency? ? !

#

🚬

native pewter
sullen fiber
#

LOL

#

could definitely just ratelimit the destructive things also you'd prob have undo buffer still

#

zed looks like it might be good

native pewter
#

i mean yea but

#

my head is so full of dumb shit it almost sounds impossible

sullen fiber
#

crdt

#

seems cool

native pewter
#

crdt?

sullen fiber
native pewter
#

what the hell i read this already i straight up just forgot

sullen fiber
#

true true

eternal marlin
#

in rust ofc

sullen fiber
#

ok i think i made a good day 5 generator

#

@proper totem do you have a fast day 5 impl

warped dust
#

fire

sullen fiber
#

wait really

#

vim is like this?

warped dust
#

yeah except no movement (cursorless du

#

i mean it just reminded me of that

#

and theres plugins that map positions to specific letters

sullen fiber
#

sounds fire

#

very itnerestin

warped dust
#

HOW

sullen fiber
#

cursorful

tranquil vapor
sullen fiber
#

oh ur up

#

r u on ur computer ?

steady fog
#

mine will be faster

tranquil vapor
#

why do u even need one

#

is urs not fast enough

sullen fiber
#

just to make sure we get the same answer

tranquil vapor
#

ohh

sullen fiber
#

and that im not generating things wrong

warped dust
#

mine is the fastest it runs in 0 nanosecnods

tranquil vapor
#

nah im not on pc rn im in bed

sullen fiber
#

i think its right but blehg

tranquil vapor
#

but I sent binary above u can try

sullen fiber
#

oh yea u did true

#

will try

tranquil vapor
#

or just build from source I think they have crystal for windows now

sullen fiber
#

virusware

steady fog
warped dust
#

have alook

#

oops didncrop correctly

sullen fiber
#

LMAO

steady fog
#

im using crystal

sullen fiber
#

virtual crystal

steady fog
#

soon

sullen fiber
#

crystal but interpreted

steady fog
#

insane

warped dust
#

there are no real interpreted languages other than ones for the BEAM

steady fog
#

rini biggest beam fan

warped dust
#

the BEAM is the one and only vm

steady fog
#

jvm

warped dust
#

v8 is actually a fork of the BEAM

#

bastards didnt even credit them

steady fog
#

quit saying BEAM

tranquil vapor
warped dust
#

the BEAM

tranquil vapor
#

very good language

steady fog
#

vscode plugin wont work

#

nfvm

#

nvm

#

the default settings just suck

tranquil vapor
#

YEAH LOL

steady fog
#

soo bad

tranquil vapor
daring marlinBOT
steady fog
#

yop

tranquil vapor
#

i did both parts today with 0 editor support

#

cause I didn't turn these on

steady fog
#

im still on part 1

tranquil vapor
steady fog
#

okay

tranquil vapor
#

download then change crystal server to the crystalline binary

steady fog
#

i wil do

sullen fiber
#

true

#

what if i crystalize

#

cryst4l1ze

#

is this good

#

it feels good

steady fog
#

godo

sullen fiber
#

bleh this is just arr.length = 2

#

totally fine no issues here blobcatcozy

steady fog
#

did you make that visualization

sullen fiber
#

no i got it from a guy on reddit

#

the code for it

steady fog
sullen fiber
#

but thats a viz of the inpput i generated

#

so nmormal

#

normal?

proper totem
#

time to make speedy solution

#

and be horrified at lack of ranges in js

sullen fiber
#

ok fixed i think

#

this looks like it works

#

there is one difference i see but idc really

steady fog
#

trying out cobol this is insanity

proper totem
#

fancy

steady fog
#

insanity

steady fog
proper totem
#

banger

proper totem
steady fog
#

nop

#

i hate

proper totem
#

languages that have all caps my beloved

steady fog
#

yop

sullen fiber
#

ok i made a large input

#

im trying to render it and its killing my pc

proper totem
#

oop

sullen fiber
#

oh thats why

proper totem
#

scary

sullen fiber
#

thats awesome

proper totem
#

i will do once I have large input capable solver

steady fog
#

learning how to make a class in crystal

#

guhgh

#

oh

#

ill use a struct

proper totem
#

is that something you're able to see

steady fog
#

record Guh, dest_start : Int32, source_start : Int32, length : Int32 beautiful

sullen fiber
#

yea my ts solution doesnt merge ranges so i can check

#

this person's rust solution does so i can check theirs too

steady fog
#

@sullen fiber vaporized

sullen fiber
#

oops should have included the solutions oto

#

i did just now

sullen fiber
proper totem
#

oh that's pretty good

steady fog
#

scary

#

humidity_to_location: [Guh(@dest_start=60, @source_start=56, @length=37), Guh(@dest_start=56, @source_start=93, @length=4)]

#

guh i just spilled hydrochloric acid all over me

sullen fiber
#

guh im already awake

#

might as well stay up til 12

harsh marsh
#

yea

#

do it

sullen fiber
#

@proper totem ok im gonna add u to the repo now

harsh marsh
sullen fiber
#

typescript

#

thats with the large input i made

harsh marsh
#

I get 50s with python which I'm pretty happy with

warped dust
#

i will stay awake but to play fnv

harsh marsh
#

never going to be as fast at typescript lol

sullen fiber
#

friday night vunkin

warped dust
#

aoc isnt real

#

NO

#

FALLOUT NEW VEGAS

sullen fiber
#

oh true

#

i used to play that game

warped dust
#

game of humanity's history

steady fog
#

guhhhh

sullen fiber
#

i played fallout 3 more

steady fog
#

do any of you do crystal

warped dust
#

we literally peaked

#

theres no more games to make

sullen fiber
#

rn my uncle is obsessed with f76

steady fog
#

crystal lang i mean

warped dust
#

f3 sucks from what i hear

sullen fiber
#

i wouldnt know i was a child with no standards

warped dust
#

fire

#

its not like bad on its own it just did everything wrong for fallout

steady fog
warped dust
#

nO

sullen fiber
#

i should play flaout new vega

steady fog
#

flaout

#

vega

warped dust
#

u will

sullen fiber
#

i would probably actually enjoy it

steady fog
#

why does repo want my name

#

help

warped dust
#

is there multiplayer mods

sullen fiber
steady fog
#

oh

#

i accidentally made my downloads folder a git repo

#

oops

harsh marsh
#

I end up with 7213 ranges in part 2

sullen fiber
#

steam and gog version ONLY

warped dust
#

i got it on sale

sullen fiber
warped dust
#

smh

steady fog
#

rini rot

#

@warped dust@warped dust@warped dust

warped dust
#

idk if mp works well actually cuz decisions matter a lot

sullen fiber
steady fog
#

i found limitation of crystal

#

@instance_vars are not yet allowed in metaclasses: use @@class_vars instead

#

sob

warped dust
#

the best decision is to kill the quest character btw

sullen fiber
#

aka myself

warped dust
#

wt,f

harsh marsh
#

I get 50s and 7213 ranges

steady fog
#

this 'initialize' doesn't explicitly initialize instance variable '@dest_start' of Guh, rendering it nilable

The instance variable '@dest_start' is initialized in other 'initialize' methods,
and by not initializing it here it's not clear if the variable is supposed
to be nilable or if this is a mistake.

To fix this error, either assign nil to it here:

@dest_start = nil

Or declare it as nilable outside at the type level:

#

hhghh

sullen fiber
#

ohhh true

steady fog
#

ok im using a struct

warped dust
#

you can kill like literally anyone and the quests just change to fix it

sullen fiber
#

fire

#

i wil lplay

#

but i will start in like a week cus im going to florid

#

a

steady fog
#

kills your rini

warped dust
#

i freed this guy from hostage under premise he'd give me info and he just said nope im running away

#

promptly i shot him

#

and turns out i needed him alive but its fine either way

sullen fiber
#

"A Soul of Fallen Worlds - Ruined America"

#

is this what they call the game in russia

warped dust
#

true

steady fog
#

@instance_vars are not yet allowed in metaclasses

#

STOP

sullen fiber
#

oh no its a mod

#

wtf

#

@warped dust whats the best way to like

#

make these available

#

github releases?

steady fog
#

@sullen fiber help

#
@dst_range = (dst_start..(dst_start + length)).to_a
@src_range = (src_start..(src_start + length)).to_a
#

am i understanding the ranges right?

#

Guh(@dst_start=56, @src_start=93, @length=4, @dst_range=[56, 57, 58, 59, 60], @src_range=[93, 94, 95, 96, 97])]

#

heres one

sullen fiber
#

uh is that crystal

steady fog
#

yes

warped dust
#

i mean they're random right

sullen fiber
#

i think a..b is [a, b] inclusive

steady fog
#

oh

#

i dont include the end?

sullen fiber
#

nah

#

u want a...b

#

i think

warped dust
#

you're probably better off commiting them

steady fog
#

okay

sullen fiber
#

well

#

seeded

warped dust
#

yeah so not exactly reproducible

#

unless you make it thta

sullen fiber
#

no they are

#

cus theyre seeded

warped dust
#

oh is it constant

sullen fiber
#

the seeds are like

#

temperature:mapping:holes:1

#

i use these

warped dust
#

pseudo random implies seeding so i thought u were seeding it w time

steady fog
#

fisher yates

sullen fiber
#

yea i meant like

steady fog
#

@sullen fiber i have another question

#

the seeds list

sullen fiber
#

i meant seeded not psuedo random

steady fog
#

do i foreach seed in seeds

sullen fiber
#

the seeds are ranges

#

are u on part 1 or part 2

steady fog
#

1

sullen fiber
#

oph my bad

#

yea just for each

steady fog
#

idk this is all so worded weird

warped dust
#

u will do an actual pseudorandom algo instead of hashing each step

steady fog
#

word problems hard

sullen fiber
#

then call order would matter

#

and yea i prob wont change call order without altering the output but

#

just in case ig idk

steady fog
#

dissolves you

sullen fiber
#

nop

steady fog
#

yop

steady fog
#

rini will get struck by lightning

warped dust
#

crashed my browser

sullen fiber
#

opening large?

warped dust
#

yoap

sullen fiber
#

huge

steady fog
#

guhhh im like

#

blanking

warped dust
#

(it just took long to load

steady fog
#

its not making sense to me

warped dust
#

why the fuck does github even render it

sullen fiber
#

2mb it must

steady fog
#

vap help

sullen fiber
#

what part

steady fog
#

all

sullen fiber
#

youre like

#

taking the seeds

#

and mapping them all thru each group

steady fog
#

how do i get the new value

sullen fiber
#

ask questions idk

#

the mappings are like destStart sourceStart rangeSize

steady fog
#

i got that

sullen fiber
#

u did the ranges right i think

steady fog
#

seed 79 goes in

#

do i just do a bunch of for loops

sullen fiber
#

seed 79 goes in

#

u find either 1 or 0 lines that maps it

#

if it falls in the source range add destStart - sourceStart

#

if there are no lines that map it it stays the same

steady fog
#

im trying to think of a visualization

#

i need to iterate through my ranges right

#
52 50 48```
sullen fiber
#

yea u need to find which one actually maps the seed

steady fog
#

so only one will map it?

sullen fiber
#

or none

steady fog
#

oh

#

ok

sullen fiber
#

there are no overlapping ranges if that helps

steady fog
#

the final value should be the location right

sullen fiber
#

yea

steady fog
#

cause i think i could do a min

sullen fiber
#

ya def

steady fog
#
final_location = seeds.min_by do |seed|
  location = seed

  seed_to_soil.each do |range|
  end

  soil_to_fertilizer.each do |range|
  end

  fertilizer_to_water.each do |range|
  end

  water_to_light.each do |range|
  end

  light_to_temperature.each do |range|
  end

  temperature_to_humidity.each do |range|
  end

  humidity_to_location.each do |range|
  end

  location
end
``` @sullen fiber so something like this
sullen fiber
#

oh jesus

#

surely u could simplify it

steady fog
#

oh

sullen fiber
#

but yea

steady fog
#

i could make a common inteface or something

sullen fiber
#

yea they're all really the same thing

#

@warped dust fear

harsh marsh
#

@sullen fiber Improved my time in python on the big input part 2 to 96.1 ms

sullen fiber
#

HUGE

#

INSANE

#

i wonder what the bottleneck it

#

i should check the flamegraph

harsh marsh
#

I'm mostly improving it by just getting rid of useless iterations

#

cause my loops were not optimized

#

also 96.1 is kinda fake cause i'm benchmarking it after parsing

sullen fiber
#

mine probably arent either

#

meh thats normal

#

i am too

#

frick parsing

warped dust
sullen fiber
#

no the installer was silent sadly

#

pheonix is just like some kinda unpacker

#

for some old disc game format

#

i think

steady fog
#

@sullen fiber its mapping the example correctly

#

it shouldnt be 13 though

#

i migth be using min_by wrong

sullen fiber
#

yea thats right but yea itd be 35

steady fog
#

oh i see

#

min_of is the one i needed

#

Unhandled exception: Invalid Int32: "2531594804" (ArgumentError)

#

funny overflow

harsh marsh
#

hmm i'm not taking advantage of the non-overlapping mapping ranges very well even with the binary search

#

there should be some smart iteration to avoid that entirely

#

oh well

warped dust
#

PYTHON NOTEBOOK

harsh marsh
#

what about it

steady fog
#

i think i did something wrong