@El'endiaStarman Reminds me of discussions of people putting extra parentheses in Scheme programs (I'm a [scheme] gold badge holder, so I read a lot of [scheme] questions). In Scheme, extra parentheses changes the semantics of the program. Some people refer to them as "redundant", which is not correct, so I poke people when they do that. :-P
(On SO, not PPCG.)
e.g., 42 is a number. (42) tries to invoke 42 as a procedure, which is incorrect since 42 is not a procedure. So these would be incorrect parentheses, not "redundant".
All these answers and no Befunge? I'd wager a fair amount it's shortest solution of them all:
1
Not kidding. Try it yourself: http://www.quirkster.com/iano/js/befunge.html
EDIT: I guess I need to explain this one. The 1 operand pushes a 1 onto Befunge's internal stack and the lack of anything...
Indeed, I prefer smallest and fastest...gun in the west. :-P (I just realised that I hadn't responded to your comment for over a year, so I had to say something cheeky. :-P) — Chris Jester-Young ♦Mar 17 '10 at 5:27
To understand my comment, you have to understand that Adam Davis (whom I was replying to) is a big proponent of FGitW.
I was thinking more the fact that the top answer would have come a lot quicker, the joke answers would be deleted, and half of the rest would have "You can golf this further by using one-letter variable names and removing whitespace" comments :P
Starting point is A, end point is B, magenta point is what you get when you reflect over the intersected lines in reverse order (i.e. furthest first). White points are the intersection points ordered from A to B, and the yellow points are the intermediate points in this reflection process, numbered in reverse order.
Green points/numbers are intersection points found, where a lower number generally corresponds to being closer to the center. Cyan points are where the blue point would be if it was reflected across the corresponding green point.
In the case of 2 reflection points, the translational shift is twice the length and in the same direction of the line segment formed by the two points.
If you have 3 reflection points, but go around the loop twice, you end up back where you started.
Write two triangle (i.e. pyramid) shaped programs.
The first one should be an upwards pointing text triangle with a minimum base width of three characters. So it would have a structure like
X
XXX
or
X
XXX
XXXXX
or
X
XXX
XXXXX
XXXXXXX
or larger. Each of the X's is to be replace...
@PhiNotPi Oh, that makes sense now. Reflecting through three points is equivalent to reflecting through one, so doing it twice is just reflecting through that one point twice.
My first thought is 2D languages because I'm lazy, but knowing what happens in these challenges Dennis is probably going to come up with some nice and simple CJam
@PhiNotPi You can drag A,B,C,D around. E is defined by A,D. F is defined by B,E. G is defined by C,F and H is defined by D,G (so these ones won't move even if you try to drag them)
... there are three songs called "Revolution," "Revolution 1," and "Revolution 9." Should you possibly not allow those (or at least the ones with numbers)? Because they could be abused really easily.
... huh, I just I realized I never require block comments ([[ ... ]]) to have the end mark, so [[ without a matching ]] simply comments out the rest of the program. This shall be taken advantage of
Doorknobs provide a worse UX for bears, which can be a useful feature for humans who want to keep bears out.
...elderly and disabled people find it easier to operate doors with handles. But so do bears. In British Columbia, bears have been known to scavenge for food inside cars—whose doors ha...
If you remember back to your schooling years, you might remember learning about Truth Tables. They seemed boring, but they are basis for logic and (some would argue) all computing...
Problem
Your mission, should you choose to accept it is to write a program, function, or widget of code that c...
A crash bar (also known as a panic bar, exit device, panic device, or a push bar) is a device for unlocking a door during emergency conditions. The mechanism consists of a spring-loaded metal bar fixed horizontally to the inside of an outward-opening door. When the lever is either pushed or depressed, it activates a mechanism which unlatches the door allowing occupants to leave quickly from the building.
== BackgroundEdit ==
Following the events of the Victoria Hall disaster in Sunderland, England in 1883 in which more than 180 children died because a door had been bolted at the bottom of...
I have the following data for O-ring failures:
0 1 0 NA 0 0 0 0 0 1
1 0 0 3 0 0 0 0 0 2
How do I construct a table with categories 0 Failure, 1 Failure, and >1 Failures?
I tried using the following codes, but an error occured...
oringfailures <- matri...
I'm really curious what people think of this kind of challenge: meta.codegolf.stackexchange.com/a/7002/9498 . I don't really want to post it if it's not something people would like
@Geobits Collapse-hide. Like, I kinda want to leave a previous Befunge answer viewable once I come up with a better one, though I suppose the revision history will have it.
If you put it in a snippet you could collapse hide it but that would be confusing because the snippet wouldn't be executable but would still have a big "RUN" button on it.
Ouch... I just spent the last 45 minutes figuring out how to compile gtest via g++ such that I can actually use it without waiting 15 or more seconds for compile. Precompiled headers and an object file later, it now takes 6 seconds.
Only 3 this term: Elementary Algorithm Design and Data Abstraction, Algebra for Honours Mathematics and Calculus 1 for Honours Mathematics.
But we moved in ~2 weeks before the start of classes, along with a lot of friends. So, we did as many university students do when they have no responsibilities.. :P
Background
Person of Interest is a crime drama on CBS, and my favorite TV show, as of late.
The show is about a man named Harold, a billionaire programmer, and his partner Reese, a special forces veteran and ex-CIA operative. This programmer created a sentient AI called "The Machine" that predi...
The TAs we had for math classes were all excellent. At least based on my theory, only people who are pretty smart in the first place study math. And the best of them get research positions, where they are also TAs. CS classes were a different matter entirely. It was a very popular degree, and attracted a mixed bunch. And most of the best graduates went for industry jobs, and passed on research/teaching.
Yeah for my math classes, the TAs have all been grad students
For my CS classes, the TAs are people who took the class either the semester before, or two semesters before.
I'm actually still a little bugged that they didn't hire me as a TA for the intro programming class.... The interviewer said I didn't tutor well. The problem was teaching about modulo and I kind of rely on feedback from the person I'm teaching... there was absolutely no feedback...
Oh, I see. I believe our TAs were all at least PhD students, and partly research assistants that already had a PhD. Still, in CS, not all of them were very convincing.
My favorite thing my CS TAs have done is mark me down 10 points out of 100 on a test because they didn't know you could use the ternary operator with L-values.
They gave me 10 out of 20 points for that problem because I "had the right idea"
So I clearly understood C++ better than the TAs...
It could be worse. I got a relatively bad grade in one of my final exams because one of the professors did not understand how the modulo operator worked. Fortunately there was a second professor there, and he confirmed that I was right. It cost a lot of time, and my grade was still bad. They let me repeat the exam, but it ended up hurting my final grade.
The 10% would have affected my final grade, so I pestered my professor about it
It took the entire remaining half of the semester before he finally changed my grade
Meanwhile, I went to ideone.com and gave him examples to show that what I did was valid c++. In all version of c++ that ideone.com had. I also gave him a C example and showed that it did not work.
Probably the thing that bugged me the most about the class was that we were required to use certain header files that the TAs made. The header files all had using namespace std. That bit me a few times. Urgh.
It does seem kind of uncommon to use the ternary operator for l-values. I think I just stumbled over something mentioning it recently. I either never knew it before, or forgot about it. I believe it's legal in C++, but not in C?
@Dennis Yes, that's what I was thinking of immediately, that Martin would have to write a solution for the hexagon challenge in his crazy hexagon language. But the triangular sub-parts might be somewhat problematic, since all his programs need to be hexagonal?
Your score of 9 will be hard to beat by anything. With 7, you only have 32 bytes total, which will be tough for 3 songs of at least 8 characters, and some quotes and control characters.
The only ones I found with obvious parts in common were too short. I think there was "Boys" and "Bad Boys" on the list, but they are both less than 8. I captured a bunch of titles with exactly 8, and they don't have much in common. The ones I know with 8 characters are "Hey Jude" (my favorite), "Michelle", and "Get Back".
Fill in the Blanks code-golf
[Is this a dupe?]
Take a string with blanks
_OD_G___
and insert the given letters
CEOLF
into the blanks like
_OD_G___
^ ^ ^^^
C E OLF
to produce
CODEGOLF
I have an idea for a challenge but I'm not sure if it would be best as a popularity-challenge or code-golf, I'm also not sure what rules I should apply to make it more interesting.
"Convert an image to LEGO safe-colours"
The task is to convert the existing colours from a JPEG image into LEGO-...
I once wrote a question that I thought would attract long complex answers, and it was solved optimally in under an hour, in 13 bytes, ruling out the possibility of any further answers.
The answers that come in give a fairly objective measure of how good a question is. The question I just mentioned seemed like a good one until I posted it, then the answer made clear that it was not...
That's the only time I've posted a question without sandboxing it first. Lesson learnt... :)
The Rugby World Cup starts in a few hours!
Write a program or function which, given a rugby team score as input, outputs all possible ways the score could have been attained in a Rugby game.
Ways to score in Rugby
Penalty kick/Drop kick: Both penalty kicks and a drop kicks are worth 3 points ...
this is what happens when you're not actually interested in a sport and all you know about it is from people yelling HY GAAN A DRIE DRUK from your living room