#dev-general
1 messages ยท Page 366 of 1
wait is that not a thing in kotlin?
kekw
only java?
divide by float then change to int
use templates
"tHaT lAnGuaGe iS a MiNeFiElD"
lmao
that statement is also a minefield
since you can overload operators, + is less priority as concatenation than adding ints I presume?
jesus
ur mom is a minefield
I do not understand why that mess is required
I'll take that as a complement
lol
it is possible to write shitty code in any language ๐ฅฐ
i struggled to read this :/
bm join
whoops
Sure
ready for the hundredth fastest in a row?
@cinder flare the last 2 tests had decimals and when u divide int by int u lose the accuracy
I had 0% for the last two though
LMAO
like wtf
oh
ye
shortest isn't even an option
yes!
because u lost the accuracy from int division
Oh god
take that, metrics
don't you guys love that they give you the exact thing you have to do in the example?
why in the fuck can't I pow in kotlin grrr
yes
kk
oh
says at the top
much round many wow
I must say I do feel the very same
imagine rounding a number to the first decimal place by doing this
if (bmi.toString().length < 3) {
console.log(bmi + ".0");
} else {
console.log(bmi);
}
yeah I usually hardcode it so just add every possibility and then map it
ah string.format was a good idea
wait I'm confused. how is 25.0 rounded to the nearest tenth? isn't it suppose to be 30?
or nearest tenth means if its 25.1 it will be 25.0
or if its 25.6 it will be 26 ?
rounded to the nearest tenth means one decimal place yea
COME ON haskell
oh I see
so like 25.67 is 25.7
i cant believe idk how to fucking round
it keeps printing as an int
this is so cringe
these aren't sig figs lmao
english ... xD
Star and sensei, share code
val number:Double = 0.0449999
val number3digits:Double = String.format("%.3f", number).toDouble()
val number2digits:Double = String.format("%.2f", number3digits).toDouble()
val solution:Double = String.format("%.1f", number2digits).toDouble()```
stackoverflow saves the day
couldnt agree more
i would have been done 6 mins ago
๐ฆ
fucking rounding
who even rounds numbers
bro
just lose more accuracy
xd
you can see it on the page if you click view code
For me what took the longest was reading that giant text
i skimmed that shit
only if you click on "share code"
xd
val bmi3 = String.format("%.3f", bmi).toDouble()
val bmi2 = String.format("%.2f", bmi3).toDouble()
val bmi1 = String.format("%.1f", bmi2).toDouble()
also
thats not needed
see im just a fucking dumbass and had to learn how to use When on the fly
u can just use the last one
i did and it didn't work
stack overflow told me to do it so I did it
ยฏ_(ใ)_/ยฏ

I got like 15 digits of number and I was like... oh
meaning of life
lol
Conclure u got a pupper now or just found a cute pic?
||
public static float calculateBMI(int weight, int feet, int inches) {
int height = feet * 12 + inches;
return Math.round(703 * ((float)(weight) / (height * height)) * 10.0) / 10.0f;
} ||
always had one
got, I had unfortunately he grew up
oh those are multiplying pulse
i thought you were casting to float lmao
wait you were?
im so confused
ye
Should have used an Everstone
ah I see I didn't know why you put weight in parens
damn forgot those exist
welp I did it... xD
also I chose (My last play). doesn't that mean I should get 15 more seconds?
Aight my last one
same
same
cap?
what cap?
I wanted shortest but Yugi removes them ๐ข
thats what they all say but I bet you will just play "yet another one" 
I have no idea what this is
you get strings like this one @-|20||10|-@
you need to get the amount of numbers
that ar between | |
regex pog?
yeah regex would probably help a lot
omg
i made it big brain
lol
i made a big brain solution
||
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
if (in.hasNextLine()) {
in.nextLine();
}
int count = 0;
for (int i = 0; i < n; i++) {
String test = in.nextLine();
count += test.chars().filter(ch -> ch == '|').count();
}
System.out.println(count/2);
}
||
(code is above, don't look obv)
no regex needed xD
my solution is more resilient
easier to change if the pattern changes lol
didn't you know kotlin already..?
i mean, like a little bit
fefo do u know any kotlin?
I spent like 6 minutes on the last one learning how to use the when statement correctly
what the hell is the method to get the size of a Sequence? Or is there no method for that
sequence#count()
oh count
I used it in mine lol
awww
Some, yes
I would say even more than dkim lol
lol
Well I think this is all for me for today
lmao
damn Matt's regex is kinda thicc and extra lol
he is regex pro
"\\|(?<number>\\d+)\\|" vs "(\\|[0-9]{1,}\\|)"
though i guess number is probably easier to read haha
I think they do the same thing
count is so pog
Also I like how after the time pressure if gone you can find super simple solutions
val pattern = "\\|(?<number>\\d+)\\|".toRegex()
println((0 until n).map { pattern.findAll(input.nextLine()).count() }.count())
Why did it not add spoiler
its borkne
cause it has code
my brain is not large enough to understand #map lmao
That's dumb
It's spoilered for me but I'm on mobile
๐ฅฒ
Is there a code golf mode
L
F
ragequit
im confused
val new = listOf(...).map { it + 1 }
val new = mutableListOf<Blah>()
listOf(...).forEach {
new.add(it + 1)
}```
are there multiple |x| stuff?
they arent encased i dont think so?
not sure
i dont think they are encased tho
just |x| multiple times per line
yes, multiple |num|'s per line
rip
F
33% oof
why the hell
a few only had one per line
lol
wat
:c
wait bm you did it in haskell?
dude i spent about 10 minutes debugging that and i forgot that | was a special character in regex
tried to ๐ฅฒ
bm
smart gang
and then you had to escape the \ in the string too
how come
you could just count the number of pipes
๐ฆ
class Solution {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
if (in.hasNextLine()) {
in.nextLine();
}
int count = 0;
for (int i = 0; i < n; i++) {
String test = in.nextLine();
count += test.chars().filter(ch -> ch == '|').count();
}
System.out.println(count/2);
}
}
java kinda ugly
weird
pulse learn python ๐คก
i wanted to try ruby a few times haha
no fu
i don't know enough gimmicks yet though
another one?
nah im beat
uh sure
im gonna go learn what map can do
map is pog
and try to force my brain to comprehend it
isnt like similar to Stream#map
well yeah
/s

