You are chained to a chair. Underneath you is a huge volcano. A clock next to you ticks ominously, and you see that it has wires leading from the back up to a chain, which will drop you into the center of the earth. Taped to the clock is a note:
Each clock hand has an electrode. When all three c...
Gold Collectors
king-of-the-hill
In this KoTH, the aim is to be the last bot alive. Coins will be placed in random areas, and your bot must get the coins first. If a bot runs into another bot, the bot with more coins wins, and the other bot dies. More details below.
Coin types
There will be 2...
Understandable though: I haven't worked on it for months, it's not as short as other languages, some useful things are missing, and most people are not familiar with such languages
@Adám Your curiosity does not seem strong enough to motivate you to learn it though :p
The major "theoretical" difference is that in Brachylog, all arithmetic uses constraints by default, which makes the language more declarative in a sense
@ASCII-only I'm not an expert, but basically you can see a constraint as a relationship for which you cannot immediatly conclude the result, so you delay it
@Anush Just repeatedly pick 2 random points, and the probability that those 2 lies on the same line (in the result) is at least 1/2. So you only need constant number of tries.
How can one generate a uniformly random $n$ dimensional hyperplane which passes through the origin?
In 2d it seems one can pick an angle at random and draw a line from the origin at that angle. I am not sure what the right thing to do in higher dimensions is.
@Anush I'm beginning to think this challenge is a bit strange. Maybe simplify it to return 10 distinct non-origin points on a random (linear distribution) plane through the origin.
CMC: Given N, return a linearly random point in N-dimensional space where each coordinate is in the range 0 to 1 (inclusive or exclusive as you see fit).
Hello. When you are banned from a given SE website, let us say one year, are you allowed to create a new profile, give up on your suspended profile and never claim your reputation there, is this allowed or not?
ṗ` is Carteasian Power with itself (automatically creates a range) and the last two are shuffle and head respectively. Is it okay to chose the origin at (1,1,1,...,1)? Because this algo generates all coords in [1 ... N].
OK how about this easier CMC. Given two sorted lists of integers, output the intersection of the values in the order the came in. E.g.for [1,2,4,5] and [0,2,5, 23] the output should be [2,5]
I'm pretty new to golfing in R, and this answer I just drew up seems a bit too long - does anyone have any pointers for how to get rid of the multiple function(...) calls?
R, 98 bytes
A function which takes input z and outputs the inverse factorial of that number
f=function(z)uniroot(function(a){integrate(function(x)x^a*exp(-x),0,Inf)$v-z},c(0,z+1),tol=1e-9)$r
Try it online!
Ungolfed and Commented
inv.factorial = function(z){ # Declare function which ...
When you do need to use a function, use pryr::f() instead of function().
Example:
function(x,y){x+y}
is equivalent to
pryr::f(x,y,x+y)
or, even better,
pryr::f(x+y)
Since If there is only one argument, the formals are guessed from the code.
How can you implement the intersection of two sorted lists (with duplicates) without the equivalent of python's append? For instance, how would you do it in C? bpaste.net/show/060ca64397a9 has the code in python
Introduction
Good evening, traders! You are all traders for the golfing company PPCG. Your task is to make as much money as possible.
Challenge
Write a program that buys and sells shares on the Stack Exchange Stock Exchange with the aim of making as much money as possible.
Gameplay
All playe...
what? no, considering what LotM tries to achieve, if done correctly, people in the list would've gotten a few useless pings every day if it was automatic like that
@gnu-nobody Suggestions: - instead of fold make a foldl and foldr version which can also act as fold?1 with a default value 0,[],"" etc. (depending on what it needs), that would be cool - concatmap? - fixpoints (std. fix, fix with an intitial value)? - is partial application a thing? - scan in the same spirit as fold
if you witness the event only when you add my bot, it means something is somehow returning very high values or infinities in my bot, however that's outside my control (I assume everything works)