comperendinous
  • Member for 7 years, 6 months
  • Last seen more than 7 years ago
Stack a random number of cups into a perfect two dimensional pyramid (triangle)
7 votes

Haskell, 64 68 This works out the base directly by inverting the triangular number formula, t = (b^2+b)/2, and calculating b = (sqrt(8*t+1) - 1) / 2. f n=init.tail$show(b,div(b^2+b)2)where b=floor$(...

View answer
Programming Dichotomies (Literally)
6 votes

Haskell, 117 Having to work with Haskell's functional paradigm means that everything has to be assigned to a variable or commented out with line -- or block {- -} comments; having nonsense functions ...

View answer
Four-Man Standoff
5 votes

Straight Shooter He's a trained part of the cavalry and talks in many languages but, being blinkered, Straight Shooter can only see the one enemy in front of him. Being a horse, he doesn't understand ...

View answer
Caveman Duels (or: Me poke you with sharp stick)
5 votes

Prison Rules, Haskell Cavewoman think caveman and other caveman should talk, share stick. But, hey ho, if must fight, fight prison rules. Find boss and attack. ViceLeader Alpha Caveman now; that who ...

View answer
Rosetta Stone Code Challenge
Accepted answer
4 votes

424 425: Haskell, Python 2, Perl As they should for a true Rosetta comparison, all three programs work the same way, taking input from the first command-line argument and building up the list with ...

View answer
Crop an image to a square
4 votes

Parsing the raw bytestream: Haskell (319 = 332 - 13) Without any imports at all, this program crops P1 PBM images. g _[]=[] g z x=(\(a,b)->a:g z b).splitAt z$x q=map f=filter main=do c<-...

View answer
The Real Slim Shady
3 votes

Perl, 161 164 bytes Not quite as short as squeamish ossifrage's answer, but I wanted to share the CamelCaseCompression, which no one else has used and allows the removal of many spaces and quotation ...

View answer
Four-Man Standoff
2 votes

Darwin Survival of the fittest means the least healthy must die. Rationale Looking at the batch of results from Tuesday (12th), there seem to be three distinct groupings: survivors; the effectively ...

View answer
Four-Man Standoff
2 votes

Twenty-Fourth and a Halfth Century This Python entry ducks and dodges until only passive players or a single aggressive player remains, then starts shooting. It hopes a passing martian takes care of ...

View answer
Crop an image to a square
1 votes

Perl, 276 287 (289 300 - 13) Regex to the Rescue! Who needs dedicated image functions when you have regular expressions? (And 1-bit images to crop.) local$/;open I,"in.pbm";$_=<I>;s/(...

View answer
Tuning Strings­
1 votes

Python 3: 175 import math def t(b,s):l=len(s)-1;n=12*math.log2(b*l/(l-s.index("X"))/16.35);m=round(n);return"%s%s%+d"%(("C C# D D# E F F# G G# A A# B".split()*99)[m],m//12,round(100*(n-m))) Ungolfed:...

View answer
Four-Man Standoff
1 votes

Hippolyta This Amazon Warrior Shooter, like her namesake, is destined to be slain. Since we now have an S0, an S1, and an S2 bot, for completeness, here's an S3 bot to see if the position of the ...

View answer
Crop an image to a square
1 votes

Clojure, 320 (333 - 13 for filenames) Deciding to sidestep types, this P1 (ASCII) PBM cropper is written in Clojure. With function names like interpose, read-string, and clojure.string/replace, it's ...

View answer
Compress and Decompress sentence using vowel based encryption cipher
1 votes

Haskell: 119 = 111 + 8 Since there's no restriction on the key, I'm going agile and not getting any more complex until someone has a shorter answer: e t=(unwords.map((\(a,b)->filter(not.(`elem`['...

View answer
Programming Praxis - Survive like Flavius Josephus
1 votes

Haskell, 79 83 characters I still think mutable state could triumph if this is reopened, but recursion holds its own for now. Edit: Following proud haskeller's suggestions shaves off another 4 ...

View answer
Program your favorite phrase
0 votes

Perl, 43 56 print substr'Mine was not Red 5!',4*$i++,4; I accept that I can't win this one. My original attempt explains why: @a=('This',' code',' is',' too',' long.');print$a[$i++];

View answer