Posts by Moshi
Challenge A simple challenge: Given a two-dimensional matrix (an array of arrays) of real numbers, compute the determinant. The determinant of a matrix is a mathematical construct used in many ap...
Currently, the leaderboard is useless on alternative-scoring challenges. In order to make the leaderboard more flexible, I propose the creation of two new tags: "lowest-score" and "highest-score"....
I say we follow the established rules on SE: Rather than dealing with inconsistent schemes for adding flags, let's just consider each separate invocation of a compiler/interpreter/whatever a sep...
Challenge This is a simple randomness challenge: Given a non-negative integer $n$, and positive integer $m$, simulate rolling and summing the results of $n$ fair dice, each of which have $m$ sides...
Since there have been some discussions about the use of GCC extensions, I decided to make a default-rules post about it. How should we deal with compiler extensions to languages?
About King of the Hill King of the Hill (KoTH) is a relatively straightforward concept: Entrants create bots; bots compete against each other. Making a KoTH challenge The exact details of the co...
Language + libraries count as a separate language In the header of your entry, you should have something like this: C (clang) + <libraries>, <byte count> You do not need to inclu...
JavaScript (Node.js), 131 bytes Returns true and false g=(s,t,c=[...t])=>([...s].forEach(v=>(y=c.indexOf(v),c.splice(y,y>=0))),c) f=(s,t)=>(x=g(s,t).length)<2&&(y=g(t,s).l...
Yes Unless the challenge tells you what to name your function, you're free to use anything. This means that single character names are usually the best option. Note that anonymous function submis...
How should we deal with golfing libraries when scoring entries? Continuation of Is my extension-like library allowed to be used in answers?, the answer to that question seems to be a "yes", now we...
How should we deal with flags / command line options when scoring entries?
About Negabinary Negabinary means base negative two (-2). That is, the $n$th place value is determined by $(-2)^n$. Negabinary numbers can be evaluated just like any other base system. For exampl...
C, 66 59 bytes -7 bytes thanks to Lundin! In-place string reversal f(char*s){s[1]?f(s+1):0;for(char t=*s;s[1];*++s=t)*s=s[1];} Try it online!
Unless explicitly asking for exactly two values, you may use any truthy/falsey values in decision problems For instance, considering the hypothetical challenge "Determine if a number is non-divisi...
JavaScript (Node.js), 153 147 bytes -6 bytes thanks to Shaggy! a=>a.sort((x,y)=>g(x)-g(y),g=x=>"y gree br sc bla oc pe rub ol v f li go ch m cre c s ro a l ru g pu w p o b".split` `.find...
JavaScript (Node.js), 6 bytes n=>n%2 Try it online! Basically does what you'd expect.
JavaScript (Node.js), 27 22 bytes -5 bytes thanks to Hakerh400 Direct computation f=n=>(n+(n*n+4)**.5)/2 $$\frac{n+\sqrt{n^2+4}}{2}$$ Try it online!
Since no one has posited anything yet... I think everything but the last three bullets can be kept. Other than that, we could add in the tips about challenge specifications. Challenges Posting...
Challenge Given the roots of a polynomial (that is, the $x$ values where the polynomial evaluates to zero), as an array of real numbers, return the polynomial's coefficients. That is, given real ...
Use the unpacking * instead of list If you want to convert an iterator/generator into a list, use the * operator instead of using the list function, e.g. Instead of list(iterable) Use [*iter...
Python 3, 64 bytes def f(n): for i in range(n):print((' '*(n-i)+'_/'+'##'*i)[3:]) Try it online!