« first day (2858 days earlier)      last day (2002 days later) » 

12:34 AM
Hey, Mendeleev's back.
(?)
 
1
Q: Densely packed decimal (DPD) to decimal, with logic gates

BubblerInspired by recent popularity of nandgame on TNB, and my own previous challenge. Background Densely packed decimal (DPD) is a way to efficiently store decimal digits in binary. It stores three decimal digits (000 to 999) in 10 bits, which is much more efficient than naive BCD (which stores one ...

 
 
2 hours later…
3:05 AM
@Zacharý yes, i'm back
 
:D
 
3:45 AM
0
Q: Weight of the Least Weighted RoD Path

Chas BrownLet A be an m by n rectangular matrix of positive integers, where m and n are also positive integers. We are interested in RoD ('Right-or-Down') paths from the upper-left cell of A to the lower right cell; in an RoD path, each successive cell of the path is either one cell to the Right of or on...

 
4:05 AM
should enums inherit from a special Enum class?
 
Anonymous
4:25 AM
@Downgoat What ar ethe upsides and downsides?
 
downsides: not sure if it would make semantic sense that all enums could be the same 'type', potentially introduces enum overhead by adding dynamic dispatch. upsides: all enum methods would be inherited which could be more idiomatic from an OO perspective
 
4:44 AM
@Downgoat What kind of enum methods are you thinking about?
 
why would rhe methods need to be virtual
 
5:04 AM
@quartata e.g. (PlanetEnum.Earth as Enum).rawValue
 
Why would an enum need to have methods?
Are you making Java?
 
@Downgoat but why does this need to be virtual
 
@quartata oh yeah good point
 
assuming its even a property like that
 
 
1 hour later…
6:15 AM
CMC Given a list, return the position of its "center of mass". The center of mass is defined as $\left(\sum_{x=1}^{n} m_ix\right)/M$, where $m_i$ is the value of that element and $M$ is the sum of the list. Test case: [1,3,2,6,9] -> ~3.90476 (1*1+3*2+2*3+6*4+9*5)/(1+3+2+6+9)
 
6:29 AM
@Mr.Xcoder Nonjax version plz?
 
@Adám Basically multiply each element by its 1-based index, add those products and divide by the total sum
 
@Mr.Xcoder APL (Dyalog Unicode), 23 bytes +/÷⍨⊢+.×⍳∘≢ (pretty much literal translation of ^)
 
0
Q: How many moves?

Vedant KandoiGiven two different positions on a chess board and the type of piece, output the minimum number of moves it will take for that piece to go from one position to another. Rules The given piece can be King,Queen,Rook,Knight and Bishop. (This input can be taken as any 5 unique characters) The 2 po...

 
05AB1E can do it in 5 bytes, curious to see whether it can be beaten.
 
uh, that was 11, not 23
@Mr.Xcoder Makes sense, as there are 5 operations: Indices, cross-product (with self), duplicate, sum, divide.
 
6:43 AM
@Adám Nope :)
 
@Mr.Xcoder Jelly, 4 bytes
 
@Bubbler Ah yes, Jelly has the duplication implicit.
 
Dot product with self-index (at least I call it). The rest (divide by sum) is the same.
Idea: Make a "weighted average" built-in. Then it's simply "weighted average of self-index with the weight of input".
 
ngn
7:29 AM
@Adám you can avoid "swap": ⊢+.×⍳∘≢÷+/
 
@ngn Doh.
 
ngn
@Adám even shorter: +/+\∘⌽÷+/
 
@ngn And there he goes again ;-)
 
ngn
yeah, a scan :)
 
 
5 hours later…
1:02 PM
CMC: Output a negative number without using negation or subtraction etc.
 
ngn
@Neil dyalog: ≡0⍬
 
@Neil Python 2, 18 bytes
 
ngn
@FrownyFrog the space is unnecessary
 
thanks
 
ngn
@Neil is this negation or subtraction etc? print'-1' :)
 
1:18 PM
@FrownyFrog nice that's the sort of idea I had
@ngn I was originally going to write - or any other characters representing negation or subtraction in your language
also, you're not strictly speaking outputting a number ;-)
 
