« first day (3205 days earlier)      last day (1633 days later) » 

12:06 AM
CMQ: Is a challenge asking for golfing a minesweeper circuit on-topic?
 
0
Q: Identify the Eeveelutions

Dannyu NDosGah! It's a shame that Pokémon Sword and Shield won't introduce a new eeveelution. Let's mourn them with a code golf. The objective is to, when given a type name as the input, output the name of the corresponding eeveelution. When given Water, output Vaporeon. When given Electric, output Jolte...

 
s/on-topic/interesting/
 
1:07 AM
Any thoughts on this challenge before I post it?
1
A: Sandbox for Proposed Challenges

DJMcMayhemIs it rectilinear? code-golf geometry math decision-problem Today's challenge: Given an ordered list of at least 3 integer 2D points forming a polygon, determine if the resulting polygon is Rectilinear. A polygon is rectilinear if every interior angle is a right angle. The edges do not ...

 
1:20 AM
@DJMcMayhem I think you didn't address xnor's last question: May we assume that input points are distinct?
 
1:39 AM
@Bubbler Yes, I've clarified that now
 
1:52 AM
0
Q: c++ ,mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

user90288Write a program to find the maximum, minimum, and average score of players. The input to the program is a file containing player name and his score. For maximum and minimum scores, your program needs to output the name of the players along with their scores. Use functions to calculate average, mi...

 
2:32 AM
0
Q: Is it rectilinear?

DJMcMayhemToday's challenge: Given an ordered list of at least 3 unique integer 2D points forming a polygon, determine if the resulting polygon is Rectilinear. A polygon is rectilinear if every interior angle is a right angle. The edges do not necessarily have to be purely vertical or horizontal (par...

0
Q: Extract all keys from an object (json)

chau giangDescription Given an object (json), write a code to extract all keys from it. Rule: The object can be nested. The object can contain array and if it contains array you will use the index of each element as a key. Output can be a list with any format but it is prefers line by line. Shortest by...

 
 
3 hours later…
A _
5:16 AM
CMC: c++ ,mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm Write a program to find the maximum, minimum, and average number of a list.
 
5:32 AM
->a{[a.min,a.max,a.sum/a.size]}
 
 
1 hour later…
6:59 AM
@A_ Dyalog APL Unicode, 10 bytes: ⌈/,⌊/,+/÷≢
 
CMC: [tag: quine] Write a program that prints its own source upside down. Character mapping here
 
ngn
@Jono2906 a non-empty program :)
 
@ngn Of course.
If one's program is ABC, it should output ∀𐐒Ↄ
And if one's program is (for some reason) ∀𐐒Ↄ, it should output ABC
 
ngn
() - this should work in some languages
[] or {} should work in others
 
I guess someone should do it in Brain-Flak
 
A _
7:10 AM
@Jono2906 Keg, 1 byte: O or 0 (zero works in more langauges)
 
ngn
@A_ 0 isn't in the mapping
 
