Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2021-12-02 00:00:00Z and 2021-12-03 00:00:00Z
Avatar
justinevilde BOT 2021-12-02 03:30:31Z
!KGxsyoVGiJnswWhQld:matrix.org
Avatar
gg heinrich
Avatar
ty, gg
05:12
made a mistake today reading the part 2 specification
05:12
submitted the wrong answer first
Avatar
pretty cool puzzles so far I guess I can expect file input next times as well, so I will setup quick loading & splitting (edited)
Avatar
yes, it's file input every day
05:17
I also have a template file with common stuff
05:17
check out last year's aoc to get an idea what the common ways of preprocessing the inputare
Avatar
i will, thanks seems just like project euler but easier
Avatar
today was easier
Avatar
hm, don't think so
Avatar
im sure more people struggle looping with a sliding window than splitting text
07:00
xd
Avatar
ah, I guess
07:01
today I wrote an actual for loop
07:01
yesterday it was just a list comprehension ^^
Avatar
well thats a loop too
Avatar
but without the state
07:03
but I guess I see your point
07:03
i love this smiley face
Avatar
@Ryozuki case in point, one of my friends took 20min to parse the input data, but had no problems yesterday
Avatar
the first puzzle from 2020 where you have to find the pair of 2 numbers that add up 2020, has a nice solution idea I saw in a google interview. You start with an empty ordered set. You check if list[i] is contained in that set, if yes you found the pair (it is list[i] and (2020 - list[i]). if not, add (2020 - list[i]) to the ordered set. A pretty neat (and somewhat fast) solution. I am not sure if this approach can be adjusted to work for 3 targets though (edited)
Avatar
I guess you can still meet in the "middle"
07:56
test whether 2020 - a - b is in the set for any pair a, b from your set
07:56
(where "set" means your input data in a set datastructure)
Avatar
I can't quite grasp the logic. If not found, what would you add to the set?
Avatar
input = […] input_set = set(input) for a, b in itertools.combinations(input, 2): if 2020 - a - b in input_set: return a, b, 2020 - a - b
08:07
untested, coded in the discord chat message box 😄
Avatar
Ahhh ok now I got it. Very nice. So you can search for any number of summands without increasing time complexity.
Avatar
hm, this is O(n^2), unfortunately
Avatar
which day is it?
Avatar
1
Avatar
oh yea my solution is not pretty xd
Avatar
Oh , combinations adds I see. I guess I will see it live in C++ when I try to implement the idea.
Avatar
https://gist.github.com/edg-l/b8f6fcd860411de8b9ec8158f6491477 i made the day 2 in rust but trying to do it super rusty
aoc2021 day 2 b in rust. GitHub Gist: instantly share code, notes, and snippets.
08:55
idk if it fits xd
Avatar
chillerdragon BOT 2021-12-02 09:20:09Z
aoc is so weird. Do you even have to write a program? Or can you solve it just based on your input? xd
Avatar
well, if you don't write a program you're likely to be slower than people who do write a program
09:20
the input is quite large
Avatar
chillerdragon BOT 2021-12-02 09:20:49Z
but there is only 1 input?
Avatar
one input for each person
Avatar
chillerdragon BOT 2021-12-02 09:21:18Z
im pretty sure im faster not writing a program xd
Avatar
I'm pretty sure you're faster writing a program
09:22
@Ryozuki your Default impl can be replaced by #[derive(Default)]. but maybe you liked the explicitness?
Avatar
oh i forgot about it
09:23
xD
09:23
well being explicit is not bad i guess
Avatar
chillerdragon BOT 2021-12-02 09:25:03Z
omg wrong answer
09:25
i hate aoc
Avatar
u are faster with a program im sure
Avatar
chillerdragon BOT 2021-12-02 09:25:43Z
wats the catch on day2?
09:25
aint i summing all up and then calc x * y?
09:26
ah nvm
09:26
depth is not negative :D
09:26
ok no way i would have been that fast in a proper written program
09:27
image.png
Avatar
that's a program 😉
Avatar
you have to calculate the times it goes up
09:27
and ye thats a program
Avatar
chillerdragon BOT 2021-12-02 09:27:46Z
it cant be run again tho
Avatar
I can run it on my input, too
Avatar
chillerdragon BOT 2021-12-02 09:28:09Z
yea i guess
09:28
ok thats weird
Avatar
In imperative programming, a computer program is a sequence of instructions in a programming language that a computer can execute or interpret. In declarative programming, a computer program is a set of instructions. A computer program in its human-readable form is called source code. Source code needs another computer program to execute because...
Avatar
chillerdragon BOT 2021-12-02 09:28:44Z
omg part two? -.-
09:28
tl;dr
09:29
i rq
10:01
ez sort
Avatar
linear time sort even
11:00
under the assumption that setTimeout takes constant time
11:00
and you have to scale it by the largest element so you don't wait too long, but can also find that in linear time
11:01
(but there are better linear time sorting algorithms for ints)
Avatar
Now I wanna know
Avatar
In computer science, radix sort is a non-comparative sorting algorithm. It avoids comparison by creating and distributing elements into buckets according to their radix. For elements with more than one significant digit, this bucketing process is repeated for each digit, while preserving the ordering of the prior step, until all digits have been...
Avatar
yeah that's quite fast. Tradeoff seems to be more memory allocations
Avatar
Are you going to fix $total_time? It has been broken for around 2 months now (edited)
Avatar
chillerdragon BOT 2021-12-02 12:42:28Z
its a feature
Avatar
You are right, nevermind
Avatar
chillerdragon BOT 2021-12-02 12:53:23Z
?xd
12:53
what are you even talking about?
Avatar
Broken?
13:40
@Learath2 it doesn't update
Avatar
total time of what is this
Avatar
Well it's supposed to be the total finish times, so if you didnt finish any maps it wont change
Avatar
I have finished a lot of maps
Avatar
That's funny, I just added DDNet here: https://en.wikipedia.org/wiki/List_of_open-source_video_games And then clicked on Talk and saw that someone requested it 3 days ago 😄 https://en.wikipedia.org/wiki/Talk:List_of_open-source_video_games#DDraceNetwork%2C_an_actively_developed_fork%2Fmod_of_Teeworlds Anyone want to attempt to submit a wiki article for it? I'm honestly not sure how strict it is at the moment in Wikipedia, and it's usually bad style to write an article about your own project, not objective
This is a list of notable open-source video games. Open-source video games are assembled from and are themselves open-source software, including public domain games with public domain source code. This list also includes games in which the engine is open-source but other data (such as art and music) is under a more restrictive license.
Avatar
DDraceNetwork is an actively developed fork/mod of Teeworlds, and it isn't mentioned in Wikipedia at all (searching yields nothing).
14:18
its mentioned in wikidata
14:18
i edited it a bit somewhen
Avatar
chillerdragon BOT 2021-12-02 14:18:32Z
lmao minecraft is listed there?
Avatar
wikidata is part of wikimedia, but not wikipedia
14:19
true
Avatar
Yesterday I added the new versions on wikidata
Avatar
we dont have a wikipedia article sadly
14:19
i wonder if creating it ourselves is against the rules
14:19
probs
14:19
i dont know much
Avatar
chillerdragon BOT 2021-12-02 14:19:46Z
wow that list is very short sad noises
Avatar
Someone could try writing one, just check previously what the criteria of notoriety are
14:20
On Wikipedia, notability is a test used by editors to decide whether a given topic warrants its own article. Information on Wikipedia must be verifiable; if no reliable, independent sources can be found on a topic, then it should not have a separate article. Wikipedia's concept of notability applies this basic standard to avoid indiscriminate in...
14:20
I see lots of unpopular open source games have articles, so should be possible
Avatar
it doesnt need to be english
14:28
but ye
14:29
i found this fishy thing
14:29
lmao
Avatar
Don't link to some automated pages 😄
14:31
is this known?
14:31
xd
14:32
someone plays league with this name
14:32
ok i stop
14:32
to much google
Avatar
that big install button comes with a bunch of malware and adware 😄
Avatar
meh, im wasting sooo much time .__. #!/bin/bash # Advent of Code 02 shopt -s lastpipe p1f=$(grep forward "$1" | cut -d' ' -f2 | tr '\n' '+ ' | rev | cut -c2- | rev | bc) p1d=$(grep down "$1" | cut -d' ' -f2 | tr '\n' '+ ' | rev | cut -c2- | rev | bc) p1u=$(grep up "$1" | cut -d' ' -f2 | tr '\n' '+ ' | rev | cut -c2- | rev | bc) while read -r l; do ln=$(echo "$l" | cut -d' ' -f2) lt=$(echo "$l" | cut -d' ' -f1) if [ "$lt" == "forward" ]; then p2f="$(( p2f + ln ))" p2dp="$(( p2dp + (ln * p2a) ))" elif [ "$lt" == "up" ]; then p2a="$(( p2a - ln ))" elif [ "$lt" == "down" ]; then p2a="$(( p2a + ln ))" fi done < "$1" echo "Part 1:"; echo "$p1f * ($p1d - $p1u)" | bc echo "Part 2:"; echo "$p2f * $p2dp" | bc
Avatar
chillerdragon BOT 2021-12-02 16:00:03Z
bash poggers
16:00
lol nice you took basically the same approach like i did. I approve c:
Avatar
only R and bash for me, im not a coder :<
Avatar
chillerdragon BOT 2021-12-02 16:00:51Z
what makes you think that
16:00
real coders use bash
Avatar
real linux hacker bois )))
Avatar
chillerdragon BOT 2021-12-02 16:01:28Z
yas
16:02
what do you use bc for?
16:02
i was told to stay away from bc
Avatar
im sry to say but R looks rly ugly to me xd
16:15
from the other day
16:15
i guess Rscript is R right?
16:15
xd
Avatar
Avatar
Index
meh, im wasting sooo much time .__. #!/bin/bash # Advent of Code 02 shopt -s lastpipe p1f=$(grep forward "$1" | cut -d' ' -f2 | tr '\n' '+ ' | rev | cut -c2- | rev | bc) p1d=$(grep down "$1" | cut -d' ' -f2 | tr '\n' '+ ' | rev | cut -c2- | rev | bc) p1u=$(grep up "$1" | cut -d' ' -f2 | tr '\n' '+ ' | rev | cut -c2- | rev | bc) while read -r l; do ln=$(echo "$l" | cut -d' ' -f2) lt=$(echo "$l" | cut -d' ' -f1) if [ "$lt" == "forward" ]; then p2f="$(( p2f + ln ))" p2dp="$(( p2dp + (ln * p2a) ))" elif [ "$lt" == "up" ]; then p2a="$(( p2a - ln ))" elif [ "$lt" == "down" ]; then p2a="$(( p2a + ln ))" fi done < "$1" echo "Part 1:"; echo "$p1f * ($p1d - $p1u)" | bc echo "Part 2:"; echo "$p2f * $p2dp" | bc
You can probably pass some code reviews as a software developer with those answers 😄
16:20
I had interviews where this kind of task was the only coding part of the interview, rest was small talk
Avatar
@Index new maps when
16:29
ur barely around :(
Avatar
oohh bc is a calculator
16:33
i always opened python to calculate stuff
16:34
sqrt(2) 1
Avatar
chillerdragon BOT 2021-12-02 16:34:19Z
ye bc is for maffs and shit
Avatar
chillerdragon BOT 2021-12-02 16:34:25Z
bash for example cant do floating point
Avatar
ah you need bc -l for it to work good
Avatar
chillerdragon BOT 2021-12-02 16:34:45Z
i use ruby for maffs c: less typing than python :p
Avatar
sqrt(2) 1.41421356237309504880
16:35
idk ruby
Avatar
chillerdragon BOT 2021-12-02 16:35:04Z
just use awk
16:35
ruby is literally python
16:35
without the tab annoyances :D
16:38
thats cool
16:38
(a is the arctangent)
Avatar
chillerdragon BOT 2021-12-02 16:47:58Z
@Ryozuki: there is weather and BTC price missing in your shell prompt
16:50
Empowering everyone to build reliable and efficient software.
16:50
poggers
16:50
fallible allocation
16:50
now linux can proceed
16:51
Add armv6k-nintendo-3ds at Tier 3*.
16:51
xd
16:51
nintendo?
Avatar
chillerdragon BOT 2021-12-02 16:52:13Z
yes best hardware producer
16:52
my gpu is from nintendo
16:52
thanks to llvm 13 more targets are supported
Avatar
chillerdragon BOT 2021-12-02 16:57:07Z
image.png
Avatar
cen sorship
Avatar
chillerdragon BOT 2021-12-02 16:57:14Z
i use arch btw
troll 2
troll 2
troll 2
troll 2
yes 1
16:57
image.png
16:57
here u go leak
Avatar
xd sure chillerbot.png is lyfe
Avatar
chillerdragon BOT 2021-12-02 17:06:30Z
:ban:
Avatar
Avatar
Ryozuki
im sry to say but R looks rly ugly to me xd
Guess R is not really used for "standard" coding tasks, its more suited for statistical analyses, graphs etc. :p also im using it in a quite limited way, so it definitely is ugly here xdd
Avatar
Avatar
deen
You can probably pass some code reviews as a software developer with those answers 😄
Glad to know, that there are options for a 180 degree profession change :> I'll definitely fail the smalltalk then .__.
Avatar
chillerdragon BOT 2021-12-02 17:47:42Z
whats ur profession?
Avatar
Avatar
fokkonaut
@Index new maps when
coffee 3 scheduled for 2084 :o but guess we'll both stay with that game forever, so just keep waiting))
Avatar
Avatar
chillerdragon
whats ur profession?
obv not programming :>
Avatar
chillerdragon BOT 2021-12-02 17:49:55Z
spill it
f4 1
Avatar
can someone clarify sometihng to me in java
20:49
or is this text chat only for teeworlds development
Avatar
Feel free to ask, but noone can be sure that someone will answer youmonkalaugh
Avatar
while (cargoManifestOnYearResultSet.next()) {
20:57
next is a boolean method
20:57
when i run something like this
20:57
does the method iteslf run
20:58
it has to run the method to get the return value (type boolean) to check
Avatar
that's what i thought, thanks
20:58
have you ever used jdbc
Avatar
ever yes, but I can't answer any questions better than google probably
Avatar
it's a simple question that i cannot find
20:59
like whne i execute a query, it returns a result set
20:59
my cursor is on the first row of that result set
20:59
the first row is the labels or already data?
Avatar
initially the cursor is before the first row of data
21:01
you could probably just write a small program to check
21:02
I'm not sure if you can get the column labels when the cursor is before the first row. It probably just throws an exceptions
Avatar
oh, it is before? i didn't know that
21:02
but the first row, is it labels or data?
Avatar
it's before the first row of data first
21:03
so you can do a loop while(result.next()) I guess
Avatar
yes, but what i asked is
21:03
is the first row
21:03
just labels
21:03
or data already?
Avatar
it should be data
21:04
but you could also check to make sure
Avatar
thanks!
21:04
ye, i'll try to check
21:04
jsut wanted to know beforehand tho
Exported 219 message(s)