ngn
@Neil pari/gp: I^2 (imaginary unit, sqared)
 
@ngn ooh very clever
 
@Neil I supposed this is not OK in APL/TI-Basic: ¯1
 
I probably would suppose that too, if only I could read it
 
@Neil Huh, you can't?
 
1:25 PM
well, I see a character which looks like a superscript negation sign, but it could mean anything
 
@Neil It is the negative number indicator; part of the number, i.e. neither negation nor subtraction, both of which are - in APL and TI-Basic.
 
@Adám Done
 
@DJMcMayhem Thanks!
 
2:09 PM
@Adám in that case, yes, that would not be OK
 
@Neil Figured. A more rigorous CMC would be … without strings, negative numbers, negation, or subtraction.
 
2:26 PM
@Neil PowerShell, 7 bytes -- 1-shl31
 
@AdmBorkBork nice
1<<31 easily beats what I was thinking of in JavaScript
 
Javascript: ~1?
 
~ is boolean NOT, which would definitely constitute negation IMO
 
2:49 PM
@Neil Canvas, 9 bytes - get the Y position the top left char of "_" vertically reversed
 
@user202729 ok, so the big reveal, it was Math.max()
 
@dzaima though this is shorter :|
 
@Mego I imagine the solved state is in the set... so 1
additionally you aren't stipulating that it needs to be an optimal solution
so still 1 even if the solved state isn't part of the set
 
@Poke largest subset of valid, **unsolved** states
@Poke there are likely larger subsets that meet the criteria, so 1 is not correct
 
hmm my headache is not helping me this morning
you're right on both counts
 
2:57 PM
No worries, we all have those moments :P
 
for some reason i was thinking smallest subset
 
Alright, it's time for me to finally work on my super-koth
 
3:32 PM
@Neil Mathematics ;-) : i²
 
yeah, @ngn had that idea over two hours ago...
 
@Neil Python 2, 7 bytes: print~0 (does ~ count as negation? -x - 1)
 
it does in this case
 
17 bytes: print''.find('0')
9 bytes: print'-1'
cheaty? ^
(it's not string representation, it's real string)
 
14 bytes: print cmp(0,1)
 
3:40 PM
eh... cmp might be perceived as (a > b) - (a < b)
 
Ooh!
 
@EriktheOutgolfer Nice idea:
@Neil APL (Dyalog Unicode), 3 bytes ⍬⍸3 (with ⎕IO←0)
 
@EriktheOutgolfer and @FrownyFrog already did that...
oops replied to wrong message
 
ah, Frowny's version had an unnecessary space
I thought he had a different approach :P
 
I like cmp
 
3:47 PM
JS, 15 bytes, no bitwise ops: ''.indexOf('i')
 
Perl, 6 bytes: say$#a
 
dunno anything about Perl, but, umm...
 
(assuming @a is empty or undefined)
needs feature say, generally assumed 'free'
 
is -0 a negative number?
 
@primo ah, if you mean this, then I suspect it's not considered "Perl" after the newest consensus on flags
puts often-heard-about -M5.010 in it, magically works
 
@Skidsdev zero generally doesn't have a sign in maths
 
Perl, 8 bytes: print$#a
 
:P
 
@EriktheOutgolfer add another + inbetween the dots then, 51 bytes :P
 
3:53 PM
exactly ;-)
now, let's imply all the golf that will replace the +s and bam :P
 
btw, -0 does exist as a separate value from 0 in many programming language, but it's not really the integer -0, it's -0.0
 
I mean I was just asking cos it'd save a byte in bf :P
CMR: Write a Hello, World! program in Sum-It
 
@Skidsdev R?
 
Chat Mini Request
 
4:00 PM
sounds like you want to put your language over TIO ;-)
 
Oh yeah by the way @EriktheOutgolfer I finished my range language :P
 
I like how you included the "for golfing purposes" part
 
hahaha yeah
because anybody's going to be golfing in this language
 
@Neil another approach in Dyalog APL: '1',⍨⎕UCS 45
cc @Adám ↑
 
