Okay, so, there's a really old question on Huffman encoding, which asks for a Huffman tree. What I had in mind was that programs would compute the Huffman coding and then output each character along with its binary representation, sorted from shortest/most frequent to longest/least frequent. Are these different enough that they wouldn't be duplicates?
"_ಠ" pushes the two characters on the stack, but in reverse (so it's [ಠ,_]). nD takes an integer from input and duplicates the top of stack that many times ([ಠ,_,...,_]). 0c copies the first element of stack ([ಠ,_,...,_,ಠ]). (O). outputs it all.
if you do implement this, I think this should pop the block and the variables. it wouldn't be consistent with :variable, but I think it would likely be the more common use case.
@aditsu for functions, I do, because why would I define them before I need them. but for other values, I often don't... it's true though, both cases happen.
we really need a way to get proper usage statistics of our golfing languages :D
Hmm. Actually, answers using (...$) will continue working normally because now $ doesn't modify ).
I made this change because it seemed a bit silly to have to use (...$) in most useful situations, with (...) being useful primarily for outputting the whole stack.
Hence, I now also have $O, $N, $o, and $n as output stack as characters, output stack as numbers, read in all input as characters, and read in all input as numbers, respectively.
Incidentally, "Hello world!" is shorter in Minkolang now. :P
Regarding math functions, I think I'm going to do something like where 4M is mean and 4$M is standard deviation. This lets me build in a bunch of math functions without using up all the rest of the un-assigned characters.
And I'll do the same with T for trig. 1T is sine, 1$T is arcsine, 4T is atan2, and so on.
Dilemma: can't decide whether to make it absolutely shortest or natural and easy to remember. Solution: make it both non-short and difficult to remember.
I know that a good answer to the FizzBuzz test would NOT be to make the shortest possible piece of code, but just for fun, I tried to do just that anyway. In playground in Swift 2, I have the following working code:
for n in 1...100{print(n%3*n%5>0 ?n:(n%3>0 ?"":"Fizz")+(n%5>0 ?"":"Buzz"))}
75...
I disagree with your note: it's the same question which for the existing answers requires a simple transformation of output format, and moreover any answer to this question is automatically an answer to the previous question. — Peter Taylor4 hours ago
@PeterTaylor Maybe this would be a good time to close an old question as a duplicate?
There are only five answers on the old question, and after a quick glance the new challenge's spec seems a lot better.
Hi I'm having trouble retrieving distinct dates from a database. In this database I have several events on any particular day and results show a list of events with the same date / 'StartDate' field. How could I retrieve just the distinct days. I've tried:
ICollection result;
result= client...
@Optimizer sure. both imperative, both C-family syntax, both with an almost identical set of control structures... certainly makes them similar enough to warrant a comparison when talking about goto/continue/break.
Question
If you are currently on a cell with a value x, you can move to any
cell in the same row or column, provided it has a value y such that x >
y. This move is called a switch.
The input consists of:
two integers 0 < m,n < 50
an m by n grid filled with integers in the range -128 ...
Question
If you are currently on a cell with a value x, you can move to any
cell in the same row or column, provided it has a value y such that x >
y. This move is called a switch.
The input consists of:
two integers 0 < m,n < 50
an m by n grid filled with integers in the range -128 ...
Anyway, ghosts is a regular over at Puzzling, and I haven't noticed him pasting copied content before. It's possible, but I'd give him the benefit of the doubt unless you can google it.
@Geobits It's only explained at the very end in the "condition". Red cells are potential starting points for paths. You're supposed to find the minimum number of such starting points such that any cell can be reached in no more than k steps ("switches")
I wonder if it can be solved greedily. the maximum cell(s) of the grid obviously have to be red. now flood fill k steps. if there are cells left, again turn the maximum remaining cell(s) red and flood fill again. etc.
hm, probably not
the first step is valid, but the second one not... it might require fewer red cells to add a red in the flood-filled part, which can reach the maxima of the remaining cells.
yeah, counter example:
5 4 1
1 3 2
1 2 1
k = 2
greedily, you'd turn the 5 red. flood fill reaches everything except the 2s. and the bottom-right 1. greedily you'd now use the 2s giving a score of 3 reds. but turning the 3 red instead, you can reach all of the remaining cells as well.
Well, I suppose you can always solve it as a set cover problem, but that being NP-complete, I'm not sure it would finish in a reasonable amount of time for 2500 sets.
Some time after this incident…
There are some of us who are against this defiling order of jQuery. It is an unholy presence, of which must be exterminated. I therefore call on you, the loyal to The New Kingdom of Reformation, to create a program that will eliminate such resistance. All code must...
(System.console().readLine()==~"[jJqQuUeErRyY\$x0]"?{print"This programmer is guilty of Heresy. He must be burnt."}():{print"Program validated. Clearance level 2 given."}())
I'm thinking it has something to do with Groovy's ==~
"Finally, the ==~ operator is a quick way to test whether a regex can match a string entirely. myString ==~ /regex/ is equivalent to myString.matches(/regex/). To find partial matches, you need to use the Matcher."
shortest fix is "[^jJqQuUeErRyY$x0]+" and switching the roles of true and false
Gambda: an important useless operator
Input
A list of 1 to 255 positive integers, each in the range 1 to 231.
Output
A single integer.
The output can be calculated however you wish but much match the result of the following calculation:
Each input integer is converted to a 32 digit binary ...
@trichoplax and I even resisted writing one when I first saw it ;)
@Dennis @Optimizer CJam mini challenge. array of numbers on the stack, turn it into an array containing only the minimum and maximum of the array (in any order. feel free to keep duplicates)
TI-BASIC, 10 tasks in 677 bytes
Download all as a TI Group file (.8xg)
(Spoiler tags added per request.)
Task 1 - Can Three Numbers Form A Triangle? - 7 bytes
Task 2 - Closest To One Million - 114 bytes
Task 3 - Simple Keyboard Simulator - 131 bytes
Task 4 - FILTHE Letters - 34 bytes
...
The video game Transistor features a very interesting ability system. You collect 16 "Functions" which you can use in 16 different slots. What's interesting is that there are 3 types of slots and every Function behaves differently according to which slot you use it in:
There are 4 Passive Slots...
@Dennis I was going to suggest that earlier today (actually, I thought about two degree/radian conversion operators... your idea is much better though)
@aditsu Looking at the earlier $_,(%, I think defining 0% as 1< would probably be consistent behaviour.
This doesn't add anything to xnor/FryAmTheEggman's shorter solution lambda x:x.translate(None,(x[0]*2).title()), or the 61-byte solution that was already posted above. I recommend deleting this. — Thomas Kwa2 days ago
I do point out duplicate answers if they are exactly the same solution (+/- a few irrelevant details) but if not, I don't see anything wrong with them.
@CᴏɴᴏʀO'Bʀɪᴇɴ Please stop adding bonuses to your challenge. I already revised my code once to get the -90% bonus, now I'd have to edit it again to stay competitive...
I've been getting a lot of grief lately about posting Python answers after other users have already posted a Python answer. Not only do I come up with these independently, they sometimes are shorter/different solutions. I'm getting really tired of this bullying.
Sources:
http://chat.stackexchan...
Prompted by this comment.
The scoring of optional flags passed to compilers/interpreters has already been handled here and here. However there is another case of one more level of indirection. Specifically compilers/interpreters for some languages may themselves be built with extra options t...
If there is corresponding assembly, then the assembly character count should be the score. My 'c' compiler may be able to reduce reduce y=m*x+b; into a single instruction word, but I stil get dinged for 8 characters. You should be scored on the language you write in, not your compiler's output. (Unless you really are writing in raw binary...) — AShellyJan 31 '12 at 19:31
@Geobits This in turn is why we should continue promoting challenges as competitions within each language... then it no longer matters how the language is encoded.