[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
>> No.73900428

I'm here for comfyness, infighting renders that moot.
Please refrain from infighting.

>> No.73900445


>> No.73900451

>tfw rewrote IntCode interpreter 2 times to have both class-based and generator-based one
>tfw currently implementing a 3rd one with a recursive loop optimizer
The greatest joke AoC could pull at this point is to not have any more IntCode problems

>> No.73900462

How does your optimizer work anon?

>> No.73900509


>> No.73900582

I wasn't so amused when I discovered it.
I find it handy now though.

>> No.73900590

fuck you

>> No.73900615


it made me want to brush up on my graph theory

i struggled coming up with a way to assemble it without using a library

>> No.73900827
File: 21 KB, 935x336, part1 and part2.png [View same] [iqdb] [saucenao] [google] [report]

>first input - signal from previous node
Why did you ignore this handy diagram? And the prompt, for that matter.

>> No.73900974

>outputs 50 instead of 139629729
If you look in the program, your first input tells it where to find and address to jump (each 'phase setting' having it's own routine that ends in a halt).
You sent amplifier A off to a routine from part 1 which only wanted 1 more input, gave it that input, then took its final output.
You sent amplifier B off to some random spot in memory and it must have landed on a real opcode or it would have crashed without unblocking amplifier C.
Amplifiers C and D should have gone on similar journeys.
I'm amazed you got them all to halt. Would you mind posting your puzzle input so I can take a look?

>> No.73901016

If his inputs read the most recent output without consuming it then he might have crashed B on a bad opcode then jumped to the same spot on and crashed C, D, and E as well.

>> No.73901055
File: 2.29 MB, 1262x1786, codescreen.png [View same] [iqdb] [saucenao] [google] [report]

Haskell was a lot nicer than I thought it would be...

>> No.73901073
File: 955 KB, 330x245, 14jrupf.gif [View same] [iqdb] [saucenao] [google] [report]

Guess who made it, bros

>> No.73901078

>been awake for over 24 hours
>sick and exhausted, absolutely destroyed my toilet
>lost hope last puzzle, nearly got filtered
I really should go to sleep, I don't know how I could possibly program right now.

>> No.73901174


>> No.73901194

I'm gonna spoonfeed you guys a little snippet, I feel it in my bones, it will be useful in 10 mins.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None

>> No.73901197
File: 117 KB, 474x474, 1575295830656.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.73901199

>in a scripting language that sucks at multithreading
lol why

>> No.73901235

My body is ready... but my mind is not.

>> No.73901236

only high IQ chads did, sorry for assuming you were one too

>> No.73901249

Oh god, I think the shits are back. Now now, of all times.

>> No.73901250

yes it is cheating
and why would you call it "my solution" when your solution is just
import x

>> No.73901251
File: 243 KB, 1277x957, showtime.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.73901258

I cleaned up all of my solutions today too.

cat input |awk 'BEGIN{FS=")"} {MAP[$2]=$1;A[NR]=$2} END{c=0;for(i=1;i<=NR;i++){c--;while(A[i]!=""){c++;A[i]=MAP[A[i]]}};print c}'

cat input |awk 'BEGIN{FS=")"} {MAP[$2]=$1;A[NR]=$2} END{for(i=1;i<=NR;i++){foo=A[i];while(A[i]!=""){A[i]=MAP[A[i]];foo=foo" "A[i]};print foo}}' > FOOtoCOM && cat FOOtoCOM |grep '^YOU' |sed "s/ /\n/g" > YOUtoCOM && cat FOOtoCOM |grep '^SAN' |sed "s/ /\n/g" |cat YOUtoCOM - |sort |uniq -u |wc |awk '{print $2-2}' && rm FOOtoCOM YOUtoCOM

>> No.73901262

>why when you call it "my solution" when your solution is just
>buy a computer
>type some stuff on it
>use someone else's compiler

>> No.73901263

I wouldn't outright call it cheating... just disingenuous to call it "my code"

>> No.73901264

get fucked scumbag

>> No.73901364
File: 203 KB, 644x644, 1540244208953.png [View same] [iqdb] [saucenao] [google] [report]

>tfw you tried solving the planet hopping problem with drawn graph and you're all set for doing even serious graphics

>> No.73901403

>he didn't write his own compiler
you're a fucking nigger

>> No.73901406

are we supposed to OCR this fucking message?

>> No.73901423

This problem was too easy for a sunday or for day 8. So far this year has been weird, it started harder than usual and then it started alternating intcode with easy problems.

>> No.73901429
File: 41 KB, 374x374, 1565184161213.jpg [View same] [iqdb] [saucenao] [google] [report]

>part 1, took the row with the max number of 0's instead of the min number
>part 2, submitted huge bitstring instead of the english letters

Pic related, it's me

>> No.73901449

OCR it with your eyes when you print it to the console.

>> No.73901451

someone give me their input and answer

>> No.73901452

someone fucking explain part 2

>> No.73901486

python was nice for my 2am brainlet today

--------Part 1-------- --------Part 2--------
Day Time Rank Score Time Rank Score
8 00:10:58 693 0 00:18:06 419 0

>> No.73901494

well here's what I'm doing
auto visible = input[0].dup;
foreach (layer; input[1..$]) {
foreach (i, c; layer) {
if (visible[i] == '2')
visible[i] = c;

first layer is what's visible
go through all the other layers
replace any visible transparent pixels with what's in that layer

>> No.73901514

-------Part 1-------- -------Part 2--------
Day Time Rank Score Time Rank Score
8 00:08:08 395 0 00:26:22 848 0

would've been 10min if I'd just deleted the part1 shit.

>> No.73901515

check if you aren't putting in stupid chars like \n or missing others

>> No.73901518

Holy shit I had no idea what the fuck he meant by message, I tried decoding the damn thing as UTF-8 what a shit day.
-------Part 1-------- -------Part 2--------
Day Time Rank Score Time Rank Score
8 00:10:03 591 0 00:24:07 711 0

>> No.73901519

Misread the dimensions.
Misread "max" as "min" number of zeroes.
Misread which color was transparent.

God damnit.

>> No.73901521
File: 37 KB, 631x233, 2019-12-08_02-27-39.png [View same] [iqdb] [saucenao] [google] [report]

So data science wasn't a meme after all.

>> No.73901526

a nice mars orange, but you missed earth's blue

>> No.73901527

Fucking hell I spent the past 20 minutes trying to figure out why my part 2 was broken when it worked on the input, turned out it was working fucking fine but I couldn't read the output. I replaced 0s with spaces and got it immediately.

>> No.73901532

same kek

>> No.73901560 [DELETED] 

and what else did you expect? It's the image height

>> No.73901563

>Decode picture.
>Think the U is a V

>> No.73901564

>Misread "max" as "min" number of zeroes.
I thought the prompt asked for the layer with the fewest zeroes?

>> No.73901568

>Tried to do in numpy
>Failed because I have no idea how to use it
>hacked up some ugly shit with nested lists
gotta learn it tomorrow.

>> No.73901574
File: 18 KB, 1033x229, d8.png [View same] [iqdb] [saucenao] [google] [report]

>easy as fuck problem
I thought today was supposed to be another filter or something.
Anyone else too lazy to dredge up their extremely refined 2d grid rendering code from last year, and just printed the array as-is and then fucked with the console window size instead?

>> No.73901580

I got what you said now nvm lol

>> No.73901597

>day 7: connect and simulate multiple I/O-capable virtual machines
>day 8: add some strings together

>> No.73901598

even on easy as fuck problems like today's, I can't get close to top 100 globally. what is wrong with me

>> No.73901601

Took me way too long to figure out what the image said, turns out I just had black and white reversed.

>> No.73901603

I almost went back to sleep because of being too tired but wanted to atleast look at the problem.
Good thing I did, because it's my first time getting any global points at all

>> No.73901608

depends on what your strengths are. my global rank was much better on yesterday's than today's!

>> No.73901609

I wasted 10 mins because my computer crashed and I had to restart REEEEEEEEE

>> No.73901615
File: 85 KB, 240x240, aiharamai-7e.png [View same] [iqdb] [saucenao] [google] [report]

>everyone saying this is a simple challenge

Meanwhile I can't even figure out how to split the string into layers correctly

>> No.73901641
File: 217 KB, 1262x3070, 1.png [View same] [iqdb] [saucenao] [google] [report]

It's not pretty, but it did the job. I'll write a nicer, clever-er version of it soon.

>> No.73901653
File: 196 KB, 1652x1516, dee8.png [View same] [iqdb] [saucenao] [google] [report]

D's range/algo stuff made this day trivial. I just need to master it and not get confused by sort of all things.

>> No.73901658

>fuck up list comprehension. get wrong answer
>make function to view image using layers
>still garbage
>finally figure out I fucked up list comprehension, finish part 1
>turns out 2 is fucking transparent instead of 0 (WTF)

>> No.73901664

I do worse on the easy problems because I'm slow as shit and I usually fuck up some minor shit. Like on todays, I split the file into 150 character sections, but I missed that there was a closing newline which became my last section (and of course it had the fewest 0s in it, which made my answer 0)

>> No.73901671

Day 8 input and output for anons in need

>> No.73901672

Does your language not have a chunk function?

>> No.73901682

>wrote complicated recursive parsing solution
>realize afterwards that chunksOf is a thing

>> No.73901684

>challenge starts
>immediate and strong need to poop
>run code 1st time
>result is 1488
>lmao what
>wrong result
>turns out I didn't trim my input data string

>> No.73901703

>need to find an imaging library for node
anons should I just export the result as json and use html canvas to render my results instead?

>> No.73901704

record keeper here, not at home so I'll post the stats later

>> No.73901733

just print the image rows to the console

>> No.73901741

Haven't seen any durgasoft posts recently. Did all the pajeets get filtered?

>> No.73901755

Write the indices of each block out:
>data[0 : 25]
>data[25 : 50]
>data[50 : 75]
>etc., etc.
then think about how you'd generate that pattern in code.

>> No.73901756

idk how either
ill post my code with the bug later and a pastebin to my input tho

>> No.73901766

>wasted 20 minutes because i didn't think 5+14+121=150
This is a new low.

>> No.73901768

i'm a brainlet and that confuses me even more tho
I'd have to compress all layers into one and deal with transparency etc
I think ill just use html canvas

>> No.73901770

Fuck me, that's wrong, but you get the point hopefully

>> No.73901773

chunk is what happens when your shit ain't comin out in a log.
What you're reffering to is called substring

>> No.73901784

Go be retarded somewhere else

>> No.73901811

if the image is 6 pixels tall, that means 6 layers right?

>> No.73901825

Layer count is independent of resolution.

>> No.73901829

retard is what happens when a python "programmer" has a child with a rust "programmer".
What you're referring to is called smartass

>> No.73901846

No it meas the height of the image is 6 pixels.

>> No.73901868

because it's Sunday and good Christians need to go to bed early so that they can wake up early and go to Church.
This is Advent of CHRISTmas after all.

>> No.73901869
File: 115 B, 25x6, hola.png [View same] [iqdb] [saucenao] [google] [report]

numpy master race checking in, cv2.imshow for the second part as well.

>> No.73901934

the really easy ones i do bad timewise because i try to do everything in detail and spend time to understand it properly
but complicated ones i do better it seems
it probably depends on what language you use as well

>> No.73901937

My input if bloody buggy!
Can somebody confirm? This shouldn't be happening in 2019


>> No.73901944

You did line break when the integer was divisible by 150, but failed to realize 0 is divisible by 150.

>> No.73902018

>finish problem
>all working
>decide to refactor it all to make it prettier
>completely stops working
oh no...

>> No.73902021
File: 219 KB, 1920x1080, 1563431568080.jpg [View same] [iqdb] [saucenao] [google] [report]

I fell for it.

>> No.73902026

> not to print the 0s
200iq play
$ ./8.sh

>> No.73902054

Might be a good addition.

>> No.73902064

That's even less readable.
$ ./8.sh

>> No.73902071
File: 51 KB, 789x250, 2019-12-08_03-18-13.png [View same] [iqdb] [saucenao] [google] [report]

Part 2.
Not even ashamed.

>> No.73902150


>> No.73902168
File: 147 KB, 802x915, day08_carbonite.png [View same] [iqdb] [saucenao] [google] [report]

Too soft, get on my level.

>> No.73902182
File: 23 KB, 1169x337, 2019-12-08-013014_1169x337_scrot.png [View same] [iqdb] [saucenao] [google] [report]

>1/3 of pixels are contributed by first and last layer
these elves are stupid

>> No.73902213

Try using more contrasting characters than 0 and 1.

>> No.73902215

print zeros as spaces to make it more legible
' 11 1 11 1 11 1 1 ',
'1 1 1 11 1 1 1 1 1 ',
'1 1 1 1 1 1 1 1111 ',
'1 1 1 1 1111 1 1 ',
'1 1 1 1 1 1 1 1 1 ',
' 11 1 11 1 1 1 1 '


>> No.73902220


>> No.73902223
File: 159 B, 25x6, 1548586719892.png [View same] [iqdb] [saucenao] [google] [report]

good idea

I found a binary to image generator

>> No.73902225

>trying to prevent criticism with silly colors
line 4 should have $!, not [email protected]
you only want the first line. why do you read all of them?
>scalar(@pixels) / $area;
scalar() isn't the "get a length of an array" op. Just have @pixels/$area
>all that part1 shit
split @lines into @layers, Jesus.
most of this code is due to your bizarre decision to not do this.
>C-style for loops
for my $i (0 .. $area-1)
course you wouldn't even that with @layers
>$c ? $c : ' ';
$c || ' ';
>no use strict; use warnings

>> No.73902231

Are your layers ordered correctly?
Perhaps they are backwards

>> No.73902234

oh shit it's ant size.

thanks anon

>> No.73902240

cool, thanks for the feedback anon, still new to perl

>> No.73902256
File: 1.06 MB, 892x1760, carbon08.png [View same] [iqdb] [saucenao] [google] [report]


>> No.73902268

Fuck you man, your input stole my stars.

>> No.73902278
File: 219 KB, 1020x2250, 1572764396028.png [View same] [iqdb] [saucenao] [google] [report]

it took me way too long to do this, I still have to fix yesterdays shit

>> No.73902282

>I found
just emit ppm
It's a really easy ASCII image format and you can open the results directly.
void putPPM(const dchar[] pixels, int width, int height) {
writeln("P3\n", width, " ", height, "\n255");
foreach (i; iota(width * height)) {
switch (pixels[i]) {
case '2':
case '0':
writeln("0 0 0");
case '1':
writeln("255 255 255");

>> No.73902329
File: 161 KB, 1030x1192, 2019-12-08-015040_1030x1192_scrot.png [View same] [iqdb] [saucenao] [google] [report]

go away, Roblox user, you must be 18 to use this forum

go back to >>>/vg/mjg/, retarded shrine maiden

>100loc for this
death to java


>> No.73902331

its c#

>> No.73902334
File: 258 KB, 1024x1636, day8-fuck-this.png [View same] [iqdb] [saucenao] [google] [report]

fuck I almost got filtered today

>> No.73902351
File: 483 KB, 731x720, Garbage.png [View same] [iqdb] [saucenao] [google] [report]

>fuck I almost got filtered today
literally how..

>> No.73902384

>unreadable meme language
but you repeat yourself

>> No.73902412

anybody solve part 2 by putting the input into notepad and doing a find/replace?

>> No.73902414

>hey guys have a bigdick shitpost but i forgot to bring the dick

>> No.73902449

had a bug
im not afraid that something i dont know will get me filtered, learning new shit for me isn't that hard
im afraid something i know damn well will get me filtered because of a stupid fucking mistake right in front of my eyes

>> No.73902466

i know its a meme, but a stupid mistake in a time-pressure competition is not really filtering, since it happens to most people when rushing

>> No.73902467
File: 31 KB, 616x318, day8.png [View same] [iqdb] [saucenao] [google] [report]

this was one of the hardest ones so far to get global points for
the fast guys did it so fast
nice job btw

>> No.73902475
File: 301 KB, 1084x3368, 1557185199910.png [View same] [iqdb] [saucenao] [google] [report]

THANK YOU ANON WHO TOLD ME ABOUT GENERATORS YOU SAVED MY LIFE. Can't believe I never knew they existed, I should do a thorough read-through the docs I guess

>> No.73902513

Someone make a better nigboy input
Dammit 4chan this is just a shitpost, not actually spam

>> No.73902514

why dont you make a helper function to do generate, next, and initialize so you dont write the same thing like 15 times

>> No.73902515
File: 215 KB, 1584x2060, carbon(1).png [View same] [iqdb] [saucenao] [google] [report]

R8 my concise C++

>> No.73902548

>decipher low resolution output
>spend half an hour trying different output formats
>still looks the same
>squint real hard
>6 was a G all this time
I've ascended past getting BTFO by the english language, at this point even individual letters are turning into nigh unconquerable obstacles.

>> No.73902558

pretty cool, though
>digit - '0'
makes me nervous for no good reason due to UTF pajeet fearmongering

>> No.73902560

yeah I could put the intcodeGen functions into an object and make everything cleaner, I just wanted something that worked for now, I spent all day fucking around with input streams tearing my hair out trying to make it work, anon mentioned using generators so I looked those up and this took my like 5 minutes. So now I have a generator intcode computer and a regular input/output stream one

>> No.73902562

i didnt put anime girls on mine

>> No.73902572

yeah its best just to get it working first then go through and clean it up later unless you get really stuck

>> No.73902574

Part 3, write a converter for the final image input into ascii

>> No.73902576

What is with that see-through anime shit? Are you guys writing your programs inside the terminal or is that an IDE?

>> No.73902577

UTF doesn't exist in C/C++, don't worry

>> No.73902580
File: 73 KB, 1022x528, 2019.png [View same] [iqdb] [saucenao] [google] [report]


>> No.73902583



>> No.73902594

concise, modern, and elegant anon!

>> No.73902605

>the first layer is the top layer

Fucking lost 20 minutes to reading comprehension again

>> No.73902606

A fundamental problem is that your string is longer than the answers so you need an even shittier font to fit the dimensions we've all magic number constrained ourselves into.

>> No.73902618

That's 140.

>> No.73902624

half a thread of posts for day 08 so far, on a weekend, damn. hopefully calendarbros show up today

>> No.73902633

Not even an ancient religious icon? Disappointed.

>> No.73902636
File: 56 KB, 621x702, brainlet.png [View same] [iqdb] [saucenao] [google] [report]

what else would it be

>> No.73902639

Beware the poison clause, though.
>You acknowledge and agree that any questions, comments, suggestions, ideas, feedback, or other information regarding the Site ("Submissions") provided by you to us are non-confidential and shall become our sole property. We shall own exclusive rights, including all intellectual property rights, and shall be entitled to the unrestricted use and dissemination of these Submissions for any lawful purpose, commercial or otherwise, without acknowledgment or compensation to you. You hereby waive all moral rights to any such Submissions, and you hereby warrant that any such Submissions are original with you or that you have the right to submit such Submissions. You agree there shall be no recourse against us for any alleged or actual infringement or misappropriation of any proprietary right in your Submissions.

>> No.73902662

sounds like someone's a cheater

>> No.73902669
File: 197 KB, 1612x1012, day8.png [View same] [iqdb] [saucenao] [google] [report]

Thrown together

>> No.73902700

You know what's coming tomorrow, then

>> No.73902752

add win 10 or kde breeze buttons anon

>> No.73902759

If you license something you still retain the rights, which you can extend to someone else regardless of the license you publicly released under. Meaning, when you submit GPL code to a private website, depending on their EULA/TOS, you are most likely also giving them rights to the code regardless of the license. Anyone else who publicly comes across the code is bound to the license. The website owners are not.

>there's no way that's legal
maybe you should actually read what you agree to

>> No.73902760

im still going to use the site and add GPL to dab on them

>> No.73902779

Well, hardly any difference
(btw, whitespace is skipped automatically by in >> digit , no need for checks)

>> No.73902840
File: 400 KB, 791x549, carbon.png [View same] [iqdb] [saucenao] [google] [report]


>> No.73903302

Already replaced my dude. Read the whole thread before you post.

>> No.73904240
File: 224 KB, 500x500, Drink.png [View same] [iqdb] [saucenao] [google] [report]

ok neckbeard

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.