@J.Sallé well there isn't anything preventing just '-1'
 
4:10 PM
@dzaima that's boring though
 
btw, '-1' doesn't represent ¯1
it represents an expression that results in it
 
you could probably do something with trig functions, logarithms, etc.
 
@EriktheOutgolfer Fixed
 
@Neil 2⍟.5? :P
 
sorry I don't know APL
 
4:15 PM
@Neil still not shorter than ≡0⍬ or ⌈/⍬
 
... I still don't know APL
 
@Neil that's $\log_{2} \frac{1}{2}$
 
fair enough
 
@Neil ≡0⍬ is depth of [0,[]], and since its uneven, it's returned negative; ⌈/⍬ is ceiling reduce [], aka your Math.max()
 
we have a winner!
oh, never mind me, it was after the fact
 
4:21 PM
@Neil Also, I tied ngn with ⍬⍸3
 
@dzaima actually, it's your Math.min()... ;-)
 
sorry I was confused and thought ceiling reduce had been suggested before
 
@EriktheOutgolfer Save 1 byte: ⍟.5
 
@EriktheOutgolfer ? is ceiling and Neil said Math.max() before
 
4:23 PM
well, the result of ⌈/⍬ is negative
 
Actually, ⍟÷8 looks much cuter.
 
@EriktheOutgolfer yeah, that's what we want.. So is the result of Math.max()
 
maybe I've confused JS stuff; it's basically the smallest number that exists in APL :P
@Adám uh... I made the mistake of turning that 90° ccw
 
@EriktheOutgolfer ⌈/⍬ works just like Math.max called with no args
 
OK, so now we have 31 APL solutions of 3 bytes each.
 
4:26 PM
oh right yeah, C#, 12 bytes int.MinValue
 
^ snippet?
 
C#, 15 bytes n=>int.MinValue
 
32
 
@Adám 9 ⍟.<int>, 9 ⍟÷<int>, ⍬⍸3, ⌈/⍬, 9 ≡<int>⍬ makes 29; what are the other 3?
oh actually there's 10 ≡<int>⍬ so 2 left?
 
4:44 PM
@J.Sallé Oh yeah, we have a lot more: 9 ⍟.digit, 9 ⍟÷digit, 10 ≡⍬digit, 10 ≡digit⍬, ≡⍬#, ≡#⍬, 10 ⍬⍸digit, ⍬⍸#, ⌈/⍬, 9 ⍟⌹digit, 61, I think.
 
@Adám Nice!
The domino one is cool
 
+14 for a○b
 
@dzaima Wow.
 
Can we get to 100 I wonder?
25 to go
 
just brute force all possible 3-char combinations :p
 
4:49 PM
Yeah that would take a while rofl
 
@J.Sallé Nah, only a million possibilities. Hang on…
 
@Adám ಠ_ಠ of course you're gonna do it now hahahahahahahah
I assume ⎕AV will be somewhere in there but that's as far as I can go >.>
 
You can iterate over that many possibilities without too much trouble, the annoying thing is if you cause a loop or something in 3 characters
 
@J.Sallé No, I'm using the secret command to ask the interpreter about everything it knows,
 
@Adám ...is that an actual thing?
 
4:52 PM
@Pavel I don't think you can. Shortest inf. loop is -⍣=1, afaik.
@Pavel Yes.
 
@Adám This leads to the natural folowup question, how secret is it actually?
 
@Pavel How do you measure degree of secrecy?
 
I think the undertone of that question is "Is it too secret to tell us?"
 
@Pavel We have another secret feature that does a fairly good job of stopping people from trying to brute force out our secret features.
 
I can kinda see two options here, "It's actually secret and I can't tell anyone" and "It's not documented anywhere but it doesn't actually matter if someone find out"
 
4:55 PM
@Pavel Based on another conversation on the APL Orchard a while ago, I'd say it's the former
 
0
A: Sandbox for Proposed Challenges

