#dev-general

1 messages ยท Page 423 of 1

static zealot
#

ah alright

distant sun
#

So I have these

    RED((color -> Integer.toString(color.getRed()))),
    GREEN((color -> Integer.toString(color.getGreen()))),
    BLUE((color -> Integer.toString(color.getBlue()))),
    HEX((color -> String.format("%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue()))),

    UNKNOWN((color -> ""));

    private final Function<Color, String> function;```
Is possible to have a `Function<Color, Integer>` for the first 3 and somehow call `Integer#toString` with the result of `function#apply()`?
obtuse gale
#

what

ocean quartz
#

This is cool Kotlin, but it's kinda ugly lol

old wyvern
#

cursed

tranquil crane
#

what the

ocean quartz
#

Ikr

prisma wave
#

why

ocean quartz
#

Someone in the comments said this path { "Dir" / "SubDir" / "file.txt" } which is slightly better, but who thought that was a good idea lol

old wyvern
#

clash?

tranquil crane
#

sure

ocean quartz
#

also apologies Gaby i took attention away from your question

onyx loom
#

oh yeah they just added that right matt?

prisma wave
#

and Function#andThen iirc

#

d;methods Function

ruby craterBOT
#
Methods:
java.util.function.Function#identity
java.util.function.Function#andThen
java.util.function.Function#compose
java.util.function.Function#apply```
prisma wave
#

nvm it's compose

#

good

old wyvern
distant sun
#
    ColorType(Function<Color, Integer> function) {
        this.function = (color) -> Integer.toString(function.apply(color));
    }```
This works but it says that both functions have the same erasure
old wyvern
#

d; Functions#compose

ruby craterBOT
#
default <V> Function<V,โ€‹R> compose(Functionย before)
throws NullPointerException```
Description:

Returns a composed function that first applies the before function to its input, and then applies this function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.

Returns:

a composed function that first applies the before function and then applies this function

Throws:

NullPointerException - if before is null

Parameters:

before - the function to apply before this function is applied

distant sun
#
    RED((color -> Integer.toString(color.getRed()))),
    GREEN((color -> Integer.toString(color.getGreen()))),
    BLUE((color -> Integer.toString(color.getBlue()))),
    HEX((color -> String.format("%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue()))),

    UNKNOWN((color -> ""));

    private final Function<Color, String> function;

    ColorType(Function<Color, String> function) {
        this.function = function;
    }

    ColorType(Function<Color, Integer> function) {
        this.function = (color) -> Integer.toString(function.apply(color));
    }```
Was trying to replace the first three with `Color::getX`
tranquil crane
#

;(

old wyvern
#

welp

half harness
#

?

#

oh u started

tranquil crane
#

the heck is this

half harness
#

oh

#

i get it

prisma wave
#

Stupid java

distant sun
#

F

obtuse gale
#

@distant sun

    ColorType(final Function<Color, String> function) {
      this.function = function;
    }

    ColorType(final ToIntFunction<Color> function) {
      this.function = color -> String.valueOf(function.applyAsInt(color));
    }
prisma wave
#

Ridiculous

obtuse gale
#

too bad primitive-specific functional interfaces don't have andThen/compose :(

prisma wave
#

this.function = function.andThen(String::valueOf) ๐Ÿ™‚

obtuse gale
#

non

prisma wave
#

ah

#

wank

obtuse gale
#

yeah I did think of that lol

prisma wave
#

who designed this shit and genuinely thought it was good

obtuse gale
#

lmfao

old wyvern
#

Gosling

prisma wave
#

I hate him

tranquil crane
#

I don't like Haskell at all, especially after reading that

prisma wave
#

wot

#

that's java

tranquil crane
#

referencing that

prisma wave
#

oh right

old wyvern
#

lol

prisma wave
#

can you send it here

old wyvern
#

Dont think you should reference your opinion on code from clash

prisma wave
#

Mobile bad

old wyvern
#
import System.IO
import Control.Monad
import Data.List
main :: IO ()
main = do
    hSetBuffering stdout NoBuffering -- DO NOT REMOVE
    
    -- Auto-generated code below aims at helping you parse
    -- the standard input according to the problem statement.
    
    input_line <- getLine
    let l = read input_line :: Int
    input_line <- getLine
    let m = read input_line :: Int
    input_line <- getLine
    let n = read input_line :: Int
    
    
    putStrLn $ intercalate " " $ map show $ solna (l - m) m n
    putStrLn $ intercalate " " $ map show $ solnb (l * m) m n
    return ()

solna :: Int -> Int -> Int -> [Int]
solna n d i
        | i <= 0 = []
        | otherwise = (n + d) : solna (n + d) d (i - 1)

solnb :: Int -> Int -> Int -> [Int]
solnb n d i
        | i <= 0 = []
        | otherwise = (n `div` d) : solnb (n `div` d) d (i - 1)
tranquil crane
#

oh I'm not judging your code I'm judging the entire language

prisma wave
#

๐Ÿคค

old wyvern
#

Finding a fast solution is ussually not the cleanest possible

prisma wave
#

that is not what I would call "clean Haskell code" lol

old wyvern
#

mhm

tranquil crane
#

yeah fair enough

old wyvern
#

This just "works"

prisma wave
#

haskell is actually viable in shortest mode

#

Which is cool

old wyvern
#

lol

tranquil crane
#

I sat there for a solid 3 minutes just trying to figure it out before realising

old wyvern
#

lol

#

poor dkim

tranquil crane
#

trying his best

old wyvern
#

The game is over tho

distant sun
#

@obtuse gale that doesn't work

old wyvern
#

not sure why it still shows him as clashing

obtuse gale
#

what about it doesn't work

prisma wave
#

pc hasn't loaded onto the next page yet probably ๐Ÿฅฒ

old wyvern
#

lmao

oblique heath
#

coc??

distant sun
#

works if I remove the Function<> but then it only accept int as result

#

I assume it doesn't know which constructor to call since both have one Color param

obtuse gale
#

weren't you wanting to use Color::getRed etc?

distant sun
#

yea but only for first three if possible

#

HEX uses String#format

obtuse gale
#

that's 3 for ya lol

#

what does it say on building

distant sun
#

I cant build lol

obtuse gale
#

why not

distant sun
#

both constructor ColorType(Function<Color,String>) in ColorType and constructor ColorType(ToIntFunction<Color>) in ColorType match

obtuse gale
#

I'm looking for a compilation error

#

there we go

prisma wave
#

Just do Red(Color::getRed) no?

forest pecan
#

yea use method references

#

lol

prisma wave
#

no ambiguity there

obtuse gale
#

Cast the last two to (Function<Color,String>) idk

old wyvern
#

Wait how do both match

prisma wave
#

Cuz he's doing toString

#

wait

#

wat

old wyvern
#

Isnt that afterwards

old wyvern
distant sun
#

both are basically a lambda with Color, only the result is different

old wyvern
#

Wait

#

ik your issue

#

Neither of your constructors take in a String

#

๐Ÿ˜‚

#

oh wait

#

no

#

im dumb

prisma wave
#

๐Ÿฅฒ

old wyvern
#

ignore that

distant sun
#

I know.

old wyvern
#

xD

prisma wave
#

Sounds like you need haskell

#

Why erase some types when you could erase all types

old wyvern
#

๐Ÿ˜Œ

tranquil crane
#

why have many type when one type do trick

old wyvern
#

dynamic

#

๐Ÿคฎ

tranquil crane
#

ah yes the dynamic type

#

the type where the compiler just blindly trusts that you're doing everything right

old wyvern
#

xD

prisma wave
#

class Any where

how to have "java.lang.Object" in haskell

old wyvern
#

Just use a bro

#

all my homies live in a

#

pattern match every possible fucking type

prisma wave
#

Why use polymorphism when you could write a 10000 line case expression

old wyvern
#

๐Ÿ˜Œ

forest pecan
#

why live when you will die eventually

grizzled moat
#

update the deluxe tags for a rgb support?

old wyvern
forest pecan
#

ig we mine as well just

#

die now

old wyvern
#

Please delete yourself

obtuse gale
forest pecan
tranquil crane
#

I was going to complain about the files but then noticed they too, are all E

old wyvern
#

YOO

#

bm

old wyvern
prisma wave
prisma wave
old wyvern
#

Is it true???!!

prisma wave
#

yes

pale shell
old wyvern
#

Brister Peyton Jones

prisma wave
#

I have been sent to spread the word of haskell

old wyvern
#

Simon Mitten

#

๐Ÿ˜ฎ

prisma wave
#

You have been a brave warrior

old wyvern
#

Thank you sir!!

prisma wave
#

You will go to the ivory tower when you die

#

With the other glorious warriors

old wyvern
#

๐Ÿ˜Œ

pale shell
#

Ivory Tower?

old wyvern
#

YES!

pale shell
#

?

old wyvern
#

An ivory tower is a metaphorical placeโ€”or an atmosphereโ€”where people are happily cut off from the rest of the world in favor of their own pursuits, usually mental and esoteric ones. From the 19th century, it has been used to designate an environment of intellectual pursuit disconnected from the practical concerns of everyday life. Most contemp...

pale shell
#

Oh

#

Weird shut.

#

Shit*

prisma wave
#

it is where haskell users go when they die

#

To theorise about functional CPU architectures in peace

old wyvern
#

๐Ÿ˜Œ

pale shell
#

Java users too.

old wyvern
#

No

prisma wave
#

Away from the imperative prosecution

old wyvern
#

Java users go straight down

prisma wave
old wyvern
#

down to hell

prisma wave
#

Into hell

#

where they belong

pale shell
#

If I carry on doing java I might see vk2gpz then

#

I can't type on mobile

#

These devices are so small.

ocean quartz
#

@old wyvern Did you do any work on the Kotlin DSL stuff?
Imma do a bit of that in a bit if you haven't ;p

pale shell
#

Bm, when you need payment btw

old wyvern
#

Ill pull from upstream and add stuff later on

ocean quartz
#

Sure thing

#

This is the style I decided to go with

pale shell
#

Nice color theme matt

old wyvern
#

I was thinking of a more dsl-ish way

ocean quartz
#

all are optional, but those are specially optional

pale shell
#

Is that kotlin?

ocean quartz
old wyvern
#

ah

ocean quartz
prisma wave
pale shell
#

Now?

#

But we got sold any copies yet ๐Ÿฅบ

half harness
#

uhh i enabled it but it still is disabled
idk why it automatically disabled :c

old wyvern
#
val menu = gui {
   row { item + space(3) + item2 + space(3) + item3 }
   row { item + space(3) + item2 + space(3) + item3 }
}
prisma wave
pale shell
#

So I know in the future?

ocean quartz
prisma wave
#

tomorrow then

ocean quartz
#

I'll let you do that then

#

I'll push what I have so far

old wyvern
#

Alrighty

pale shell
#

I was expecting you to say after each sold copy or something

prisma wave
#

yeah ig

#

whenever is most convenient

oblique heath
#

=clash

#

๐Ÿ˜ฆ

surreal quarry
#

=coc

#

=clashofcode

old wyvern
#

only on den rn

surreal quarry
#

gei

old wyvern
#

cube hasnt added it yet

surreal quarry
#

shame

old wyvern
#

I sent him the api

#

๐Ÿฅฒ

oblique heath
old wyvern
#

start ivan

oblique heath
#

alright

tranquil crane
#

that very much did not turn into an embed

old wyvern
#

role

#

embed is onyl for people with dev role

tranquil crane
#

o

oblique heath
#

this seems really familiar to a previous challenge

#

where you had to tell if a number was perfect or not

ocean quartz
#

Peasants without dev role

onyx loom
#

โ˜น๏ธ

#

please be nice matt

static zealot
#

u guys playing COC without me? ๐Ÿ˜ข

#

I always ping you guys

#

you don't even bother saying my name

ocean quartz
onyx loom
#

๐ŸŒš

obtuse gale
distant sun
#

bruh this shit is broken

#

it expects "Amicable" for all tests

oblique heath
#

yugi it was shortest

old wyvern
#

oh it was shortest

#

lmao

oblique heath
#

xd

old wyvern
#

rip

#

xD

tranquil crane
#

f

distant sun
#

Two numbers are amicable if the sum of divisors of one number are equal to the other number.
Therefore numbers 220 and 284 are amicable numbers

tranquil crane
#

test 4 is not amicable tho

distant sun
#

I KNOW

old wyvern
#
factors :: Integer -> [Integer]
factors n = [i | i <- [1..(n-1)], n `mod` i == 0]

Gotta love haskell

half harness
#

๐Ÿ˜ซ

jovial warren
#
String nextLogEvent;
while ((nextLogEvent = QueueLogAppender.getNextLogEvent("ServerGuiConsole")) != null) {
    print(textArea, scrollPane, nextLogEvent);
}
```anyone know how you're meant to do stuff like this in Kotlin? since Kotlin doesn't allow assignments in conditions since they're not expressions
static zealot
#

wtf is going on with test 4 tho?

distant sun
#

looks like I got 100%

#

so it might be wrong only on the editor

static zealot
#

0?

#

omg I forgot the debug messages

#

by

static zealot
#

you don't know me I don't know you

distant sun
#
import java.util.*

fun main(){
  val i=Scanner(System.`in`);
  print(if (d(i.nextInt()) == d(i.nextInt())) "Amicable" else "Not amicable")
}

fun d(n: Int): Int = (1..n).filter{ n % it == 0 }.sum()```
half harness
old wyvern
#

It shouldnt

distant sun
#

it does

old wyvern
#

weird

#

Isnt kotlin range inclusive?

distant sun
#

no

old wyvern
#

huh

distant sun
#

oh you said inclusive

old wyvern
#

ya

distant sun
#

yes, it is

old wyvern
#

So your d function would include n itself as a factor right?

half harness
#

theres a filter

old wyvern
#

yes

half harness
#

.filter{ n % it == 0 }.sum()

old wyvern
#

n itself always passes the filter dkim

half harness
#

wdym

old wyvern
#

Whats n % n

distant sun
#

๐Ÿคทโ€โ™‚๏ธ

half harness
#

1

old wyvern
#

...

half harness
#

oh

#

lmao

distant sun
#

I know yugi

half harness
#

okay im dumb

distant sun
#

but idm xd

forest pecan
#

1?

#

lol

old wyvern
#

xD

half harness
#

tfydgkjsad

forest pecan
#

lmfao

#

dkim

#

try again

#

what is it

half harness
#

0

forest pecan
#

nope

half harness
#

what

forest pecan
#

0 isnt correct either

half harness
#

its 0

forest pecan
#

lol

half harness
#

what

#

what

tranquil crane
#

look at that pristine quality javascript

forest pecan
#

nope, 0 mod 0

#

is undefined

half harness
oblique heath
#

how do I pass getline into words in one line

half harness
oblique heath
#

using the bind operator

forest pecan
#

dkim you lose more braincells

#

lol

half harness
#

gftuywjhbadskdiuwashdjnsad

old wyvern
#

Might have to add brackets there tbh

oblique heath
#

f

#

i messed my code up at the last second

tranquil crane
#

The test cases on that one ran extremely fast compared to everything else

old wyvern
#

rip

oblique heath
#

also no idea why it's taking so long ๐Ÿ˜ข

oblique heath
forest pecan
#

join coc

#

wtf is this

prisma wave
oblique heath
#

ez peasy

forest pecan
#

i think im stupid cause the solution must be easy

#

lmao

oblique heath
#

it is very easy

#

especially in haskell luckily enough

prisma wave
oblique heath
#

who's esophose

tranquil crane
#

me

oblique heath
#

share code ;o

tranquil crane
#

I'm amazed at how fast you did that

oblique heath
#

this is haskell's zone

#

z o n e

prisma wave
#

what's the question?

#

or what's the answer

oblique heath
#

it's reverse, the inputs are something like

ab12ye -> ba21ey
alabama -> labamaa
tranquil crane
#

flip every other character with each other

prisma wave
#

ah yeah

#

cons operator + pattern matching ๐Ÿคค ๐Ÿคค

tranquil crane
#

can somebody explain to me how Ivan's solution actually works

#

because I can't read haskell to save my life

prisma wave
#

what's the code

static zealot
#
import System.IO
import Control.Monad

main :: IO ()
main = do
    hSetBuffering stdout NoBuffering -- DO NOT REMOVE
    
    -- Auto-generated code below aims at helping you parse
    -- the standard input according to the problem statement.
    
    t <- getLine
    
    -- hPutStrLn stderr "Debug messages..."
    
    -- Write answer to stdout
    putStrLn $ inv $ t
    return ()

inv [] = []
inv (x:[]) = [x]
inv (x:y:xs) = y:x:inv xs```
oblique heath
#

it's a recursive function

prisma wave
#

that is beautiful

oblique heath
#

that takes a list of chars / string as a parameter

tranquil crane
#

It looks really nice but I can't understand a single line of it

oblique heath
#

if the list has more than two characters, it flips the first two and returns a recursive call to the rest of the list

#

otherwise it returns the list

tranquil crane
#

ah

old wyvern
#

oh wait

#

was it just reverse every 2

prisma wave
#

that 2nd pattern is a bit weird, can't you just do (x)?

oblique heath
#

yeah xd

tranquil crane
#

yes lol

gusty fulcrum
#

I gottttttttta question

old wyvern
#

I overcomplicated this

oblique heath
gusty fulcrum
#

whats the best anti-cheat that y'all know of?

old wyvern
#
let grouped = groupBy (\a b -> (isDigit a && isDigit b) || (isUpper a && isUpper b) || (isLower a && isLower b)) t
putStrLn $ intercalate "" $ map reverse grouped
oblique heath
#

what with it being time to complete and all

old wyvern
#

๐Ÿฅฒ

prisma wave
#

yeah idk the answer so

tranquil crane
#

oh no poor yugi

static zealot
#

String#chunked#reverse ftw

oblique heath
#

since it's a list parameter, right?

prisma wave
#

That might match the whole list

#

Not sure

tranquil crane
#

I just learned you can cast a javascript string to an int by just doing ~~value

#

I hate this information

prisma wave
#

yikes

old wyvern
#

putStrLn $ intercalate "" $ map reverse $ splitEvery 2 t

#

There we go

onyx loom
#

:whatthefuck:

tranquil crane
#

that is also real clean

prisma wave
#

man the standard library has a function for everything

old wyvern
#

ikr

onyx loom
#

take that kotlin!

static zealot
#

๐Ÿ˜ข

prisma wave
#

kotlin bad

oblique heath
#

just tried it, (x) doesnt work

#

maybe [x] though

prisma wave
#

ah possibly

#

idk

old wyvern
#

Whats wrong?

oblique heath
#

ah yep [x] did the trick

prisma wave
#

ahh yeah that'll be it

#

super clean

half harness
#

what is hSetBuffering stdout NoBuffering?

prisma wave
#

sets the buffering of stdout to NoBuffering

tranquil crane
#

I imagine it removes buffering from stdout

prisma wave
#

idk what that actually means

tranquil crane
#

probably makes it so it always flushes the contents of stdout immediately

oblique heath
#

yeah

prisma wave
#

Ah yeah probably

oblique heath
#

i imagine it's similar to socket streams needing to be flushed

old wyvern
oblique heath
#

yes

old wyvern
#

Yea [x] is just x : []

#

[a, b, c] is a : b : c : []

oblique heath
#

'h':'e':'l':'l':'o':[]

old wyvern
#

๐Ÿ˜Œ

#

best strings

oblique heath
#

pulse is really taking his time getting a super efficient and awesome and shiny solution

old wyvern
#

or he left

oblique heath
#

how dare he

tranquil crane
#

nah surely we will see the best code in about 35 seconds

old wyvern
#

lol

oblique heath
#

maybe he was also confused by the prompt

tranquil crane
#

what did you think the prompt actually was Yugi?

old wyvern
#

oh btw bm, had windows update today, had a minor heart attack but everything went fine

prisma wave
#

That's good

old wyvern
tranquil crane
#

o

prisma wave
#

Like I said 99 times out of 100 it works perfectly

old wyvern
#

Yea looks good

#

I need to get a recovery drive ready tho

prisma wave
#

probably a good idea

tranquil crane
#

pulse had the best code

prisma wave
#

just in case

old wyvern
#

I have the linux live image

#

Would that be fine?

oblique heath
#

the code was so good the game couldn't register it

old wyvern
#

damn

prisma wave
#

You can do any repairs from the live image

old wyvern
#

Would I lose any files from windows?

static zealot
#

new one?

oblique heath
#

new one

old wyvern
#

like while fixing I mean

prisma wave
old wyvern
#

ah

prisma wave
#

Seems unlikely

oblique heath
#

windows updates don't generally mess with partition tables, right?

#

so it should be fine

#

maybe

old wyvern
#

So is the linux live image better than a windows recovery drive?

prisma wave
#

I can't see why they would

old wyvern
#

Could I keep both in a usb?

prisma wave
#

linux live image can do anything

tranquil crane
#

here do you want an embed

old wyvern
#

oh wait I think no

prisma wave
#

Not on the same usb

old wyvern
#

yea

oblique heath
#

oho nice

prisma wave
#

without some fancy tool

old wyvern
#

I have fast boot still on

prisma wave
#

fast boot is fine I think

old wyvern
#

linux cant mount windows files with it I think

oblique heath
#

yugi are you gonna join the coc

old wyvern
#

atleast not in write mode

old wyvern
oblique heath
#

oki

tranquil crane
#

you got 2 1/2 minutes

old wyvern
#

joined

oblique heath
#

i'm starting

old wyvern
#

aight

oblique heath
#

dammit

#

misclick ๐Ÿ˜ข

prisma wave
#

wow apparently list comprehension is also syntax sugar for monad stuff

static zealot
#

xD

old wyvern
#

lmao

oblique heath
#

i done goof

old wyvern
#

rip

tranquil crane
#

wtf was this

old wyvern
#

square?

tranquil crane
#

75% lmfao

old wyvern
#

wait

#

no Imean n* n

#

xD

static zealot
#

oh seriously? there were some special cases

tranquil crane
#

I did n*n and I got 75%

old wyvern
#
    putStrLn $ show $  n*n
tranquil crane
#

you know, probably had to use a long

old wyvern
#

Overflow?

static zealot
#

oh BigInt @tranquil crane

tranquil crane
#

and not an int

oblique heath
#

"number of odd integers" is a comment

static zealot
#

smh

#

or long

old wyvern
#

Yea

tranquil crane
#

yeah

#

woopsies

oblique heath
#

so something to do with odds

old wyvern
#

haskell's Integer wont overflow

oblique heath
#

-- Find the sum of the first n odd integers!

#

wow

prisma wave
old wyvern
#

๐Ÿ˜Œ

oblique heath
#

wait... this particular challenge is broken

#

the comment gave it away

old wyvern
#

which?

oblique heath
#

reverse is broken

#
-- Find the sum of the first n odd integers!
prisma wave
#

๐Ÿฅฒ

oblique heath
#

look at the default comments in the code

tranquil crane
#

that's not even the right hint

oblique heath
#

;o

half harness
#

lol

old wyvern
#

lmao

#

Didnt notice that

oblique heath
#

well anyways

tranquil crane
#

well that one sucked

old wyvern
#

Anyway I should go now

#

almost 3 am

#

gn

oblique heath
#

bye yugi

tranquil crane
#

we go again

oblique heath
#

yis

tranquil crane
#

learn to make embeds properly :(

oblique heath
#

xd

#

are we ready?

tranquil crane
#

it's probably just gonna be us 3

oblique heath
#

alright

half harness
#

_ _||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||||โ€‹||https://www.codingame.com/clashofcode/clash/16982147c6ed1345fc766d487f2861ed307b093

CodinGame

CodinGame is a challenge-based training platform for programmers where you can play with the hottest programming topics. Solve games, code AI bots, learn from your peers, have fun.

#

need the embed ๐Ÿ˜Ž

oblique heath
#

hehe

tranquil crane
#

why tf isn't this solution working

half harness
#

oof

tranquil crane
#

???

half harness
#

๐Ÿ™„

static zealot
#

huh

tranquil crane
#

my god

#

ok next

oblique heath
#

alright

static zealot
#

gtg. going to play some Assassin's creed and get some sleep. Tired AF

tranquil crane
#

I did < instead of <= otherwise I would have submitted that in 20 seconds

tranquil crane
#

says that one is cancelled

oblique heath
#

try this one

tranquil crane
#

there we go

oblique heath
#

dkim are you playing

#

@half harness

half harness
#

oh

#

not rn

oblique heath
#

ok

tranquil crane
#

guess it's just us two then ๐Ÿ˜ข

oblique heath
#

it's a 1 v 1 then ๐Ÿคทโ€โ™‚๏ธ

static zealot
#

omfgggggg

#

fuck this shit

#

let's play

#

fuck Nvidia

oblique heath
#

join fast

tranquil crane
#

oh

static zealot
#

fuck Ubisoft

#

fuck everyone

tranquil crane
#

shortest kek

dawn hinge
static zealot
dawn hinge
#

Ah

oblique heath
#

this is a cool problem

#

i guess

static zealot
#

isn't this just x*3 ?

#

I'm confused

oblique heath
#

not quite

static zealot
#

oh nvm

#

its x*2 + x*x

#

nvm

#

bcz

#

fuck

oblique heath
#

lol

static zealot
#

yeah got it

half harness
#

this is ez

static zealot
#

57 is the best I can do

half harness
#

WHAT

#

i have 200

static zealot
#

Kotlin

oblique heath
#

i have 44

static zealot
#

yeah can't get it any more smaller ๐Ÿ˜ข

half harness
#

howww

oblique heath
#

wows

static zealot
#

javascript 39

#

nice

tranquil crane
#

lol

half harness
#

is python allowed

tranquil crane
#

all languages are so maybe

static zealot
#

its enabled so yeah

tranquil crane
#

look at that god awful string cast to int in the javascript one

half harness
#

how tf did u get 44

static zealot
#

yeah I got no idea how to make this shorter

half harness
#

i have 200

static zealot
#

lmao

oblique heath
#

down to 42

static zealot
#

damn man

#

idk

half harness
#

NOoooo

#

how

oblique heath
#

i give up

#

i dont think i can get lower than this

half harness
#

39!!

#

Wtf

tranquil crane
#

kek

static zealot
#

yeah my kotlin is not that good I guess

tranquil crane
#

javascript doesn't have a power operator that I know of

#

could have saved a couple chars

static zealot
#

pretty sure I could do something to make this shorter

half harness
#

LMAO I GOT 33

static zealot
#

but can't figure out what

half harness
#

ima see if i can shorten it

static zealot
half harness
#

okay i have 32

static zealot
#

omg the ~~ casty

tranquil crane
#

oh wait apparently ** is the power operator in javascript wth

static zealot
#

fuckk

#

I have to use !!.toInt()

#

just to cast

tranquil crane
#

The ~~ cast is disgusting

static zealot
#

also I have to use main

half harness
#

pog 30

static zealot
#

well yeah but its short

half harness
#

i think 30 is the lowest

#

i can go

static zealot
#

haha

oblique heath
#

what language are you using dkim

tranquil crane
#

what language are you using that you can get down to 30 wtf

half harness
#

lol

static zealot
#

go

#

?

half harness
#

i literally went through every language

#

no not go

static zealot
#

ell I mean you'll win

#

so just submit

#

please

#

if you're not lying

half harness
#

ok

static zealot
#

lmao

tranquil crane
#

share plz

oblique heath
#

ah

pale shell
#

Blitz what is your pfp btw

static zealot
#

hmm

tranquil crane
#

wow

#

ruby of all things

static zealot
pale shell
#

Ivan, your pfp looks like it has lip filler.

half harness
#

lol

static zealot
#

I used to be just Pepe Squidward

half harness
#

btw i have no idea how to code in ruby

tranquil crane
#

that could have been simplified

oblique heath
tranquil crane
#

by just removing the first set of paranthesis

half harness
#

i just needed a lang that used +, *, and ()

pale shell
half harness
#

oh

#

ah

#

rip

#

blitz is just soaring

#

57

pale shell
#

Throwing premium plugins out be like himMoney

static zealot
#

why no cool embeds from you?

half harness
#

my fav is shortest

pale shell
#

p.s. Please buy mg new plugin so bm gets paid :)

oblique heath
#

no idea

half harness
#

the only 2 times ive won is from shortest

tranquil crane
#

need developer role

half harness
#

i think

static zealot
oblique heath
#

is that everyone

half harness
#

yes

static zealot
half harness
#

nooo

#

not reverse

ocean quartz
#

Shortest is the best, but these noobs don't like it

half harness
#

shortest = best

#

shortest = only time ive won i think

#

:D

pale shell
#

Not ad I didn't post link

#

Nor did I say name

tranquil crane
#

why is this taking 4 years to run test cases

#

20% hell yeah

half harness
#

20%?!

#

wow

tranquil crane
#

well I'm going to go get some food I did this terribly wrong lmfao

#

be back in a few minutes

static zealot
#

damn I hate my answer

#

but it works

half harness
#

lol

#

mine too

#

at least i think it works

tranquil crane
#

oh wow

half harness
#

oh

#

u did better than me

#

blitz

#

lol

#

look at mine

half harness
tranquil crane
#

no

#

I'm too embarassed

half harness
#

ok

oblique heath
#

i cri

half harness
#

๐Ÿฅฒ

tranquil crane
#

I didn't even read the prompt correctly

static zealot
#

I almost submited it wrongly as well

tranquil crane
#

I just ran the first test case, passed, submitted

static zealot
#

I was repeating N times instead of i times

#

but realised right as I was about to click submit

#

bcz I didn't even test

#

that's what pros do

#

๐Ÿ˜ข

half harness
#

ivan

#

y u taking so long

tranquil crane
#

typescript takes like 10 seconds just to run one test case

#

going just stick to javascript idc about strict typing anymore

#

javascript test cases run instantly

oblique heath
#

that was painful

static zealot
#

same link btw

half harness
#

there

tranquil crane
#

why do neither of you have the developer role

half harness
#

who is 'neither of you'

static zealot
half harness
#

is it me ๐Ÿ˜ค

static zealot
#

working on deluxemenus instead of working on my own shit

tranquil crane
#

dkim and ivan mostly

oblique heath
#

i don't have any good public repos

half harness
#

oh

static zealot
#

oh ok nvm

tranquil crane
#

fair enough I guess

static zealot
#

I'm not that important

half harness
#

im too scared to apply

static zealot
#

fuck blitz

#

who cares about blitz

#

smh

tranquil crane
#

Ivan we have a different lobby

oblique heath
#

ah

half harness
#

YES

oblique heath
#

is this black and yellow for anyone else

tranquil crane
#

yes

half harness
#

yes

oblique heath
#

weird

half harness
#

i thought that was dark reader

#

lol

static zealot
#

47

#

that's all I can do

#

41

tranquil crane
#

how do I keep getting 39

gusty fulcrum
#

go to bed blitz

static zealot
#

and no

#

thanks

#

lmao

gusty fulcrum
#

Touchรฉ

oblique heath
#

i'm uh.. at 25

static zealot
#

At this point I'm just asking to get banned lmao

oblique heath
#

not haskell though

half harness
static zealot
#

I mean cube already opened applications in anticipation of me getting banned

onyx loom
#

no thank you just fuck you

static zealot
#

aham

#

that's me

oblique heath
#

21

static zealot
#

I'm almost 21 ...

#

๐Ÿ˜ข

oblique heath
#

lmao

static zealot
#

well not yet 20

#

but almost

#

xD

onyx loom
#

๐Ÿฅฒ

half harness
#

๐Ÿฅฒ

static zealot
#

oh wait glare has a repository

#

he could put EpicHeads api on there

tranquil crane
#

the what

half harness
#

18?!?!?!?!

tranquil crane
#

yes 18

static zealot
#

Ruby ๐Ÿ˜ข

oblique heath
#

sneaky

tranquil crane
#

from what I could tell ruby has the fastest way to both read and write a string

oblique heath
#

i think bash is faster

static zealot
#

hmm how does jitpack work?

tranquil crane
#

I looked into bash but couldn't get it to run lol

half harness
#

my lowest is 24

oblique heath
#

bash is super weird with syntax though

tranquil crane
#
puts gets.to_i(16)
static zealot
oblique heath
#

but the read is 4 characters + 1 space + the variable, and write is the same

static zealot
#

wait how have I never searched this before

ocean quartz
onyx loom
#

git: 'gud' is not a git command. See 'git --help'.

static zealot
#

haha funny smileycry smileycry

tranquil crane
#

beautiful

static zealot
#

so apparently I can just make a repository out of any github project with jitpack for free

half harness
#

lol we have the same thing @tranquil crane

static zealot
#

no new link?

oblique heath
#

very nice dkim

static zealot
#

xD

half harness
#

xD

tranquil crane
#

it's almost like I posted my solution in here

oblique heath
#

bam

half harness
#

wait what

#

you did

tranquil crane
#

yes lmfao

half harness
#

where

tranquil crane
#

just scroll up a bit

half harness
#

oh

#

i didn't see

#

lol

onyx loom
#

dkim trying to play it off like he didnt copy and paste ๐Ÿฅฒ

half harness
#

;-;

#

why did u post it here ๐Ÿ˜ 

#

i could have gotton some credit

regal gale
#

Classic ๐Ÿ‘€

static zealot
#

math

#

fuck yeah

oblique heath
#

well that was silly

tranquil crane
#

wow

#

you just printed out n^2 while I typed all this other garbage

oblique heath
#

share code

#

xd

#

i was considering doing that

tranquil crane
#

I don't really process information fast enough to realize the shorthand for that

oblique heath
#

but foldl takes a lot of brainpower and i'm weak

static zealot
cinder harbor
#

bonjour

half harness
#

wait a minute

oblique heath
#

bojour

cinder harbor
#

bosoir

old wyvern
#

Lmao

oblique heath
#

pryvet

old wyvern
#

Adios

#

Amigo

#

Thats all ik

half harness
#

0%?!

onyx loom
#

wrong language yugi ๐Ÿฅฒ

old wyvern
#

Oh

#

Well

half harness
#

blitz

static zealot
#

!skip

half harness
#

look

tranquil crane
#

ah yes

oblique heath
#

lmao

half harness
#

embarrassing

onyx loom
#

unnecessary main params :kekw:

oblique heath
#

give us a recursive question, oh mighty coc gods

pale shell
fleet prism
half harness
#

start

cinder harbor
half harness
#

@tranquil crane show code

tranquil crane
#

took me longer to read the prompt

half harness
#

๐Ÿ˜ฎ ivan

static zealot
oblique heath
#

sigh

static zealot
#

embarassing he tells me

#

fuck off dkim

half harness
#

lol

tranquil crane
#

plus equals

#

where you at

half harness
#

๐Ÿ™„

static zealot
#

dkim you can kindly fuck right off

tranquil crane
#

look, mine uses +=

#

superior language

half harness
#

imagine having capital variable names smh

arctic juniper
#

you playing coc?

tranquil crane
#

that was the default one

#

I already had like 80% of the code written for me lmao

half harness
#

if i kept it default i probably would have finished a lot faster

static zealot
#

he dares question me but he doesn't know how to use += You fool

oblique heath
#

i give up with haskell

#

it's too much

static zealot
#

how dare you question the all mighty

tranquil crane
#

how is this too much for haskell but you were easily able to flip every other character in a string

half harness
#

lol

#

lemme try

static zealot
#

lmao

half harness
#

nevermind

onyx loom
static zealot
#

its just sum / amount ivan. sounds pretty easy. is haskell that bad?

oblique heath
#

the input is

onyx loom
oblique heath
#

i don't know enough about monads to do that at any reasonable speed

arctic juniper
#

wanna do code golf?

half harness
#

what is code golf again?

tranquil crane
#

that's mixed in as one of the options

#

shortest

arctic juniper
#

^

half harness
#

wot

#

whats diff between golf and shortest

#

lol

#

rip

tranquil crane
#

nothing

arctic juniper
#

...

half harness
arctic juniper
#

uh

tranquil crane
#

they both mean the least number of characters

half harness
#

then sure

arctic juniper
#

1698277291d2c66eb6f394d221ae90295d9f1b5

arctic juniper
#

yes, that, thank you

tranquil crane
#

shortest

arctic juniper
#

when do I start?

half harness
#

shortest = best

#

wait

#

ok

#

start

static zealot
#

now

half harness
#

late

arctic juniper
#

ear rape, ouch

half harness
#

what

#

nooo

tranquil crane
#

this is an actual proper shortest prompt

half harness
#

i might have to use kotlin for this one

#

lol

arctic juniper
#

this is stdin, right?

half harness
#

wat

#

what is stdin

#

oh

#

input?

arctic juniper
#

stdin or argv?

half harness
#

uhh

#

what is that

old wyvern
#

Just a bit diff

#

Haskell has a separate Fractional type

tranquil crane
#

excuse me?

obtuse gale
#

lmao

tranquil crane
#

To my knowledge javascript doesn't have a way to log to console without a newline

static zealot
#

at least yours prints something

old wyvern
#

Lol

#

Nicole

#

It tells you what function to use in the template

oblique heath
#

what are yall at

#

i'm at 82

onyx loom
old wyvern
#

Tesla

arctic juniper
#

I'm at 39

oblique heath
#

wow

tranquil crane
#

The template says to use console.log

arctic juniper
tranquil crane
#

which outputs it with a newline always

#

you what

#

the example says
22
2

old wyvern
#

Try process.stdout.write("")

arctic juniper
#

oh sorry yeah

static zealot
#

well 103 is good enough

arctic juniper
#

22
2

tranquil crane
#

I know of that but it's just so looonngg

arctic juniper
#

make sure you don't have a trailing whitespace or something

#

trailing newlines are fine afaik

half harness
#

ok back

#

whats happened

#

i was doing some intense googling

arctic juniper
#

so there you go, saved you 6 chars

old wyvern
#

Lol

tranquil crane
#

it's marked as deprecated lmao

arctic juniper
#

I think stderr is fine

tranquil crane
#

didn't know that though, thanks

arctic juniper
#

I'm at 35

half harness
#

103 ๐Ÿ‘€

static zealot
#

no. 301

tranquil crane
#

@arctic juniper print actually still puts a newline

static zealot
#

your vision is just blury

arctic juniper
#

I'm pretty sure js has .repeat

#

just use that

tranquil crane
#

it does

#

and that's what I'm using

arctic juniper
#

then what's the problem?

tranquil crane
#

but it keeps adding a newline to the console.log

#

the test cases don't allow newlines at the end

#

for some wild reason

arctic juniper
#

since when