yeah basically but kotlin doesnt enforce you to stream in order to map
so sadly java bad
regrettable
problem being I don't understand Stream#map either lmao
You map each value to another value using a function
Idk for instance
Stream.of("string","mama")
.map(str -> str.hashCode())
.forEach(System.out::println)
this would print the hashcode of string and mama
apply a function to every value in the list, make a new list of those new values
for example if you had a class User and each user had a UUID and you wanted all the UUIDs given a Collection of User, you could use Stream#map to map a value from the User class to an actual stream
then collect it using Stream#collect
Function<K,V> is like a consumer but it returns a value
so map is basically
List<V> v_list
for(K : List<K>)
v_list.insert(function(K))
I think I just need to see the possibilities of what all you can do
how to make a non-secondary constructor?
f# syntax
use jpa compiler plugin to fix that error
compiler hacks?
kotlin compiler actually supports stuff like this so it's not a hack ๐
link me
make sure to shade lombok with kotlin too
to the right plugin
i already do throw shade at lombok, like every day
id "org.jetbrains.kotlin.plugin.spring" version "1.4.31"
Would be nice if RECORD class suppiort
someone add lombok to terrible-plugin
i dont think we've covered that yet
lol
yea
wait
you need to shade the tunity jars
and paper jars
and everything inside too
why
tuinity adds api features?
Yes
nice
i thought we were still in matrix
abstract class Command(jda: JDA) : CommandHandler(jda) {
abstract val command: String
abstract val name: String
abstract val aliases: Set<String>
abstract val description: String
abstract val arguments: Set<CommandArg>
abstract val type: CommandType
abstract val minArgs: Int
```any opinions?
also i already applied this to all my cmds so unless theres something
a) horrible
b) small and easy to fix/change
I won't change it :p
also i should probably make those variables not abstract
and just put in constructor
lol
yeah looks fine
thats hideous change everything about it now thanks please and thanks of course
thats hideous change everything about it now thanks please and thanks of course
abstract or constructor? (arguments still has to be abstract though)
what about sub commands tho?
i always do abstract for that stuff dkim
those go in arguments @static zealot
abstract probably better
but wouldn't constructor be better?
just edit the message to ping me
oh
not that there's a huge difference
wdym
@half harness please do share the code with me after. I was to lazy to make my own lmao
[Watchdog (I'm watching you)] lol
use slashcommands feature branch
and just did it with the message listening
kotlin?
yeah I did it in kotlin
and using.. my.. code..? ๐
if it works it works lmao
I'm finally becoming a decent dev ๐ฅณ
it doesnt work 
oop
:))
but after i finish changing all my commands to use this, and if you haven't found the thing on github (bc i doubt mine is better lol), ill prob send to you
lmao
this is so hot
dkim its not that I don't trust your code but this one is already made and if I start changing it now I won't want to change it again
idc if u dont use my code, mine probably sucks anyways :))
just something i slapped together today
it just wraps the feature branch for it
jda
i love it
it's just that jda utilities doesn't have everything i want
such as changeable prefixes
u have to pick one when building jda instance
wait is that the new thing where discord allows use of the / command for bots?
iirc
oh also, Krypton also has watchdog
and you can't change
pr or shut up?
indeed
or have different ones for each server
what library did you use to make the bot?
jda
oh hmm
Krypton has a thread that will stop the server if the tick time gets over a certain threshold
they have a slash commands feature branch thats pretty good
JDA
y u go hmm then
someone recommended ktor or whatever it was

called
slash commands good, but the API for them is terrible
oh
he was just asking cause the slash commands im pretty sure
yeah I didn't know slash was in jda as well
Ktor? Discord bot?
Ktor is a web library
i dont think its on main/master
I like slash commands api lol
maybe on the utilities ?
I said I don't remebmer the name lmao
or like the web thingy is nicoe
man, Krypton actually has ticking now
I knew ktor is a thing. didn't know if its the bot api or whatever it is
this is amazing
ktor is just a web library
so you can use it for slash commands cause thats json based if you dont have a lib for it
a very idiomatic web library (@prisma wave)
whats the difference between implementation and compileOnly again? I think its compileOnly doesnt compile the dependency to final jar
also OVH finally restored my VPS so now my bot is online non stop
ah ok
its provided at runtime, for example paper api or something
CommandClientBuilder builder = new CommandClientBuilder();
// Set your bot's prefix
builder.setPrefix("!");
builder.setAlternatePrefix("+");
// Add commands
builder.addCommand(new CoolCommand());
// Customize per-guild unique settings
builder.setGuildSettingsManager(new MyBotsGuildSettingsManager());
CommandClient client = builder.build();
new JDABuilder(AccountType.BOT)
// ...
.addEventListener(client) // Add the new CommandClient as a listener
// ...
.buildAsync();
```jda utilities has fixed prefix ๐ข
so things like kotlinx coroutines should be implementation and paper-api is compileOnly?
jda is big dodo when u can use discord4j
yes sensei
Kool
sensei if a dependency should be in ur jar when outing (shaded), then implementation
if you just rely on it and some other plugin provides the class (or the server) then compileOnly
yo olivo
hello sir
welcome to the cool kids
or
whatever you consider yourself
lmao
cool kids club
ckc
hmm that sounds bad
yeah its da crib tho
the coc club is better
damn we were like 10 playing coc today
I just realised
took me an hour
lmao
hmm.. seems good...
except that the cpu is 11 years old and is worse than a 2.50ghz cpu
(note that this is my pc, my laptop has 1ghz cpu lol)
my pc has intel i5
what gen
idk
i5 is not really that important lmao
intel i5 3450
hey I found this 
old desktop core iXs are decent, even 3rd gen
i have i7
someone give me the & symbol
if you count 20 fps in hypixel lobby
but my pc is still dodo
not this one
๐คข
well your 20 FPS is not because of your cpu
it really depends on what u do with it
ty ty
it's because of your poopy integrated gpu
dkim are you using integrated graphics
i know someone that has worse igpu than me but better cpu and gets like 150 fps
yes
i am
it's your gpu
the cpu is fine but the gpu on it is... not so fine
also how does someone have a better cpu than you but a worse igpu
that doesn't add up
honest question who started convincing everyone to use kotlin?
what was his gpu
bm
and someone else
sx ๐
well either way you realize integrated gpus are literally inside the cpu right
although he hates kotlin now
Sxtanna
๐
yes
brister hates kotlin?
so it's not possible to get a worse igpu inside a newer cpu
yes
no
why did Sxtanna leave again?
wtf
well he didn't
i wasnt there
could someone describe what happened
he changed his ways
he's the one who forced me to learn it before java Untouched
but he moved on
that's why I don't trust him anymore
so brister convinced everyone to learn Kotlin now hes onto a new language?
just put in discord search feature from: Brister Mitten kotlin
i wasnt here when he was here, what happened?
how to add cooldown in deluxe menu gui ?
even when he'll finally launch the yt tutorials I won't watch them
and you'll see how he changed
yepp
FP
sorry
i dont think he hates kotlin because java and kotlin are still his main languages for his projects afaik, but he prefers more functional stuff now
could someone explain what happened with Sxtanna tho?
cause i wasnt there
dw pulse ๐ฅฒ
when he left
Sxtanna was somewhat toxic
lets not go there
ended up dooding him
were you there when it happened
don't work
lol
Hi Pulse
Hi
it's just a joke for people who ask in the wrong channel
lol
ask in #general-plugins or #general-plugins-2 instead
I love how I've already helped him in there by the time you told him to move
@prisma wave lets clarify this
do u HATE kotlin?
lol
LOL
omg
lmaooo
fucking
whywhwyhy
might wanna add <> to it ๐ฅฒ
jesus discord sucks
people change
๐ฅฒ
So I've been learning React for about a week now. It's quite neat ngl
lol
lmaooo
lol
blitz what did u send
oh boy that's a lot of links
lol
intriguing
ikr
that was a genuine question, i hope it was a genuine answer
ok but why has nobody mentioned wiki.brister mitten yet
wait that's a Paper emoji??
oh in that case no
yep
๐
so is this correct then?
no paper fucks you then
that is correct yes
kotlin bad
kotlin is nice
pog
but kinda lacking
o:html
you just wasted 10 seconds by reading this entire message thats actually not useful for anything but wasting your time which is where this message has been made for and apparently my message worked and wasted another 10 seconds of your life because you continued reading the message which means ive got your interest but believe me there isnt anything in this message or is there maybe there is and you just read competely over it and maybe not and you just spend another 20 seconds searching for it but there isnt anything special so ive jebaited you now you have to live with the fact that ive wasted another 10 seconds of your life and the fact that ive jebaited you ๐
the best language is ELARA!!!!
it is
all markup languages are declarative
they describe something, rather than doing something
i saw that
ok
lol
yess
they mark stuff up
and like mutate variables, isnt that a thing
i dont think anything is mutable
even something like SCSS would still be declarative
it started with you just wasted and I checked the end directly to see the jebait. I've been on reddit a few times lmao
reddit?
lol true
idk but dkim is objectively a simp
agree
Simps for his 3 only braincells
explain
๐ฅฒ
._.
Everyone is a simp
oop
no
Who do you simp for Matt
pulse cannot be a simp
My fiance
Dkim simps for 1.8
if pulse would have been simping rn then he would jerk off to that lol character or smtng tbr
Ahri is a hottie though
what is a name thats common in arrays, sets, and lists?
lol
data structure
collection
๐
disctionary map ๐
:]
whats a good name for a kt file with extension functions for arrays, sets, and lists?
CollectionFunctions? ๐ค
Collections
ok
Only league players would understand
DkimsProExtensionFunctionsProviderOfArraysSetsListsAbstractImplFinal
lmfao
Try hearing Vayne's russian death sounds instead
Hm let me give that a try
OH SHIT LMAO
the first second i heard it i was like
Turn down the Volume for this one
My Nightcore channel.
https://www.youtube.com/channel/UCWnLtlJM67X79upj7HTMjUA
My gaming channel https://www.youtube.com/channel/UC6Spd7b1gx_TXmsV-SqA_DQ/featured?view_as=subscriber
Art League of Legends
i'm glad im not living in russia
๐
xd
lmao
hmm what type of things?
things that cost $5
So you'll pay me $5?
sure if you do something for me
I'll give you $5?
fair enough
Thread().run {
val scanner = Scanner(System.`in`)
while (scanner.hasNext()) {
if (scanner.nextLine().equals("stop", ignoreCase = true)) {
println("Stopped")
exitProcess(0)
}
}
}
```better way to do this?
lmao
you hate yourself rly
mhm
wdym
well its not thread safe
i think he means don't share the scanner over threads
but im not sure
i think he means don't share the scanner over threads
i think he means that too
how predictable someone figured
It wasn't clear enough
A
Scanneris not safe for multithreaded use without external synchronization.
sooo how do i fix this?
you dont need it to be
External synchronization
assume the scanner usage is internal to one thread
plz just spoonfeed me
I dont have a spoon 2day
i hav fork
There is probably lots of google answers
^
when u successfully grow your brain to 5head level so that u can answer dkims questions
Using Scanner in a Thread? or something.
A google bot would be pretty cool like dkim suggested lol
No more leaving discord
But you've spent so much time looking!
wouldn't it not matter
since im making the scanner in the same thread
that im using it in
fix what
there's nothing to fix
so its not async
yes it is
how
how isn't it?
Consumer<String> consoleHandler = str -> {
};
Thread t = new Thread(() -> {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
String line = scanner.nextLine();
consoleHandler.accept(line);
}
});
t.setDaemon(true);
t.setPriority(Thread.MIN_PRIORITY);
t.start()
pretty sure its similar to this in java
or smtng
but anyways
ur making the scanner in the thread
thread safety doesnt matter if youre only accessing it from 1 thread...
this is my code
im not using it in another thread
just that one thread
it works fine my statement was purely a warning tbf
then it's perfectly fine
iuahsiudhisauhdiaushdikjwashdiuashdiuasdiuajkdp9oiqawjuihdjsad
u guys confused me so much that i naturally opened up mc
actually
hey its open
oop
yeah better start it instead
you want thread {}
its been working tho
uh
C o r o u t i n e s
h o w d o i u s e i t
G o o g l e
B I G B R A I N
Why did you want 65?
no ๐คฆ
69
Oh I see you have to account for rounding, 66?
correct
Thread {
val scanner = Scanner(System.`in`)
while (scanner.hasNext()) {
if (scanner.nextLine().equals("stop", ignoreCase = true)) {
println("Stopped")
exitProcess(0)
}
}
}.start()
```so this?
dkim
Thread t = new Thread(() -> {});
t.run();
is like
Runnable r = () -> {};
r.runt()
so yeah
start
runt
then you dont need to .start()
oh kotlin infers it lol
no, it's just a helper function
Thread is so ugly
bm come back to kotlin ๐ญ
hm
helper function?
error
import?
fixed
smh
utility function
๐ค
dkim u play the pit?
lol noob
ok ill be afk for like 5 mins while i play a round of bridge
why would we know that
The best way to find out is to try
ok i won
utility function
Sir, this is #dev-general
HMM kotlin and all these features
ik
why is it overwhelming
Who cares about Hypixel
no one
1.8 hater likes hypixel?
I have no contradictions against no cooldown pvp
challenge me my guy
yes or no
I dislike that people use 1.8
you see its a fkn old version
but 1.8 pvp (no cooldown pvp) is something I have an interest in
1.16 pvp takes years though, and I don't have time for that
decades*
you can recreate no cooldown pvp in 1.16
blitz with no squidward pfp is a trippy feeling
You normally say dumb things but this is pretty fucking dumb lol
I like 1.16, just not pvp
Although I really think minecraft should add dinosaurs
I agree
minecraft already has dinosaurs
something everyone can get behind
Dead ones
Forgot about that lol
ofc lol
But why would you choose that as the picture
bro isn't that your pfp lmao
I mean like actual dinos lol
@sweet cipher do u pvp
i have never used that as my pfp
I play hypixel sometimes when I have time
though it's not out of the question
i know it was a hot meme cause your pfp is a duck
we should 1v1
dkim I take u easy in 1v1 ๐
lol
we should 1v1
ill probably lose
but
it'll be fun
let me toggle ghost client ๐
๐
plz lets 1v1
Let me just set up a server real quick and you can 1v1 me on there
if I win you get to add me as friend on hypixel else I get to add you, deal?
errr deal
ooh tough conditions
What about a tie?
i already have one ๐
then we rematch
Same but its dead lol
I just run one on my computer whenever I need to test things
aaaaaaaaaaaaaaaaaa