VaelusKeyboard Walk Given a word (or any sequence of letters) as input, you must interpolate between each letter such that each adjacent pair of letters in the result is also adjacent on a QWERTY keyboard, as if you typed the input by walking on a giant keyboard. For example, 'yes' might become 'ytres...

 
5:20 PM
Are there any chess players here?
 
Yes
 
@Pavel No worries. Was in the vein after browsing codegolf.stackexchange.com/questions/176567/how-many-moves normally do not play for free as in beer
 
Not right now, no
Sorry
 
@Pavel The previous comment is in reply to your last comment. Been a while since have had a decent match. Will extend the offer for the remainder of the day
 
5:52 PM
CMC: 1. Go back to one of your early answers on PPCG. 2. Try to improve on its score. 3. Enjoy how your golfing skills have evolved since then.*
* your mileage may vary
 
lol probably very true
link please :P
 
TBH my skills haven't improved much and most of my answers have already been optimized via comments.
 
@Laikoni Examples?
 
bruteforce result. Interesting to note is ⍟?0 :D
 
@Adám yeah, that's what I asked above too... :-P
 
6:02 PM
@dzaima Nice.
 
I don't have a current example, but already encountered this from time to time.
 
@dzaima oh right ⎕av doesnt have
 
@dzaima I counted like 10 expressions less than our earlier count though
Is it just the ?
 
@J.Sallé ^^
@J.Sallé let's see
also by some reason the console is spammed with output even though im filtering & out from ress←{0::⎕null⋄⍎⍵}¨cmds
 
@Adám This is my third answer to PPCG, golfed down by 14 bytes one and a half years later.
 
6:07 PM
We had 75 earlier and 68 in the result, so probably it's just the
 
@Laikoni what is?
 
@dzaima Did you filter out ?
 
@Adám oh nope
yup that seems to be it
 
@dzaima Now did you add all the new ones? 7 I think.
 
@Adám didn't bother :/
 
6:10 PM
@EriktheOutgolfer ^
 
yeah saw that, thanks
 
77, now to add rest of new things
 
@dzaima Can we see your brute-forcer?
 
actually i have no idea where to find them
 
