@DJMcMayhem int f(int a,int b){return(b&-!(b&1))+((b+1)&2)/2^((a-1)&-(a&1))+(a&2)/2;}
Or if they're nonnegative, int f(int a,int b){return(b&-!(b&1))+(b+1)%4/2^((a-1)&-(a&1))+a%4/2;}
int f(int a,int b){return(b%2?0:b)+((b+1)&2)/2^(a%2?a-1:0)+(a&2)/2;} int f(int a,int b){return(b%2?0:b)+(b+1)%4/2^(a%2?a-1:0)+a%4/2;} // nonnegative only
Solve the Catalan Conjecture!
Let's say we have a number n, if it's even n = 2*n and if it's odd n = 3*n+1
For example:
10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1
you stop when you reach one because it will loop forever after that: 1 -> 4 -> 2 -> 1
Input
any natural number.
Your code can be a f...
@Deadcode The yarn on a 3x3 cube starts at the center, spirals around the top face, then spirals across the outer faces down to the bottom face, until it reaches (0,0,-1), then goes to (0,0,-2)
@lirtosiast Would it be acceptable if it covered faces using a back-and-forth snake pattern instead of a spiral? Its Chebyshev distance would still be nondecreasing.
The consistent attitude with regard to the golf language situation is that for every challenge, each language is a category, and subsequently there is a 'winner' for each language. This is also a very very popular opinion with regard to the new user experience.
There is a problem with this idea...
I was just awarded +100 reputation on all of my Stack Exchange accounts.
What is this bonus for? It simply says "Association Bonus" on my reputation overview.
Return to FAQ index
TL;DR: when you reach 200 rep on any site on the network, all your accounts on all sites get +100, because reaching 200 rep is a decent sign that you know enough about how SE works to not need the training wheels of <100 rep on any site
Super Permutations
Find the super permutation for a set of size n. A super permutation of a set is one string that contains all permutations of that set. Here is a helpful video by Matt Parker
Example
For a set of size 2 all the permutations are AB, BA but the super permutation is ABA because ...
Write a simple python script that plays the system sound from windows speaker even if earphones are connected.
For example, you should be able to play music from windows speaker and should be heard by someone who is not wearing the earphones connected. This should disable the earphone functional...
windows-system was just created for a question put on hold as unclear, and I see no reason to have OS-specific tags. Indeed there are none for any other OSs.
there is a challenge where the point is for the code to find the answer
there is another challenge, the one I had in mnid, where the answers are precomputed and the challenge is to make the code including the answers as small as possible
queue=[{state = <input>, depth = 0}]
while queue not empty:
state, depth = queue.next()
if state is checkmate: print(depth) and exit()
foreach move in validmoves():
newstate = state.apply(move)
queue.add({newstate, depth+1})
I tried using the function "Correlation" on mathematica but it says that it measure Pearson's correlation coefficient:
Correlation[Flatten[Vertices1], Flatten[Vertices2]]
where Vertices1 and Vertices2 are vectors of the vertices of the two 3D objects.
The most recent wave of fake news spread through facebook and messaging apps have forced the Brazilian Intelligence Agency to publish a note telling people that they did not, in fact, arrest venezuelan and cuban terrorists for sabotaging the recently ruptured dam in MG.
I mean people are so desperate to blame everything on the left that they just spread this kind of misinformation and get people killed because of it.
Sorry for the political rant in TNB but goddamn does that make me mad.
Binary UTF-8 quine
quine code-golf kolmogorov-complexity
Your task, if you wish to accept it, is to write a program that outputs its own source code in the binary UTF-8 representation.
Rules
You must build a full program. That is, your output has to be printed to STDOUT.
The source must be ...
Whilst trying (and failing) have persuade my infant son to eat his dinner, I tried singing to him. Mid way through this song I realised the formulaic structure might lend itself well to code golfing!
The task is to write a program or function which accepts no input and produces the following tex...
Is the following best suited for CMC or main? Given two arrays recursively consisting of strings and such arrays, determine if they are "compatible". Compatibility is defined as having the same structure and all corresponding strings have the same length (though the content may differ. E.g. ["abc",["ab","de"] and ["azz",["ab","xy"] are compatible while ["abc",["ab","de"] and ["az",["ab","xy"] are not.
Maybe even more interesting to allow numeric values too?
CMC - code-golf Implement Jelly's X feature. "Choose a random item from z if z is a list, or from 1 to z inclusive if z is a positive integer. If z = 0, return z. Error if z is negative or a decimal." No peeking at Jelly source code.
also, you haven't really described X completely apart from copying it from the wiki... what should it do when given a single character? (A: it should error)
no, it means they're able to contribute, and, well, unless the repo's owner has some sort of problem, they'll most likely welcome or amend your contributions
of course, that's not always the case with private repos
in fact, a very important reform in Jelly's history was done in part by dylnan
Nice. PowerShell has ... verbose, let's call it ... error messages. The challenge from a while back had PowerShell I think in the lead for longest error. I mean, even things like ARNOLD C and Shakespeare were easily beating it.
@lirtosiast I like that. Even better than a challenge for a specific spiral. Looking forward to seeing what approaches emerge. Also looking forward to the follow up challenges using one of the spirals provided to set more extensions of the trapped knight / wildebeest challenges
@EriktheOutgolfer Yes I've been wondering what the moves would be. The knight's move in 2d can be described as any square at a distance of the square root of 5 from the current square, so maybe that kind of description would be the easiest way to unambiguously describe the moves of a piece that moves in 3d
I'm working with a repository with a very large number of files that takes hours to checkout. I'm looking into the possibility of whether Git would work well with this kind of repository now that it supports sparse checkouts but every example that I can find does the following:
git clone <path>
...
The AI is is reading Code Golf and thinking, "hahaha not even close to the most efficient, suckers!!", "It took you that long to figure out how to get it down to one byte? hahaha"
Do you think the AI is doing that?