400th Question Celebration/Challenge

7

I just looked and saw that there are 399 questions on this wondrous "Programming Puzzles & Code Golf" site!!! That means that...THIS IS THE 400th question!!! To celebrate this momentous occasion, here are your goals:

  1. Write a piece of code that is EXACTLY 400 bits.

    • That's right...BITS!!!
    • For the risk of redundancy and the sake of clarity, that's 50 bytes!!!
  2. Because this occasion is so extraordinarily meaningful, each bit and therefore each byte must also be meaningful!

    • In other words: You can't just name a variable aaaaa because you needed 32 extra bits to get to 400. However, you can rename it to party as long as that is a meaningful name for that variable.
  3. Your program must do something appropriate (not necessarily output something appropriate) to celebrate this grand occasion!

    • For example: You could choose to make a program that outputs 400. However, I must needs state that although submitting code that does only that would meet this requirement, it would also be like celebrating your birthday party at home by yourself sick in bed. At least you celebrated, but hey: You can do better!!!
  4. The most creative code wins!!! In this case, creativity will be measured by votes.

  5. This contest will last until 400 users have viewed this question. If there is a tie when the 400th user views this question, the contest will go into sudden-death overtime until there is a clear winner


Oh, and lest I forget...HAPPY 400th QUESTION!!!

Briguy37

Posted 2011-08-12T20:21:55.783

Reputation: 2 616

Question was closed 2016-11-21T10:58:32.303

1I'm closing this question as off-topic because rules 2 and 3 do not constitute objective validity criteria. – Martin Ender – 2016-11-21T10:58:32.303

@MartinEnder I would have closed as too broad instead. – Erik the Outgolfer – 2016-11-21T11:45:37.723

I added the tag code-shuffleboard, as someone suggested on meta.

– Joey Adams – 2011-08-12T22:50:01.470

it's not the 400th question anymore :( – ratchet freak – 2011-08-13T02:15:09.590

20 Users to go! Get your votes in! – Briguy37 – 2011-08-24T18:18:38.723

2I think I'm the 400th viewer. – zzzzBov – 2011-08-25T18:35:46.437

Wow, looks like this thing is going into sudden death overtime: In corner 1, weighing in at 7 votes, we have cemper93 with his triumphant triangle wave, and in corner 2, also weighing in at 7 votes, we have user unknown with his bodacious birthday candles! Let the death-match commence! – Briguy37 – 2011-08-25T18:55:15.660

Answers

10

Python, FOUR HUNDRED bits

i=0
while 1:print" "*(i%8>3 and-i%4 or i%4),0;i+=1

At first I wanted to make a sine scroller, but there was no place for the import. Now you get a bugged triangle wave. ~~~party~~~

cemper93

Posted 2011-08-12T20:21:55.783

Reputation: 670

Fixed version: while 1:print" "*[i%8,-i%4 or 4][i%8>3],0;i+=1 – JBernardo – 2013-12-30T00:11:48.510

8

Brainf*ck

[-]>++++[<+++++++++++++>-]<.----..---------------.

And the output will be: 400!

JBernardo

Posted 2011-08-12T20:21:55.783

Reputation: 1 659

7

Ruby

1.upto(side=gets.to_i){|i|puts (?**i).center side}

This creates a wobbling tree, like the following:

   *   
  **   
  ***  
 ****  
 ***** 
****** 
*******

Lowjacker

Posted 2011-08-12T20:21:55.783

Reputation: 4 466

7

Scala gratulates with 400 Bits:

(1 to 400).map(x=>print("""
 ,
|_|
"""))

Sample:

 ,
|_|

 ,
|_|

 ,
|_|

 ,
|_|

... due to restrictions, I couldn't light bigger candles. I try to compensate with the scheer number.

user unknown

Posted 2011-08-12T20:21:55.783

Reputation: 4 210

By my count that is only 304 bits (38 Bytes). This question will have to take a DEEP breath to blow out all these candles, though...Nice! – Briguy37 – 2011-08-15T15:30:00.097

You're right, I picked the wrong variant, which only had 39 Bytes (38?), but had the problem, that the lower candles melted the upper ones. We absolutely need a bigger vertical distance to prevent London-like-lightenings. – user unknown – 2011-08-15T16:13:44.023

1Here's a variation with 400 bits and 400 candles in a square: for(i<-1 to 20;x<-Seq(" , ","|_| "))println(x*20) :) – Luigi Plinge – 2011-11-20T02:48:05.917

you lost a blank: for(i<-1 to 20;x<-Seq(" , ","|_| "))println(x*20) - oh, I lost it too! A bug? – user unknown – 2011-11-21T12:19:38.273

5

JavaScript, 400 bits

Code

for(i=0,a='';i<400;)a+='\n!'+i++;alert(a+"\n400!")