@dzaima APL+Shift+J K / Z I ` and @
Though I highly doubt anything but will yield results.
 
6:15 PM
^ seems so
@Adám there
didn't bother making it check for fancy quads, ≡ no alphabet chars
 
@dzaima Nothing interesting there. I just asked it.
 
@Adám what's the APL+Shift+/ shortcut? Mine doesn't work (but I'm on version 16 on this laptop)
 
@J.Sallé ⍠ is on APL+Shift+Bottom-Right-Key
 
@Adám ah nevermind it's because of my keyboard layout. My is on : instead of /
 
@J.Sallé How do you type ≡?
 
6:22 PM
@Adám APL+Shift+ç
The ABNT2 Keyboard Layout has a key for ç and both ^~ separately
Also for some reason there's a currency shortcut too although that specific currency has been substituted by the BRL in 1994
 
@J.Sallé I see, you completely made your own layout.
 
@Adám yeah, though the only significant change is the ç key and the dead keys for the diacritics.
Friend of mine once brought me a mechanical keyboard when coming back from Germany. I had to type without looking at it because I used the PT-BR layout on windows but the physical keyboard was AZERTY and it confused the heck out of me
 
Apparently, Unicomp is now willing to Make Dyalog layouts for any language.
 
6:47 PM
@Adám this is the only Dyalog (and APL in general) one I found ^
 
7:02 PM
@EriktheOutgolfer Their site isn't very good. They will in fact make you anything, since they make them one by one and they have the APL overlay ready to apply to any keyboard layout.
 
@Adám yeah, not to mention that site somehow says "Does not include the spacebar."!
like, WUT?
 
Is it British? Maybe it's a spacepub.
4
 
it's definitely US ;-)
sorry for breaking the joke, but eh
 
@EriktheOutgolfer That's when you only buy add-on keys for an existing keyboard. Since spacebar isn't printed , there's no need.
 
@Adám oh, so that's why this is in the "Buttons" section :P
how to print a space... ] [
yeah, definitely bad site
 
7:09 PM
@EriktheOutgolfer Hey, they are domain experts. They're good at keyboard hardware.
 
@Adám hm, are they... domain experts too?
 
Better than some I've seen. They actually have contact information -- whois.com/whois/pckeyboard.com
 
7:29 PM
> If you rip a hole in a net, there are now fewer holes in the net.
 
7:46 PM
@Neil oh wow, this is yet another problem for which you can write a 7 program for which it's unclear whether or not it's cheating: 007403 (6 characters, 2 bytes)
this takes the string literal 66, escapes it to produce 00, and then outputs it; the first 0 is interpreted as a request to use numeric mode, and the second 0 (in numeric mode) is interpreted as decrementing
so you get an output of -1
the difficulty here is determining a) what a negative number is in 7, b) what a numeric literal is in 7
@EriktheOutgolfer negative-zero is normally used as a placeholder for showing a negative number that was rounded to zero
 
most of the time, yes
however, as I said a bit below, you can actually type -0.0 and it will not make it 0.0
CMC: tell whether the input is -0.0 or 0.0; take it as a FLOAT OR DOUBLE please :P (the only functions that can use a string input verbatim are the atof and eval functions)
 
8:08 PM
was looking through the Jelly builtins, I'm not sure if it has one that can do that
normally in practical languages you'd use copysign, but it has an annoyingly long name
 
I don't think any language has a built-in... although I have devised some sort of way to solve this... ;-P
inb4 Mathematica
 
Maybe convert to binary and look at the sign bit?
 
@Adám good luck converting a float to binary...
 
@EriktheOutgolfer Why? I mean get the actual bits.
 
BMO
@EriktheOutgolfer head.show
Or is that cheating?
 
8:11 PM
that’s cheating
 
@BMO definitely cheating
that's why I prohibited string inputs
@Adám how? my way is definitely easier, at least in Python
 
BMO
Yeah, but it's a Double input
 
@EriktheOutgolfer I meant in C.
 
another possibility would be to use the cotangent function; 1/-0 seems to produce +infinity in Python, but maybe cotangent would handle the sign correctly
 
ok yeah, that’s not cheating
 
8:13 PM
looks like Haskell wins :P
 
C(++) can use std::signbit
 
@ais523 doesn't Python have ZeroDivisionError?
at least it does for me
 
oh, must be a special case in Jelly, then
 
actually, I'm pretty sure it's numpy or something
 
anyway, reciprocals work in JavaScript: x=>1/x>0 (Try it online!)
that's 8 bytes
most of my favourite languages don't even have floats, so I can't answer in those
 
8:18 PM
My favourite languages do not distinguish -0 and 0
 
I don't think PowerShell does, either.
sad face
 
Dodos also doesn't
(have floats, that is)
 
@DLosc (re: 46503709) Acc!! is obviously Turing-complete, and in fact doesn't even need the loop variables; you can write a boolean not (i.e. C's ! operator) using 0^ (this is the same technique used in Underload), so for any expressions a, b, c a*(0^((_%c)-b)) is a if _ equals b mod c or 0 otherwise, you can add those together to write a Tip program in a single expression
would be a pain to actually write in, though
maybe I should throw an Acc!!! cop up onto the original question :-)
 
8:38 PM
0
A: Sandbox for Proposed Challenges

OliverBase Running Given an input n, output the sum of the range [1...n] where each element e is ran through: base-e of n. Example: n = 10 Create the range [1...10]: [1,2,3,4,5,6,7,8,9,10] For each element e, get an array of the base-e digits of n: [[1,1,1,1,1,1,1,1,1,1],[1,0,1,0],[1,0,1],[2...

 
9:07 PM
come to think of it, geometric interleaved High Rise is another language that compiles to Acc!! pretty easily
(this time using the loop variables)
 
9:27 PM
0
Q: Count the score of a Code Golf code

2br-2bMy challenge is to make a Java method(s) that is given a String (another code in Java), removes any unnecessary characters, counts and returns the score, and displays the cleaned-up code in a way that can be copied/pasted. It should ignore spaces, line breaks, etc. unless they are necessary to t...

 

« first day (2858 days earlier)      last day (2002 days later) »