Move By Arrows
Lets say I was writing something, and I accidentally wrote it in the wrong box:
+-------+--------+
| Verbs | Nouns |
+-------+--------+
| Truck | |
| eat | Banana |
| | Car |
+-------+--------+
So I, being lazy, merely draw an arrow to the space it should be:...
Calculate the nth Triacontakaitetragon number
code-golf
A triacontakaitetragon (let's TCKgon for now) is a 34 sided polygon. I want you to calvulate the nth TCKgonal number. A TCKgonal number is like a square number or a triangular number, but with a TCKgon.
To calculate the nth number, you ne...
@Geobits when you wake up, could you maybe try to run my julia reference implementation for about 10 minutes to see if it's actually the difference between our computers' performance? julia: julialang.org/downloads
@Rainbolt are you still looking for arguments to use single tips questions instead of answer lists? it would have avoided yesterday's "should we have two lists for different versions of the same language?" discussion.
maybe. I think it's actually quite a nice question, but I couldn't be bothered yesterday to write a submission. although I'm not sure I'd perform much better than the naive solution (mismatches + length difference)
are you gonna write a submission for False Positives? :P
Mine's not nearly as good as the hard-coded ones, although it might be a better use of the remainder of the 10 minutes after outputting those special cases.
I'm still not used to my vote being enough to close, but... Including symbols is irrelevant for most of the answers.
Probably, yes, unless someone comes up with a better way of finding the lattice points at a given radius.
I've done a bit of looking around, but the standard approach seems to be walking around the circle. Most people don't even bother with the Bresenham optimisation.
@MartinBüttner Not on my desktop now, but I can run the Julia version later to see. If you have to bump it to 10 that's not a problem, that's why I left it to be tweaked.
now that we have a floating-point tag I was wondering what we could fill it with (other than N variations of "let's have fun with floating-point inaccuracy). I was thinking what might make an interesting golf is to implement some floating point operation without floating point types. that is, given two integer (whose bits are to be interpreted as floats), return the sum of the two floats (again as a reinterpreted integer) using only arithmetic/bitwise operators.
if that sounds interesting, I'll try to condense the IEEE spec for addition into a sandbox post
Hardware Random-Number Generator
code-golf or popularity-contest, random, hardware
Challenge
Your task is to write a program with the following properties:
It prints either 0 or 1 (and nothing else).
The output depends on a physical process and not just the internal state of the computer.
Th...
The general feeling used to be that a week was a good time to leave it before selecting an answer, because that gave people enough time to start working on one.
But with the increased question rate, 4 days is probably enough.
Surprisingly, we haven't had any challenges on graph colouring yet!
Given an undirected graph, we can give each vertex a colour such that no two adjacent vertices share the same colour. The smallest number χ of distinct colours necessary to achieve this is called the chromatic number of the grap...
now that we have a floating-point tag I was wondering what we could fill it with (other than N variations of "let's have fun with floating-point inaccuracy). I was thinking what might make an interesting golf is to implement some floating point operation without floating point types. that is, given two integer (whose bits are to be interpreted as floats), return the sum of the two floats (again as a reinterpreted integer) using only arithmetic/bitwise operators.
@Flonk I am actually here, but it will also claim I'm here when I'm not. I have an open tab in my browser at home, and I'm still trying to factor Dennis' 512-bit semiprime from the lockers and crackers so I'm not currently putting my home computer to sleep at all.
@PeterTaylor fractional vertex colouring might still be nice for a code challenge, I think... although I don't expect more than two answers for that :D
I'm going to sandbox a tweaked version of the Create Your Wolf KotH and see how many people think it's a duplicate. I think I'll use it as an experiment to see how people react to some of the controversial topics on meta.
I wanted to enforce rules like no duplicates, because King of the Hill challenges (at least the two that I've done) seem to have that problem more than others and they go unnoticed
Dominoes - Total Score: 243 NANDs
ORs used: 61 (3 NANDs each -> 183 NANDs)
NOTs used: 60 (1 NANDs each -> 60 NANDs)
This solution is in dominoes and required a collection of pieces of software I wrote in the course of answering Martin Büttner's two Domino related questions to produce (Golfing...
now that we have a floating-point tag I was wondering what we could fill it with (other than N variations of "let's have fun with floating-point inaccuracy). I was thinking what might make an interesting golf is to implement some floating point operation without floating point types. that is, given two integer (whose bits are to be interpreted as floats), return the sum of the two floats (again as a reinterpreted integer) using only arithmetic/bitwise operators.
(if I still don't get any opinions I'll probably just take it as "nah, sounds boring" :D)
You can fill it with things other than "Let's have fun with floating-point accuracy." If you think it's interesting, then it's interesting to someone. If you flesh out your idea and then post it in the sandbox, you might get better feedback.
(I've tagged the question "C" for the time being, but if you're aware of another language that supports unions, you can also use that.)
Your task is to build the four standard mathematical operators + - * / for the following struct:
union intfloat{
double f;
uint8_t h[8];
uint16_t i...
@VisualMelon it's amazing how much one can love a programming language without having anything to compare it to :D (unless I'm mixing you up with someone else and you do know other languages)
@VisualMelon you wouldn't need to reinterpret/cast/union the integer back to a float
by which I don't mean I know both... I know C++, but I only used vector, string, and the C libraries ;)
(can't stand the C++ IO stuff)
while I'm at it, I also learned Ruby at one point, didn't like it, am subjected to Python all the time and have done work with it, don't like it, and I'm trying to learn F#, I'm pretty sure I don't like it, but it has some things that I wish C# had
@Flonk indeed, but I don't think you can quite appreciate how much I hate it
one evening, the day before my first University exam, my father emailed me saying that one of his websites had broken (I say the day before, it was 12:00 AM)
it's a mangle of PHP and MySQL myself and some friends wrote in the past
an hour of debugging later, I fixed it by adding a space to a SQL query that was never run in a file that wasn't the file where the bug was
after that I drank 250ml of Ingredients Lemon juice, and went to bed
years ago, when JavaScript was much more horrible than it is today, I had a bug which Internet Explorer report to be in a line that wasn't even JS (i.e. HTML). while playing around with it, I noticed that changing the case of a letter in a string (which should not have mattered) changed the line where the bug was reported - to another one outside of the JS code...
@Rainbolt btw my earlier message regarding single tips questions as opposed to lists was completely serious. just in case it seemed like some cheeky stab at yesterday's argument ;)
Yeah TypeScript is cool and these days you can even compile C and Haskell to JS using emscripten, but in the end it's still this oddball JavaScript (which is only as cool as it is because of Google's V8)
the catch to all of this is: it's a desert, and (0,0) is the only water source
and you can only carry k units of water (let's just say 100)
so you can move, leave arbitrary amounts of water wherever you like, and then return to get more water. you can refill to a max of 100 from any of your stashes you run across
each 1-unit move in an orthogonal direction (the only kind allowed), uses 1 water
you're not allowed to run out of water. the object is to reach all of the goals and return to (0,0) in as few total trips as possible
speaking of the horror party, I did write a solution, but my original plan was too boring, and it slowly morphed into something essentially the same as Martin's
@MartinBüttner It was helpful, but I won't be reposting it on meta (along with my own points) anytime soon. It would come across like a personal crusade if I posted it.
@EricTressler I had pretty much the same behaviour as his answer described, just mine was flooded with random numbers with increasingly expensive constraints
yeah, Python 3 works on my machine, but Python 2 just refuses to install
and it was becoming a lot of effort to test something I was probably not going to be happy with
(the fact that my computer hasn't turned off since March might have something to do with it not installing, I'd hate to give the wrong impression here)
I understand. I ought to format my computer, but I can't at the moment, because I'm on a severely limited internet connection and it would take me whole weeks to download and reinstall the things I use on a daily basis
@Rainbolt hm yes, I'd like that too. I guess there's still Peter's "non-challenge questions dilute the front page argument"... but specific tips questions kinda are no different from micro-challenges.
If so, you have all the specifics you need, and can simply say that you've fallen out of it in recent years. He may try to preach you back in, but most will understand that young people fluctuate.
I get that, and while he may privately think you're going to hell, if you tell him you've been confirmed and can speak about it in general, most don't absolutely dismiss a lapse in faith as outright evil.
Fun fact: releasing a dove at the end of the flood comes from the Epic of Gilgamesh, which the Bible basically ripped off (or at least had a common ancestor).
It doesn't change the fact that it happens in Genesis also. In my experience, the most ardent believers are the ones least likely to want to know where it actually comes from.
Lutherans take the Bible as literally as believing that a flood actually happened, but even my pastor admitted that he didn't think it happened like that. Baptists, Methodists, and Catholics take a much less literal approach.
I doubt it would offend many to know that the story was borrowed
If your company name is Genesis and the logo is a dove, the correct answer is "It comes from the flood story in Genesis". At least that's the politcal way to handle it.
@EricTressler Yes. Let the vertices of the graph be n-tuples encoding the amount of water in each cell, the current position, the visited objectives, and the water you're carrying.
It's probably the literal truth as well. When the designers came up with the logo, they were surely inspired by Genesis, not Gilgamesh. So in that sense, the logo does come from Genesis.
I totally meant to edit the obscenity out of my comment, and then I got called away for a code review. Now it's too late. Oh well.
It was taking a while because I couldn't Google the correct term without making my history look suspicious. And I always worry that my company tracks my Google searches