Output

!0
!1
!2
!3
..
..
!398
!399
400!

Or, how it is read in English: "not 0, not 1, not 2, not 3 .. not 398, not 399, 400!"

Update

Just realized I forgot to attach the Fiddle for this problem!

Briguy37

Posted 2011-08-12T20:21:55.783

Reputation: 2 616

2

HTML

(bad HTML!)

<marquee style="font-size:400px">~!400!~</marquee>

Griffin

Posted 2011-08-12T20:21:55.783

Reputation: 4 349

1

Python

50 characters or 400 bits as metered by other submissions.

i,j=1,1
while len(str(i))<81:
 print i 
 i,j=j,i+j

Simple fibonacci calculator, which terminates once the output no longer fits in a standard 80x60 terminal. Not especially festive I know, but the best I could come up with on short notice. More to follow!

arrdem

Posted 2011-08-12T20:21:55.783

Reputation: 805

1

Here comes C#!

class P{static void Main(){System.Console.Write("400!");}}

Ok, that is the smallest, running / valid, and remarkable thing i could squeeze out of .NET! But it fails by 13bytes! (code is 63bytes). Someone might suggest an improvement :D

Maybe using the roman numeral version might slash off an extra byte :-)

class P{static void Main(){System.Console.Write("CD!");}}

nemesisfixx

Posted 2011-08-12T20:21:55.783

Reputation: 111

1

Bits of code, or bits compiled? Ah well, I see nobody has posted any x86 yet, so here goes...

x86

4D 5A 90 00 03 00 00 00 40 00 00 0F FF F0 00 0B 80 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

IDK if this counts, it's the first 400 bits (in hex) of a Win32 PE executable

VB.NET

Sub Main()
    Console.WriteLine("400 CodeGolf")
End Sub

Nate Koppenhaver

Posted 2011-08-12T20:21:55.783

Reputation: 380

1

Yet another Python answer.

k=(1,)
while len(k)<400:k+=(sum(k[-2:]),)
print(k)

Print the first 400 Fibonacci numbers. I notice one of the other Python answers also does the Fibonacci sequence... Oh well. I came up with this method of calculating Fibonacci numbers while working on another code golf and I thought it was neat so I figured I'd answer anyway.

Ben

Posted 2011-08-12T20:21:55.783

Reputation: 11

0

Ada

with P;procedure C is begin P("400! Yay!");end C;

assuming there is a package p:

$ cat p.ads
procedure P(S:String);
$ cat p.adb
with Ada.Text_IO;
procedure P(S:String) is
begin
   Ada.Text_IO.Put_Line(S);
end P;

If I put with Text_IO; and Text_IO.Put("") into the source code I would already exceed the limit by 7 bytes, without outputting anything.. Ada is hard to golf.

oenone

Posted 2011-08-12T20:21:55.783

Reputation: 161

I put in a clarification to the question so you don't have to worry about importing input/output libraries. Hope this helps! – Briguy37 – 2011-08-15T15:20:18.793

0

Shells with banner installed

banner -w80 HAPPY  HAPPY  HAPPY  400th  QUESTION!

Ante

Posted 2011-08-12T20:21:55.783

Reputation: 321

0

Perl

$number_400=400;
$and_still_number_400=$still_number_400*4/4;
$when_is_the_500_post="In 100 posts!!";
print $number_400*400/400;

#      # ########## ##########
#      # #        # #        #
#      # #        # #        #
######## #        # #        #
       # #        # #        #
       # #        # #        #
       # #        # #        #
       # ########## ##########       

Dynamic

Posted 2011-08-12T20:21:55.783

Reputation: 111

This solution isn't the required length (400 bits). – Joey Adams – 2011-08-20T04:21:57.813

On my computer, it shows up exactly 400 bits. – Dynamic – 2011-08-20T13:46:58.790

1you mean 400 bytes? – bcc32 – 2011-08-24T17:43:14.560

@bcc32: My laptop says 400 bits. IDK what is wrong. – Dynamic – 2011-08-24T18:13:17.147

3That's one modern laptop you got there, we're still stuck with 64bit CPU's... :( – st0le – 2011-08-26T10:59:39.707

@st0le: IDK lol – Dynamic – 2011-08-26T12:39:07.967

0

Perl /*Life:Eat,sleep,then die */

$rip=400;$pork="Pi";chop($pork);sleep($rip);die();

zundarz

Posted 2011-08-12T20:21:55.783

Reputation: 101

...- is V, so currently it looks like it prints V000 400 times. – Briguy37 – 2011-08-24T18:23:02.793

Yup it surely does..'....-' = 4. Missed a dot. That exceeds my bit limit..back to the drawing board – zundarz – 2011-08-24T19:12:36.223