Conversation started Jul 6, 2021 at 8:01.
Jul 6, 2021 08:01
Welcome to the 5th Biweekly Mini Golf! During this event, we'll post some CMCs (Chat Mini Challenges) for you all to solve. A new one will be added every 5 to 10 minutes. If you have any questions, don't be afraid to ask. Good luck!
3
in BMG Drafts, 7 hours ago, by Bubbler
Draft: First n terms of 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, ... which has a pattern of [1, 2, 1], [2, 3, 2], ...
ngn/k, 16 bytes: {x#,/1 2 1+/:!x}
APL: Playing around with {0 1 0+¨⊂¨⍳⍵}, but can't get it to work Totally wrong
0 1 0∘+¨
and you don't need the ⊂¨
Or (⊂0 1 0)+⍳⍵
Jul 6, 2021 08:07
yeah, that's the more APL way of doing it
{⍵↑∊(⊂0 1 0)+⍳⍵) should work I think
@Bubbler looks like a kaomoji
@Bubbler I was enclosing the wrong side!
@pxeger Is there a way to quit execution early?
that'll have to do for now
Jul 6, 2021 08:09
Oh ok
I'm working on a stop button :)
It's surprisingly complicated to implement
ovs
ovs
05AB1E, 7 bytes: ƵKSλ£₃>
in BMG Drafts, 7 hours ago, by caird coinheringaahing
Draft (inspired by a builtin I just added to my Jelly fork): Given a list (even length) of integers, split into consecutive pairs, sort each pair by its sum, then flatten. e.g. [2,3,6,4,2,1] -> [[2,3],[6,4],[2,1]] -> [[2,1],[2,3],[6,4]] -> [2,1,2,3,6,4]
att
att
@Bubbler Mathematica, 30 bytes: Join@@#~Partition~2~SortBy~Tr&
@att I always wondered about ~ parsing. Looks like it's left-associative (kind of)
Jul 6, 2021 08:13
We're supposed to be golfing these, right?
@AviFS Yes
@AviFS Do you really need <>? :P
@Bubbler ngn/k, 20 bytes: {,/{x(<+/'x)}0N 2#x}
@AviFS Golfed 1st challenge in BF: +[.>.+<.+]
ovs
ovs
@Bubbler APL, 19 bytes: {⍵[⍋2/+/¨⍵⊂⍨2|⍳⍴⍵]}
I feel like there is something shorter for ⍵⊂⍨2|⍳⍴⍵
att
att
Jul 6, 2021 08:16
@Bubbler ~ ~ is, yes
@AviFS That's wrong, I think +[.+.-.+] should do
@Bubbler Oh... that's good. But I don't think mine is wrong. If you look at the section where it prints numbers, you'll see 010121232...
att
att
@Bubbler Mathematica, 22 bytes: #+2#~Mod~3&~Array~#/3&
@ovs The only other alternative is to reshape, but (.5×≢⍵)2⍴⍵ isn't particularly short either
in BMG Drafts, 8 hours ago, by AviFS
Draft: Output a magic square with the input number in one of the cells.
att
att
Jul 6, 2021 08:20
what size square?
3x3 I'd assume?
@AviFS I guess you mean 3x3 magic square?
size 1x1 lol
@pxeger Interrupting execution may be nontrivial, but allowing the user to change the timeout should be an easy temporary fix.
hmm I hadn't thought of that
Jul 6, 2021 08:21
@Bubbler I thought that initially, but then I decided any size should be allowed to make it interesting...
@Razetime Then again... this. Good one!
I say 3×3 or greater.
Doesn't need to be consistent across inputs
@Razetime With Razetime's idea, we do have an honorary 0 byter in the implicit IO langs
ok so wait
Polyglot, 0 bytes
should it theoretically terminate before the end of the universe
3x3 is still easy: 7 0 5 2 4 6 3 8 1+⊢
Time to compress that digit vector :P
@Bubbler Wow... that was clever!
Jul 6, 2021 08:25
cause the general short solution would be generating random 3x3's until one of them is a magic square and contains said number
I thought one would have to do something like:
n+i  1     2
3    4    n+i
5   n+i   6
@betseg memelord has arrived
im a bit rusty
Jul 6, 2021 08:27
@AviFS That doesn't quite work, but there's indeed a general solution for 2 or 3 givens using a pattern like that
No, it doesn't quite work, I know. But I thought something like that. Yours is really clever!
We can move on! Between @Razetime & @Bubbler I think we're good on this, haha
in BMG Drafts, 7 hours ago, by Bubbler
Draft: Given an ASCII string, double each single quote and enclose it in single quotes. "How'd'n't I see that" -> "'How''d''n''t I see that'"
in BMG Drafts, 7 hours ago, by Bubbler
Draft: Given a rectangular 2D string of odd width and height, place the character X at the center.
Posting two because I'm briefly going AFK now
@Bubbler the double-quotes on the outside are not part of the input, right?
@pxeger Correct
is I/O as a list of codepoints ok?
Jul 6, 2021 08:31
Yes
@Bubbler ngn/k, 20 bytes: {a,((1+a=)#x),a:"'"}
@Bubbler this can be a list of strings?
@Razetime yes
hm this is not very obvious in K
@Bubbler Zsh, 25 17 bytes: <<<"'${1//'/''}'"
@Razetime Likely easier if you take it as a newline-separated string instead
Jul 6, 2021 08:38
@Bubbler V(vim), 4 bytes: Try it online!
@Bubbler Vim:i'<esc>qqf'l.q9999@qA'
I'm sure V has some loop thing to make 9999×macro less silly
@AviFS you're missing an escape there
True, thanks
@pxeger Fixed!
@Razetime Nice!
@Bubbler yeah probably @[;;] but no clue on what to do
alternatively, i'<esc>A':s/'/''/g<cr>
Jul 6, 2021 08:42
@pxeger True, but why do that...
cos it's shorter and works with more than 9999 apostrophes?
Whatever :P
@pxeger also missing an escape, and needs to be done in the other order
in BMG Drafts, 7 hours ago, by DLosc
Draft: Given N (0- or 1-indexed), output the Nth element of this sequence:
in BMG Drafts, 7 hours ago, by DLosc
""
\"""\"
\"\\"""\\"\"
\"\\"\\\\"""\\\\"\\"\"
\"\\"\\\\"\\\\\\\\"""\\\\\\\\"\\\\"\\"\"
in BMG Drafts, 7 hours ago, by DLosc
Brownie points to whoever finds the 7-byte Pip answer. ^_^
:s/'/''/g<cr>I'<esc>A'
probably something shorter with ctrl-O
Jul 6, 2021 08:50
@Bubbler Another lame Vim: 3i 1<esc>b<c-a>qqYp<c-a>w<c-a>w<c-a>q9999@q
Pip, 8 bytes: Lax:RPxx Try it online!
@DLosc idk what black magic you've done to get 7
@betseg Isn't v:Vec<_> shorter than the turbofish?
in BMG Drafts, 7 hours ago, by Bubbler
Draft: Given a string, output which-th time each character is appearing in that string. "abracadabra" -> 1, 1, 1, 2, 1, 3, 1, 4, 2, 2, 5
@Bubbler 7 bytes: Try it online!
gotteeem
Lol nice
Jul 6, 2021 08:55
@Bubbler oh yeah
v:Vec<_>=a.chunks(2).collect() for 83
Under CGCC rules you can also cheat and replace i32 with i8 :P
true lol
i misread mb
@Bubbler APL, 28 bytes: {a⊣{a⊢←(⍋b)@(b←⍸⍵=a)⊢a}¨a←⍵}
@Bubbler APL, 19 bytes: {+/(⊢×+\)¨(∪⍵)=¨⊂⍵}
@Razetime 'Gottem!
Hi
Just in time
Jul 6, 2021 09:02
@AviFS You don't need ¨ in
Thanks! @Razetime was just telling me!
He also says I can trainify!
With (∪=⊂)⍵
@AviFS Train: (+/⊢×+\¨)∪=⊂
Holy sh**
Well um, thanks
which is 12
Go me :P
Jul 6, 2021 09:04
ovs
ovs
I had `(+/⊢=⊃∘⌽)¨,\`, which is 12 as well
in BMG Drafts, 8 hours ago, by Bubbler
Draft: Given an alphabetic string and a boolean list of the same length, uppercase or lowercase each letter accordingly. "Hello", 0 1 1 0 1 -> "hELlO"
My new nickname, courtesy of @Razetime: AV1 File System
@betseg I appreciate your perseverance :P
Jul 6, 2021 09:07
@AviFS what's AviFS supposed to actually mean?
My first name, middle initial, and last initial
... and my social security number
avi filesystem
(But I already used that joke once before...)
Jul 6, 2021 09:10
@betseg at least map.entry(c).and_modify(|e| *e += 1).or_insert(1) is some nice syntax
@Bubbler Can we take H 0 e 1 l 1 l 0 o 1?
Uh, no
pre-zipped would definitely be cheating
@AviFS zip it
Jul 6, 2021 09:12
In BF? No thanks!
That's fair though. Had to ask!
@pxeger ^
Well, you can always take input sequentially, come back to start, and destructively handle each pair
@Ausername needs to be in an array
["'"]
and you probably want to put it in the arguments field, not the options
Jul 6, 2021 09:13
it's run as interpreter options code_file arguments
BTW you might want to catch some of those errors...
@pxeger Ok
@Ausername I'm logging them deliberately so you can see why you get a red exclamation mark
in BMG Drafts, 9 hours ago, by AviFS
Draft: Increment every element in the list before or after a zero. (If before & after a zero, you may choose whether to increment once or twice.)
ovs
ovs
Jul 6, 2021 09:16
@Bubbler Dyalog Extended, 8 bytes: {⌈⍣⍺⌊⍵}¨
Clarification: "You'll only receive valid input where valid means no consecutive zeroes."
@ovs Nice :P
@Bubbler Vim again: qqf0b<c-a>2w<c-a>;q9999@q
This actually fails if the first elem is a zero, so it should begin with I <esc>
@Bubbler Jelly, 7 bytes: ¬Ḋ+ŻƊṖ+
The following is the last one:
in BMG Drafts, 9 hours ago, by AviFS
Draft: Match parens greedily and output everything within matched parens. (6(1(35))(78)913578
My filepath: /documents/go_test/33/xyz/ecl/do-stuff-online/index.html
@betseg for(x,y)in... should save 4 bytes
@Bubbler Jelly, 9 bytes: ŒuŒlƬZị@"
CMC: Navigate my filesystem.
Jul 6, 2021 09:25
AV1 Filesystem is off to bed now. Enjoy the tail end and see y'all soon!
@betseg why don't more languages have .0 syntax? It's great
@Bubbler what if 2 consecutive 0s
11 mins ago, by Bubbler
Clarification: "You'll only receive valid input where valid means no consecutive zeroes."
"You'll only receive valid input where valid means no consecutive zeroes."
oh ok thx
Jul 6, 2021 09:30
We're out of CMCs and it's been 90 minutes since start, so the event is officially over. But feel free to post more solutions if you want :)
 
Conversation ended Jul 6, 2021 at 9:30.