A _
@A_ O isn't in the mapping
@ngn Umm, I guess () up-side down is )(
 
> If one's program is ABC, it should output ∀𐐒Ↄ
 
A _
69
 
So essentially the entire code rotated 180 degrees.
Yeah 69 is valid in many languages
 
A _
7:15 AM
But it becomes 96 in the mapping...
 
I mean, apply the mapping then reverse the result.
Oh
 
A _
Oh I see!
 
I can't read
you're right
 
A _
I thought I realized it...
 
() should become )( indeed
and 69 to 96
 
A _
7:17 AM
@Jono2906 What do we do with characters not in the mapping?
 
Hmm..
 
A _
@Jono2906 Or are you willing to change the test cases to reversing the string after turning it up-side down?
 
ngn
@Jono2906 in the cmc you say "prints its own source upside down" but your examples suggest printing individual characters upside down, not the entire source
 
upside down can mean reflected as much as it can mean rotated
 
ngn
@UnrelatedString B and C are rotated there
 
7:29 AM
Huh
So yeah your complaint is very valid
 
@ngn that's what i meant by upside down
So i guess it's more flipped than upside-down
 
7:47 AM
In J or APL ,''',,,' gives ',,,
 
 
2 hours later…
10:09 AM
hello!
 
A _
hello!
 
hello!
 
:)
 
A _
:)
 
having had a sticky start, I now really love the answers to my two questions
I just wish people hadn't been so grumpy at the start!
 
A _
10:15 AM
I don't like everything I made; this feeling (loving the answers to questions) is a bit weird to me.
 
@A_ I didn't understand "I don't like everything I made"
what do you mean?
 
A _
having had a sticky start, I now really love the answers that are not my answers
I guess I will be changing my username to Well, if usernames allow commas.
(This will make pings sound a bit more natural.)
 
2
Q: What is my volume?

A _Given an input integer, output the volume corresponding to the value. The value will always be in the range \$[0,100]\$. Examples If the input \$=0\$: _/| | |\/ |_ |/\ \| If the input \$>0\$ and \$<33\$: _/| | |\ |_ |/ \| If the input \$\ge33\$ and \$<66\$: _/| \ | |\ \ |_ |/ ...

 
A _
(Imagining "Well," joining a room makes me laugh)
2
@Well... I didn't understand "I don't like everything I made"
2
 
10:37 AM
@Well, i guess we won't know what it'd be like unless someone tried it!
 
A _
@Well, there is enough star-spamming in the starboard. I will not be starring more messages.
 
A _
10:57 AM
CMC: What is the code point of unicode gibberish? Inspired by this question. Given a non-ASCII string, output its Unicode code points for all of its characters.
(Intended as a joke; this is extremely trivial.)
 
@A_ APL: ⎕UCS
 
A _
@A_ "What is the point of unicode gibberish?" is the question title (for those who don't want to click the link)
 
@A_ I think we may have crossed wires. I don't fully understand your summary of what I said
2
 
11:47 AM
but in general, I was just expressing happiness at the awesome of CGCC :)
what is the current abbreviation for this site? It used to be ppcg
 
A _
The current abbreviation for this site, which used to be PPCG, is CGCC.
 
thanks!
I really love how active it is and the quality of the answers
 
 
2 hours later…
1:35 PM
challenge idea: given a rectangular grid with a few numbers in it, output a partition of the grid into rectangular components where each component contains exactly one number in it which is the component's size in grid spaces
have we had anything like that yet
 
ngn
Shikaku (四角に切れ, shikaku ni kire) (also anglicised as Divide by Squares or Divide by Box) is a logic puzzle published by Nikoli. As of 2011, two books consisting entirely of Shikaku puzzles has been published by Nikoli. == Rules == Shikaku is played on a rectangular grid. Some of the squares in the grid are numbered. The objective is to divide the grid into rectangular and square pieces such that each piece contains exactly one number, and that number represents the area of the rectangle. == See also == List of Nikoli puzzle types == External links == Nikoli's English-language page on Shikaku...
 
oh ok
yeah I saw a variant (or maybe it was just this) in a magazine and i thought it could make a CG challenge
 
ngn
@HyperNeutrino sounds like a good idea, especially if you can prevent short but super slow solutions
 
Hmm, wonder how weird Shikaku gets if you cut the rectangular partition requirement
 
@ngn wdym by that; ?
 
ngn
1:54 PM
@HyperNeutrino either that, or code-golf with restrictions. idk for sure, but it looks to me like a bruteforce solution would win the golf, and we won't be able to see its output
this is a general issue with code golf
 
yeah, I agree
like I definitely don't want someone to just win with a "create every single possible partitioning in existence" and have an O(n^1000000) sol that nobody can even observe
but at the same time I personally prefer as my winning criterion whenever possible
 
0
Q: Print all the ways to aquire specific number using only specific numbers

Sheyko DmitriyLet's say we have some arbitrary number: For example 25. We also have some "tokens" (poker chips, money, something similar) with different values. Values of tokens are 2; 3; 4; 5. "Tokens" are limitless You need to achieve number 25 using exactly n tokens (for example, 8) and to output all p...

 
2:14 PM
@HyperNeutrino Don't we have a standard solution for this: require the answerer to run the program on all test cases before posting
 
@feersum That makes sense. I don't think in my (albeit limited) experience I've encountered that in any questions, so I'm not sure if it's a standard, but I probably just haven't heard about it.
 
Perhaps, we always posted this in chat but no one remembered to actually write it in a challenge.
 
Hm. I'll think about that then. In the meantime I've thought of a simpler challenge that I think I'll post instead that's based on a similar idea.
 
2:49 PM
1
Q: 1D Shikaku Validation

HyperNeutrinoShikaku is a 2D puzzle. The basic rundown of it is that a rectangular grid has some numbers in it, and you want to partition the grid into rectangular components such that each component contains exactly one number which is the number of grid squares in that component. This challenge involves a ...

 
3:15 PM
@NewMainPosts Hmm, I feel like this simplified rule set seems a bit of a dupe but I can't put my finger on it. Possibly one of the Jimmy challenges
The number constraint should make it different enough though
 
3:48 PM
@A_ PowerShell, 50 bytes -- param($l)($l|sort)[0,-1];($l-join'+'|iex)/$l.count -- Try it online!
Oh, wait, you said maximum then minimum. In which case, reverse the order of [0,-1].
 
4:32 PM
0
A: Sandbox for Proposed Challenges

KrishnaEmma and the Square Numbers Get Minimum Unique Sum We define a square number to be an integer whose square root is another integer. For example, 1,4,9, and 16 are all square numbers as they are respective squares of 1,2,3, and 4. Emma has two integers, a, and b, and wants to count the number o...

 
5:00 PM
CMC: Given 2 strings s1 and s2 and a positive integer n, replace every occurrence of s2 in s1 with the first n characters of s2
 
Woah, wasn't I just talking to you in a different room? Where'd you come from? :P
 
I'm sorry Jon comics are the worst
 
@DJMcMayhem I have to disagree with you there :P
 
 
1 hour later…
6:17 PM
Hello! I'm new to the SE chatrooms, and was wondering if this is the right place to ask for an explanation of someones solution to a code golf?
 
@DrewAtWork Sure!
 
Awesome! Whats the best way for me to link to the Problem/Solution?
 
There should be a button labeled "share" underneath the answer
So this should explain part of it: Try it online!
VFULJSGEalmeoylspaballaporrftvc is just the beginning of each eeveelution interlaced
 
Looking at this python solution, I understand what the code is doing and how. The part that eludes me is the "%3695". How did they decide on that number? Is it a common modulo for ascii strings? Is it just a random number? Was it figured out with brute force?
 
I'm guessing brute force
That's just some arbitrary magic number where each input gives a unique number module 8
 
6:33 PM
With how quick a lot of answers that involve switch-like string indexing popup, I'm assuming Arnauld and probably Jo have brute force scripts at the ready
 
Interesting...
 
@Veskah Although that answer was posted by neither of them
 
"Fir" gives Leafeon
smart!
 
Which falls under All other input falls in don't care situation.
 
But it makes a good joke
 
6:37 PM
Oh, I missed that XD
 
How often do people brute force a part of the program into a constant? Is that a common part of golfing?
 
Depends on the task I suppose
 
@DrewAtWork it's common for challenges that involve mapping a finite input set to some outputs
 
That makes sense.
 
Pretty much what dazima said. For fixed output, you'll see a lot of gzip-esque compression routes taken instead.
 
6:45 PM
the more general idea is using a perfect hash, modulo by a constant is just a very short way to do that
 
It feels so backwards turning something generic into a narrower compressed function haha.
But its a really impressive skill to learn.
Thanks for the help! :)
 
Also, interlacing the strings like that is a really common trick too: codegolf.stackexchange.com/a/141677/31716
Oh wow, and this is a crazy impressive brute-force answer: codegolf.stackexchange.com/a/141693/31716
 
interlacing strings has been in the python tips for >8 years :D
 
7:15 PM
0
A: Sandbox for Proposed Challenges

Sumner18Sort and Table a Sentence by Word Lengths Title seems pretty self explanatory. I can't seem to find if this challenge already exists, but here goes. In as few bytes as possible, sort a string sentence into a table. I tried to make the table rules as code friendly as possible. Input will be a s...

 
7:34 PM
0
Q: Currency exchange

Ryan BurrowYou are starting up a cryptocurrency exchange website which supports conversion from USD to two currencies, foo-coin and bar-coin. Write a program that takes the exchange rate for each coin to USD as arguments and outputs the maximum value of USD that cannot be completely divided into the two cur...

 
 
2 hours later…
9:57 PM
0
Q: Shortest Checkerboard code using tkinter?

Jacob LongThis is just for a friendly competition Requirements: height and width must be at least 100 pixels so that it is comfortably visible. Make an 8 x 8 checkerboard inside this area. must be one line Here is something that I've come up with 1 line, 207 characters from tkinter import*;c=Canvas(Tk()...

 
CMC: A pristine quine. Standard quine rules apply
 
10:19 PM
0
A: Sandbox for Proposed Challenges

caird coinheringaahingPristine Polyglot Quines As the title says, you are to create a pristine program which outputs its own source code in as many languages as possible. A pristine program, taken from here is: Let's define a pristine program as a program that does not have any errors itself but will error if you...

 
 
1 hour later…
11:29 PM
guys
I'm not sure what to think about the currency exchange problem; I dupe-closed it because it is just a reduction of the other one but there is the solution of F(a,b)=(a-1)(b-1)-1 which isn't an inductively extendable solution to the general Frobenius problem
however I feel like since all solutions posted there would transfer here, and the simplified algorithm is rather trivial, I'm not certain it warrants a new challenge
Don't use the hammer often so please let me know if you think this was the wrong call
 
A _
@cairdcoinheringaahing You may copy answers from here.
@cairdcoinheringaahing I guess mine is simply space+_, although I am trying to golf the space out of my username.
 
1
Q: Am I being run backwards?

Redwolf ProgramsYour task is to write a program, function, or snippet that will output one value if run forward, and another if run backward. The program must run without errors. The output can be any two distinct values, of the same data type. For example, 1 and 3, true and false, or 't' and 'f'. In languages ...

 

« first day (3205 days earlier)      last day (1633 days later) »