text:
The Great, White, North!
Eh!
You know, the problem with us Canadians is that sometimes, after a long day of moose hunting and dam repairing, we forget our way back to our cabins! Wouldn't it be great if our handy laptop (which, is always at our side), had some way to point us home? Well, it's been long told that, if you display a compass on your computer, it will be the brightest when pointed North. I'd like to test this out, but I need a compact program to take with me on my next trip, because my hard drive is already filled with maple syrup recipes (and those CANNOT go). So, your task is to design me a program which, when run, saves or displays an image of the following compass rose:

The letters may be in a different font. Remember, least is best, so lowest byte count wins!
Specifications
Colors

Light purple: #9999FF
Gray: #E5E5E5

Lengths and Angles

Angle a = 45°
Angle b = 90°
Length c = 250 units
Length d = 200 units
Length e = 40 units
Length f = 45 units

Clarifications

The text may be in any appropriate font, where appropriate denotes that it is readable to the average, educated human being.
The text must be 3 units away from the spikes at its closest point, must not touch the rose, and must be upright
If a line is drawn from the center of the rose, through the end point of the spike and beyond, it should cross through the center of the text with a precision of +/- 2 units (the text must be centered along an axis a, where a extends from the middle of the page, through the end of the spike, and beyond)
Each character must be at least 15 units by 15 units, and have an x/y or y/x ratio of no more than 2:1 (no stretching – readability)
The dim circle passing through the longer spikes and text closest to the middle on the reference image is not to be drawn.
The image must be square, and at least 400px by 400px
A compressed image within the source is disallowed
A unit must be at least 1 pixel

When you say "maple syrup recipes", do you mean recipes to make maple syrup, or recipes to make stuff out of maple syrup? Because I can't quite imagine they'd be the former...

@JoeZ. Both, obviously ... (;

HTML + CSS, 487 + 189 = 676
The compass rose is constructed from CSS borders using the triangle technique and some basic transformations. The letters are just given fixed positions, so that turned out quite long :/
The snippet below is scaled down so that it all fits. You can check out the JSFiddle here. Also, I'm not sure how well the letters will line up on different browsers (with different fonts, default styles, etc.).

html{transform:scale(0.2)}body{margin:5em}hr{margin:0;float:left;border:250px solid transparent;border-right:58px solid #E5E5E5;border-bottom:58px solid #9999FF}a{position:fixed;width:616px;font-size:4em}#a{transform:rotate(90deg)}#b{transform:rotate(270deg)}#c{transform:rotate(180deg)}#d{transform:rotate(45deg)scale(.8)}#n{top:20px;left:365px}#e{top:356px;left:700px}#s{top:700px;left:370px}#w{top:356px;left:10px}#N{top:150px;left:550px}#E{top:560px;left:550px}#S{top:560px;left:140px}#W{top:150px;left:140px}
NESWNESESWNW

It seems as though there's a small gray box around the middle, which has rendered the compass unusable. Is there any chance you could fix that?

@globby it doesn't show up for me. Could you post a screenshot?

http://imgur.com/dYQoLcM,sSrR94O Using Mozilla Firefox 35.0 on Windows 8.1

@globby that might just be an effect of the scaling. Does it happen on the full-sized JSFiddle?

Processing 2 - 636
A quick solution that just draws all the triangles using the processing triangle method and then places the letters at their tips.
int s,h,m,b,n,t;void setup(){s=400;h=s/2;b=125;t=71;n=32;m=28;size(s,s);noStroke();fill(229);t(h-t,h-t,h-m,h);t(h-t,h+t,h,h+m);t(h+t,h-t,h,h-m);t(h+t,h+t,h+m,h);fill(#9999FF);t(h-t,h-t,h,h-m);t(h-t,h+t,h-m,h);t(h+t,h-t,h+m,h);t(h+t,h+t,h,h+m);t(h-b,h,h-n,h-n);t(h+b,h,h+n,h+n);t(h,h-b,h+n,h-n);t(h,h+b,h-n,h+n);fill(229);t(h-b,h,h-n,h+n);t(h+b,h,h+n,h-n);t(h,h-b,h-n,h-n);t(h,h+b,h+n,h+n);fill(color(0));text("NW",h-t-14,h-t-2);text("NE",h+t+2,h-t-2);text("SW",h-t-14,h+t+10);text("SE",h+t,h+t+10);text("N",h-5,h-b-5);text("S",h-5,h+b+12);text("E",h+b+2,h+5);text("W",h-b-14,h+5);}void t(int a,int b,int c,int d){triangle(h,h,a,b,c,d);}

you can get processing here

PHP, 628 bytes
added a few linebreaks for convenience.
$c=$z.create;$h=$c($w=250,$w);$i=$c(530,533);$a=$z.colorallocate;$a($h,$f=255,$f,$f);$a($i,$f,$f,$f);$a($h,229,229,229);$a($h,153,153,$f);
$p=$z.filledpolygon;$p($h,$o=[0,64,0,0,141,141,],3,2);$p($h,[64,0]+$o,3,1);$p($h,$o=[0,$w,0,0,57,57],3,1);$p($h,[$w,0]+$o,3,2);
$c=$z.copy;$r=$z.rotate;$c($i,$h,263,267,0,0,$w,$w);$c($i,$r($h,90,0),263,17,0,0,$w,$w);$c($i,$r($h,180,0),13,17,0,0,$w,$w);$c($i,$r($h,270,0),13,267,0,0,$w,$w);
$s=$z.string;$s($i,5,259,0,N,3);$s($i,5,259,518,S,3);$s($i,5,0,259,W,3);$s($i,5,518,259,E,3);$s($i,5,106,108,NW,3);$s($i,5,406,108,NE,3);$s($i,5,406,410,SE,3);$s($i,5,106,410,SW,3);
imagepng($i,"n.png");

Run with -r. Creates a file n.png with the image; unit is 2 pixels.
I must admit I found the coords for the winds by trial & error, and they are probably a bit off. Will do the calculations soon; but I promise: they won´t change the byte count.
Had my fun for now excavating my trignonometry and struggling with imagecopy ... what a sissy!
on golfing: not many tricks; but these few saved a lot:

Assigning function names and two of the values to variables probably had the largest impact.
I didn´t even count before I replaced the function names.
The magic with the array + operator gave 42 bytes.
Writing a file instead of sending the image to the browser saved 27 bytes.
Moving assignments to the first usage of the variables gave a few more.

breakdown
// create images and allocate colors
$c=imagecreate;
$h=$c($w=250,$w);   // helper image - just as large as needed or imagecopy will screw up
$i=$c(530,533);     // main image

$a=imagecolorallocate;
$a($h,$f=255,$f,$f);    // white is 0
$a($i,$f,$f,$f);    // must be assigned to both images
$a($h,229,229,229); // grey is 1
$a($h,153,153,$f);  // purple is 2

// draw the south-east quadrant
$p=imagefilledpolygon;
// small triangle purple first
$p($h,$o=[
// point 3: 0.8*e *2
    0,64,
// point 1: center
    0,0,
// point 2: a=45 degrees, d=200 units
    141,141,// d/sqrt(2)=141.421356
],3,2);
// small triangle grey
$p($h,[64,0]+$o,3,1);

// large triangles
$p($h,$o=[
    0,$w,
    0,0,
    57,57   // e*sqrt(2)=56.5685424949
],3,1);

$p($h,[$w,0]+$o,3,2);

// create rose
$c=imagecopy;
$r=imagerotate;
$c($i,$h,263,267,0,0,$w,$w);            // copy quadrant to main image (SE)
$c($i,$r($h,90,0),263,17,0,0,$w,$w);    // rotate quadrant and copy again (NE)
$c($i,$r($h,180,0),13,17,0,0,$w,$w);    // rotate and copy again (NW)
$c($i,$r($h,270,0),13,267,0,0,$w,$w);// rotate and copy a last time (SW)

// add circle
#imageellipse($i,263,267,500,500,2);    // grey is now 2: imagecopy shuffled colors

// add names
$s=imagestring;
$s($i,5,259,  0,N,3);   // 5 is actually the largest internal font PHP provides
$s($i,5,259,518,S,3);   // unassigned colors are black
$s($i,5,  0,259,W,3);
$s($i,5,518,259,E,3);

$s($i,5,106,108,NW,3);
$s($i,5,406,108,NE,3);
$s($i,5,406,410,SE,3);
$s($i,5,106,410,SW,3);

// output
#header("Content-Type:image/png");
#imagepng($i);
imagepng($i,"n.png");

Java 8, 756 bytes
import java.awt.*;v->new Frame(){void t(Graphics g,String s,int x,int y){g.drawString(s,x,y);}public void paint(Graphics g){g.setFont(new Font("Hei",0,30));t(g,"N",289,80);t(g,"E",553,341);t(g,"S",290,605);t(g,"W",20,341);t(g,"NE",434,186);t(g,"SE",437,496);t(g,"SW",120,498);t(g,"NW",121,186);g.setColor(new Color(229,229,229));g.fillPolygon(new int[]{300,346,442,390,550,390,442,346,300,254,158,210,50,210,158,254},new int[]{80,240,188,284,330,376,472,420,580,420,472,376,330,284,188,240},16);g.setColor(new Color(153,153,255));g.fillPolygon(new int[]{300,158,254,244,50,300,158,210,244,300,300,442,346,356,550,300,442,390,356,300},new int[]{330,188,240,274,330,330,472,376,386,580,330,472,420,386,330,330,188,284,274,80},20);}{setSize(600,630);show();}}

Output:

Explanation:
Code explanation:
import java.awt.*;          // Required import for Frame, Graphics, Font, and Color
v->                         // Method with empty unused parameter and Frame return-type
  new Frame(){              //  Create a new Frame
    void t(Graphics g,String s,int x,int y){
                            //   Create a temp method to reduce bytes:
      g.drawString(s,x,y);} //    To draw the given text at the given coordinate
    public void paint(Graphics g){
                            //   Overwrite the Frame's default paint method:
      g.setFont(new Font("Hei",0,30));
                            //    Set the Font to size 30
                            //    (I've used Font "Hei" here, but "Kai" could be used as
                            //     well for the same byte-count)
      t(g,"N",289,80);      //    Draw the text "N"
      t(g,"E",553,341);     //    Draw the "E"
      t(g,"S",290,605);     //    Draw the "S"
      t(g,"W",20,341);      //    Draw the "W"
      t(g,"NE",434,186);    //    Draw the "NE"
      t(g,"SE",437,496);    //    Draw the "SE"
      t(g,"SW",120,498);    //    Draw the "SW"
      t(g,"NW",121,186);    //    Draw the "NW"
      g.setColor(new Color(229,229,229));
                            //    Change the color to grey
                            //    (the default color was black, which is why we started
                            //     with the texts)
      g.fillPolygon(new int[]{300,346,442,390,550,390,442,346,300,254,158,210,50,210,158,254},new int[]{80,240,188,284,330,376,472,420,580,420,472,376,330,284,188,240},16);
                            //    Draw the 8-pointed star
      g.setColor(new Color(153,153,255));
                            //    Change the color to light purple
      g.fillPolygon(new int[]{300,158,254,244,50,300,158,210,244,300,300,442,346,356,550,300,442,390,356,300},new int[]{330,188,240,274,330,330,472,376,386,580,330,472,420,386,330,330,188,284,274,80},20);}
                            //    Draw a single shape as explained below
    {                       //   In an inner code block:
      setSize(600,630);     //    Set the size of the Frame
      show();}}             //    And show the Frame

Calculations:
Although Java has ways to draw based on rotations, it would increase the byte-count substantial in comparison to this straight-forward approach. There is however one main disadvantage about using this shorter approach: I have to calculate all \$x,y\$-coordinates manually..
So, here's how I did that:
I first used the units as is, since that was easier to calculate with. I've put the center at position \$150,150\$ and started calculating from there.
1) Calculate the coordinates of the tips of the star at N/E/S/W:
This is not too hard. With the center at \$150,150\$ and \$\frac{\color{red}{c}}{2} = 125\$, we'll have the following points:
\$N=150,25\$
\$E=275,150\$
\$S=150,275\$
\$W=25,100\$
2) Calculate the coordinates of the tips of the star at NE/SE/SW/NW:
Again, we know the center is at \$150,150\$ and we also know \$\frac{\color{blue}{d}}{2}=100\$. We can make a triangle calculation with the angles being 90, 45, and 45 like this:

\$n=\frac{100}{2}\sqrt{2}=70.710\dots\$
(where \$m\$ are the sides \$b\$ and \$c\$ in the triangle above)
Knowing the \$n\$, we have the following points:
\$NE=150+m,150-m=220.710\dots,79.289\dots\$
\$SE=150+m,150+m=220.710\dots,220.710\dots\$
\$SW=150-m,150+m=79.289\dots,220.710\dots\$
\$NW=150-m,150-m=79.289\dots,79.289\dots\$
3) Calculate the coordinates of the points between the center and the NE/SE/SW/NW tips:
We again know the center \$150,150\$ and also \$\color{violet}{e}=40\$, so we can make a similar calculation as in step 2:
\$n=\frac{40}{2}\sqrt{2}=28.284\dots\$
And use that to calculate the points:
\$NE_{center}=150+n,150-n=178.284\dots,121.715\dots\$
\$SE_{center}=150+n,150+n=178.284\dots,178.284\dots\$
\$SW_{center}=150-n,150+n=121.715\dots,178.284\dots\$
\$NW_{center}=150-n,150-n=121.715\dots,121.715\dots\$
4) Calculate the coordinates of the remaining points:
Now all that's left are the points at the concaved intersection of the edges of the star, which are circled in red here:

Since we know the center \$150\$ and \$\color{lightblue}{f}=45\$, a portion of these coordinates aren't hard to calculate. The other part of the coordinates requires some calculations, though..

In the picture above, we know the following things beforehand:

Red line: \$\frac{\color{red}{c}}{2}=125\$
Both orange lines: \$n=\frac{40}{2}\sqrt{2}=28.284\dots\$

And what we want to calculate is the thick vertical blue line of the small purple triangle.
We start with the horizontal line of the larger green triangle:
\$o=125-n=96.715\dots\$
Using what we know now, we can calculate the black angle of the large green triangle as follows:
\$t=\sqrt{n^2+o^2-2no\times\cos(90)}=100.765\dots\$
\$A=\arccos(\frac{t^2+o^2-n^2}{2to})=16.301\dots\$
Then we can calculate the light blue angle of the small purple triangle:
\$B=90-16.301\dots=73.699\dots\$
As well as the horizontal line of the small purple triangle:
\$p=45-n=16.716\dots\$
Which we can then both use to calculate the height of the thick blue line of the small purple triangle:
\$q=p\frac{\sin(A)}{\sin(B)}=4.888\dots\$
After which we can finally calculate the final coordinates of these red dots, using the center and the points we've calculated in step 2:

\$NE_N=178.284\dots-q,150-\color{lightblue}{f}=173.395\dots,105\$
\$NE_E=150+\color{lightblue}{f},121.715\dots+q=195,126.604\dots\$
\$SE_E=150+\color{lightblue}{f},178.284\dots-q=195,173.395\dots\$
\$SE_S=178.284\dots-q,150+\color{lightblue}{f}=173.395\dots,195\$
\$SW_S=121.715\dots+q,150+\color{lightblue}{f}=126.604\dots,195\$
\$SW_W=150-\color{lightblue}{f},178.284\dots-q=105,173.395\dots\$
\$NW_W=150-\color{lightblue}{f},121.715\dots+q=105,126.604\dots\$
\$NW_N=121.715\dots+q,150-\color{lightblue}{f}=126.604\dots,105\$

We now have all the coordinates of the points we need, so we can draw the shape on the screen. We do this with the Graphics#fillPolygon(int[],int[],int)-method, which takes two integer-arrays for all \$x\$- and \$y\$-coordinates respectively, as well as an integer being the amount of points. The grey star is therefore drawn using the following \$x,y\$-coordinates:
\$[[150,25],[173,105],[221,79],[195,127],\$
\$[275,150],[195,173],[221,221],[173,195],\$
\$[150,275],[127,195],[79,221],[105,173],\$
\$[25,150],[105,127],[79,79],[127,105]]\$:

We then draw a single shape for the light purple parts, and the following \$x,y\$-coordinates:
\$[[150,150],[79,79],[127,105],[122,122],[25,150],\$
\$[150,150],[79,221],[105,173],[122,178],[150,275],\$
\$[150,150],[221,221],[173,195],[178,178],[275,150],\$
\$[150,150],[221,79],[195,127],[178,122],[150,25]]\$:
A quarter of this shape goes from the center to point \$NW\$; then to point \$NW_N\$; then \$NW_{center}\$; then \$W\$; and then back to the center again:

And the entire shape is drawn by continuing in a similar fashion.

After that I've doubled everything, because the challenge description states the square should be at least 400 by 400 pixels, and in addition all \$y\$-coordinates are increased by \$30\$, because we draw directly on the frame and we still have the Window-bar at the top to consider (outside codegolf you would add a Panel to the Frame, and draw on that, but drawing directly on the Frame is also possible and -in this case- 1 byte shorter ¯\_(ツ)_/¯).
And finally we add the text, for which no calculations are used. In the used Font the letters aren't monospace (W is for example larger than S), and in Java everything is drawn from the top-left \$x,y\$-coordinate, so we can't really make any smart calculations here tbh. I've just added some temporary red lines going beyond the points and manually adjusted the text positions a bit:

If you think they aren't correct, they can be moved slightly by adjusting the coordinates, without changing the byte-count.
For those curious, here are the adjustments made to the coordinates of the tips to position the texts:
\$N=300-11, 80\$
\$E=550+3,330+11\$
\$S=275+15,580+25\$
\$W=50-30,330+11\$
\$NE=441-7,188-2\$
\$SE=441-4,471+25\$
\$SW=158-38,471+27\$
\$NW=158-37,188-2\$
And well, that's it. Thank you for listening to my TED talk about drawing a compass in Java. :)

R, 877 850 813
Lot's of room to golf this I suspect, but I wanted to get something up to see if I managed to comply with the rules.
Edit: Lost a few cleaning up around the polygon creation, gained a few removing outlines
a=45;b=90;c=125;e=40;h=c(0,0,b,a,a,0,a,b)*pi/180;i=c(0,c,c,100,e,a,(2*a^2)^.5,a);x=i*sin(h);y=i*cos(h);q=x[6:7];r=x[7:8];s=x[2:3];t=x[c(5,5)];u=y[6:7];v=y[7:8];w=y[2:3];z=y[c(5,5)];m=(s-t);n=(w-z);o=(q-r);p=(u-v);i=((q*v-u*r)*m-o*(s*z-w*t))/(o*n-p*m);x=c(x,i)[c(1,2,5,1,3,5,5,4,10,5,4,9)];y=c(y,rev(i))[c(1,2,5,1,3,5,5,4,10,5,4,9)];png("1.png",400,400);par(mar=rep(0,4));a=c(-200:200);plot(a,a,type="n");for(b in 0:3){for(i in(0:3)*3+1){a=c(1,1,1,-1,-1,-1,-1,1);polygon(x[(i):(i+3)]*a[b*2+1],y[(i):(i+3)]*a[b*2+2],border=NA,col=c("#9999FF","#E5E5E5")[(i%%6%/%4+b%%2)%%2+1]);}};for(i in 1:4){a=c("N","NE","E","SE","S","SW","W","NW");b=a[i*2-1];c=a[i*2];o=c(1,1,-1,-1,1);n=o[i+1];m=o[i];e=c(5,2)[i%%2+1];text((x[e]+(11*abs(i%%2-1)))*m,(y[e]+(12*i%%2))*n,b,cex=1.8);text((x[8]+10)*m,(y[8]+12)*n,c,cex=1.8)};dev.off()

This produces the following png image

A bit of an explanation of what I'm doing
a=45;
b=90;
c=125;
e=40;
h=c(0,0,b,a,a,0,a,b)*pi/180;            # angles to known vertices in one quadrant
i=c(0,c,c,100,e,a,(2*a^2)^.5,a);        # distances to known vertices
x=i*sin(h);                             # calculate x ordinates
y=i*cos(h);                             # calculate y ordinates
q=x[6:7];                               #-----------------------
r=x[7:8];                               #
s=x[2:3];                               # Get the lines required
t=x[c(5,5)];                            # to determine the vertex
u=y[6:7];                               # for the minor pointers
v=y[7:8];                               #
w=y[2:3];                               #
z=y[c(5,5)];                            #------------------------
m=(s-t);                                # Intersect them
n=(w-z);                                # to give coordinate.
o=(q-r);                                # Just calculate the x's
p=(u-v);                                # as they can be reversed
i=((q*v-u*r)*m-o*(s*z-w*t))/(o*n-p*m);  #------------------------
x=c(x,i)[c(1,2,5,1,3,5,5,4,10,5,4,9)];      # X Triangle groups
y=c(y,rev(i))[c(1,2,5,1,3,5,5,4,10,5,4,9)]; # Y Triangle groups
png("1.png",400,400);                   # Set output to png
par(mar=rep(0,4));                      # Make margins 0
a=c(-200:200);
plot(a,a,type="n");                     # Start plot
for(b in 0:3){for(i in(0:3)*3+1){       # draw polygons, alternating colors and drawing all quadrants
a=c(1,1,1,-1,-1,-1,-1,1);
polygon(x[(i):(i+3)]*a[b*2+1],y[(i):(i+3)]*a[b*2+2],border=NA,col=c("#9999FF","#E5E5E5")[(i%%6%/%4+b%%2)%%2+1]);
}};
for(i in 1:4){                          # Add text to compass points for each quadrant
a=c("N","NE","E","SE","S","SW","W","NW");b=a[i*2-1];c=a[i*2];
o=c(1,1,-1,-1,1);n=o[i+1];m=o[i];
e=c(5,2)[i%%2+1];
text((x[e]+(11*abs(i%%2-1)))*m,(y[e]+(12*i%%2))*n,b,cex=1.8);
text((x[8]+10)*m,(y[8]+12)*n,c,cex=1.8)
};
dev.off()                               # Close PNG

Mathematica, 347 bytes
p=q={{0,0},{0,125},40{1/Sqrt[2],1/Sqrt[2]}};q[[3,1]]*=-1;m=5p[[3]]/2;s=u={{0,0},m,{32,0}};u[[3]]={0,32};r={{0,1},{-1,0}};t=Polygon[#]&;z=MatrixPower[r,#]&;a[v_]:=Table[t[z[n].#&/@v],{n,4}];i=Table[Text[#[[j]],z[j].#2],{j,4}]&;G=RGBColor["#E5E5E5"];Graphics[{i[{E,S,W,N},{0,130}],i[{NE,SE,SW,NW},1.06m],G,a[u],RGBColor["#9999FF"],a[s],a[p],G,a[q]}]

Pregolfed:
p = q = {{0, 0}, {0, 125}, 40 {1/Sqrt[2], 1/Sqrt[2]}}; (*defining points*)
q[[3, 1]] *= -1;                                       (*for triangles*)
m = 5 p[[3]]/2;
s = u = {{0, 0}, m, {32, 0}};
u[[3]] = {0, 32};
r = {{0, 1}, {-1, 0}};                                 (*-pi/2 rotation matrix*)

t = Polygon[#] &;
z = MatrixPower[r, #] &;
a[v_] := Table[t[z[n].# & /@ v], {n, 4}];              (*rotate the sets of points*)
                                                       (*four times*)

i = Table[Text[#[[j]], z[j].#2], {j, 4}] &;
G = RGBColor["#E5E5E5"];                               (*need to use this twice*)
                                                       (*so triangles overlap*)
                                                       (*properly so define a variable*)

Graphics[{i[{E, S, W, N}, {0, 130}],
  i[{NE, SE, SW, NW}, 1.06 m], G, a[u], RGBColor["#9999FF"], a[s],
  a[p], G, a[q]}]

N and E (base of the natural log) are both built-ins in Mathematica but as text E gets stylized into a lowercase font you see in the image but the problem doesn't quite say we can only use one font for all the text. If that is a requirement then replace E with "E" and I gain two bytes.
Sqrt[2] in Mathematica can be stylized into two characters, so if we count each Sqrt[2] as two characters then my new byte count is 339 instead of 349.
The image below is produced.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Identity sequences on the Rubik's Cube
A move sequence is a sequence of moves (turns) on a Rubik's Cube (for the notation look down below). Beside the empty move sequence, there are many other other move sequences, that have no effect on the cube at all. We call these move sequences identity sequences.
Some of these identity sequences are obvious to determine, like U2 R R' U2 or U D2 U' D2. In the first one, two random moves are done U2 R and afterwards immediately undone R' U2. The second one is similar. First two random moves U D2 and afterwards they are undone, but in reversed order U' D2. This only works, because the move U effects only the pieces of the upper layer and the move D2 only effects pieces of the lower layer. You can see a visualization of these two move sequences.

Other identity sequences may be not obvious at all. For instance the sequence R' U' R' F' U F U' R' F R F' U' R U2 R. It pretty long, but also has no effect at the cube at all.

Move Notation
A move describes the turn of one layer of one of the six faces of the cube. A move consist of one letter representing the face followed by an optional suffix representing the turn angle.
The letters and their corresponding faces are U (Up - the side facing upwards), D (Down - the side facing downwards), R (Right - the side facing to the right), L (Left - the side facing to the left), F (Front - the side facing you) and B (Back - the side facing away from you).
If there is no suffix, the face is turned 90-degree clockwise, the suffix ' means, the face is turned 90-degree counterclockwise, and the suffix 2 means, the face is turned 180-degree clockwise.
It you have any problems with the notation, just use http://alg.cubing.net, where you can visualize such move sequences.
The Challenge
Your task is to write a program, that determines if a move sequences is an identity or not.
You may write a full program or a function. It should receive a string containing a move sequence (moves are separate by spaces) as input (via STDIN, command-line argument, prompt or function argument), and output (via return value or STDOUT) a Boolean value or a corresponding integer (True - 1 - identity sequence/ False - 0 - not identity sequence).
If you suffix ' creates problems in your programming language, you may use a different symbol, but not at digit. R F2 U3 is not allowed.
This is codegolf, therefore the shortest code (in bytes) wins.
Test Cases
"" -> True
"U2 R R' U2" -> True
"U D2 U' D2" -> True
"U2 R U2 R'" -> False
"R' U' R' F' U F U' R' F R F' U' R U2 R" -> True
"L'" -> False
"B B2 B' B2" -> True
"D D2 D'" -> False
"R F' D2 U B' F2 B' U2 D2 F2 B2 U F R'" -> True
"D2 U' R2 U F2 D2 U' R2 U' B' L2 R' B' D2 U B2 L' D' R2" -> False
"R U R' U' R' F R2 U' R' U' R U R' F' R2 U R2 U' R2 U' D R2 U' R2 U R2 D'" -> True
"R U R' U' R' F R2 U' R' U' R U R' F' R2 U' R2 U R2 U' D R2 U' R2 U R2 D'" -> False
"B2 F2 U' F2 U R2 F2 U2 B D' R' D' R2 D' F2 U' F U R2 U R B D B D2 L2 D' F2 U D' R' D B R2 D2 F2 R' F2 D2" -> True
"R U2 R' U R' U2 R U2 R U R' U' R' U R U2" -> False
"U F B' R' U F' R U' F' B L U' F L'" -> False
"R2 U' R' U' R U R U R U' R" -> False
"R' F R' B2 R F' R' B2 R2" -> False

What's wrong with R F2 U3?

I just want to make sure, that everybody has the same preconditions. If I would allow U3, than you could simply cast the suffix into a digit.

Why does that matter? Input parsing is not that big a part of the challenge.

Sure, it doesn't matter a lot, but I want to people to use the original notation, since this is the standard notation (Singmaster notation). Just use the ', if that's works with your programming language.

I'm more used to the notation that uses T-Top, B-Bottom, and P-Posterior (back). People probably just liked seeing the sequence R2 D2.

@mbomb007 I can understand T for top, but I've never seen P for posterior and I wouldn't understand its meaning were it not for your comment...

The notation is used in an older Rubik's Cube solution book. It's probably 20-30 years old, but that's the only solution book I've ever looked at. I didn't even know about the current notation until I did a project last year on Rubik's Cube for Abstract Algebra.

@mbomb007 I have seen that notation too, but it is neither as common or as old as the original Singmaster notation, and I don't know why people want to mess with the original. Although David Singmaster (as far as I know) did not mention it, I have observed that all faces are perfectly consistent and with no clashes if considered as directions rather than positions. That is F(orward), B(ackward), L(eft), R(ight), U(p), D(own)

I know the intentions are not such, but currently all test cases will pass even if you do not care about the orientation of the cubies. For example, if a cube is scrambled in such a way that only OLL step is remaining, and I call that cube as identity cube and write by program keeping that in minds, the test cases will still pass. You need to add test cases which dis orient the layers, even though keeping the position correct. For ex. twisted corners, reversed sides etc.

Good point. I will add some tests, as soon I arrive at home.

Okay, fine! I'll fix mine!

Can we swap truthy/falsy output values? For example, if I specify in my answer, can R2 R2 output 0 and R2 output 1?

@MDXF Yes, I did't explicitly forbid that. But I see that you already found a different way, or can solve the problem in less than 4 bytes without that restriction?

@Jakube Yes, I found a different way. Swapping truthy/falsy values wouldn't get it below 4 bytes.

Haskell, 263 261 247 243 characters
c[x]=[x]
c(x:"2")=[x,x]
c(x:_)=[x,x,x]
s!a@[x,y,z]=case s of
 'R'|x>0->[x,-z,y]
 'B'|y>0->[z,y,-x]
 'U'|z>0->[-y,x,z]
 'L'|x<0->[x,z,-y]
 'F'|y<0->[-z,y,x]
 'D'|z<0->[y,-x,z]
 _->a
r=[-2..2]
i=mapM id[r,r,r]
f w=i==foldr(map.(!))i(c=<<words w)

Rather straightworward algorithm; each cubelet is made out of 1,2,4 or 8 chunks encoding its position and orientation; 4 chunks per edge cubelet, 8 per corner cubelet, 7 cubelets are stationary.
c chomps each word of the input into a sequence of CW turns, and ! sends each chunk according to a turn. i is the identity position. f is the main function.
I'm not too happy with the chomp function, but I can't seem to find a way to shorten it either (@Nimi did, however)

How about c(x:"2")=[x,x] and c(x:_)=[x,x,x]. Saves 2 bytes.

If you use i=sequence[s,s,s], and change all the tuples to lists (i.e.: (x,y,z) becomes [x,y,z]) - it'll save ~9 characters. Inlining it saves 4 more. Dropping the _ case from ! saves another 11.

@MtnViewMark done and improved i, thanks. Not sure what you mean by inlining i - please note it appears twice in the definition for f. Not sure what you mean by dropping the _ case - either leaving _->a out completely or moving  it to the top yields a non-exhaustive pattern exception, and moving it to the top doesn't save any characters anyways. I did manage to save 5 characters there, however.

Great solution. I checked all test cases.

Again, congrats to your solution. Since you presented the shortest code, you receive the bounty worth 100 reputation.

Cubically, 6 4 bytes
¶=8%

I win :P
¶=8%
¶     read a string, evaluate as Cubically code
 =8   set notepad to (notepad == 8th face)
   %  print notepad

The notepad is initialized to zero. The 8th "face" contains 1 if the cube is unsolved and 0 otherwise.
Try it online!

J - 232, 220, 381, 315 296 bytes
This solution encodes all operations as face permutations and works based on the fact that all face twists are actually the same, under a rotation of the entire cube.
Edit: some more golfing
f=:+/~6&*
r=:4 :'y f&.>(]{^:x~)&.C.;/i.2 4'"0
t=:((r~0),_4<\44#.inv 1478253772705907911x)&C.&.
Y=:(C.(,0 2 r 4 5),;/4 f&i.8)&{^:t
X=:((,1 1 0 2 r 2 4 3 1)C.C.;/0 4 2 5 f i.8)&{^:t
61".@A."1'=: ',"#~6 3$'D0XR1YF1XU2YB3XL3Y'
T=:[:(_2".@}.'(i.48)-:'&(,,[))[:(,'^:',])/&.>@|.&.;:[:''''&=@{.`]},:&'3'

Other than the previous tries, this does take corner rotation into account.
f is just a helper function. r does the rotation of one face. a face is encoded as follows:

all corners in steps of 6
all edges in steps of six

this order facilitates the encoding of rotations and twists.
t is an adverb that twists the face under a certain cube rotation, selecting the face.
X and Y are adverbs which take as left argument the number of in that direction of the entire cube.
The next line defines all rotations: 3 characters per rotation: the name, the number of rotations and the direction.
The last line defines the test verb T, converting 3 and ' to Power notation, flipping the order of operation appending the test vector andfinally excuting the entire thing.
More details upon request.
tests =: (] ;. _2) 0 : 0

 U2 R R' U2
 U D2 U' D2
 U2 R2 R'
 R' U' R' F' U F U' R' F R F' U' R U2 R
 L'
 B B2 B' B2
 D D2 D'
 R F' D2 U B' F2 B' U2 D2 F2 B2 U F R'
 D2 U' R2 U F2 D2 U' R2 U' B' L2 R' B' D2 U B2 L' D' R2
 R U R' U' R' F R2 U' R' U' R U R' F' R2 U R2 U' R2 U' D R2 U' R2 U R2 D'
 R U R' U' R' F R2 U' R' U' R U R' F' R2 U' R2 U R2 U' D R2 U' R2 U R2 D'
 B2 F2 U' F2 U R2 F2 U2 B D' R' D' R2 D' F2 U' F U R2 U R B D B D2 L2 D' F2 U D' R' D B R2 D2 F2 R' F2 D2
 R U2 R' U R' U2 R U2 R U R' U' R' U R U2
 U F B' R' U F' R U' F' B L U' F L'
 R2 U' R' U' R U R U R U' R
 R' F R' B2 R F' R' B2 R2
)
res =: 1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0
res ([,],:=) T"1 tests NB. passes all tests.
1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

NB. some handy display methods:
dispOrig=: (". ;._2) 0 :0
   _   _   _   5  29  11   _   _   _   _   _   _
   _   _   _  47  _1  35   _   _   _   _   _   _
   _   _   _  23  41  17   _   _   _   _   _   _
   3  27   9   0  24   6   1  25   7   2  26   8
  45  _3  33  42  _6  30  43  _5  31  44  _4  32
  21  39  15  18  36  12  19  37  13  20  38  14
   _   _   _   4  28  10   _   _   _   _   _   _
   _   _   _  46  _2  34   _   _   _   _   _   _
   _   _   _  22  40  16   _   _   _   _   _   _
)
ind =: dispOrig i.&, i. 48 NB. indices of i.48 in the original display

disp =: (9 12$(,dispOrig) ind}~ ])
changed =: 1 : '(u ~:&disp ]) i.48' NB. use to debug permutation verbs: L ch
vch =: 1 :'disp  ((]+_*=) u)'
NB. viewmat integration RGB
cm =: 255 * 1 0 0 , 1 1 1, 0 1 0, 1 1 0, 1 0.5 0, 0 0 1,: 0 0 0 NB. colormap
NB. use as:  "cube i. 48" for seeing a nice folded out cube.
cube =: cm viewmat (>&7 + >&15 + >&23 + >&31 + >& 39 + >&47)@|@disp@]

"as my test results don't correspond with the ones given ... " as in, your solution doesn't work? I wouldn't post it then...

You're right. Fixed it now.

I added 4 additional test cases. Two of them still return the false result. Looks like you ignore the orientation of the corners.

@jpjacobs There's a 100 rep bounty on the question now. Wanna correct your code?

Voila, done. Now just reducing it.

Great job. Sadly your code still is much longer as Jan Dvorak's Haskell solution, therefore I awarded him with the bounty. I really wish, this has more upvotes though.

No more than fair. Either way, it was one of the better challenges I participated in, thanks.

Python 3: 280 chars
This is not a participant in the challenge. Firstly because I asked the challenge myself and secondly because it's not my code. All credits belong to Stefan Pochmann, who discovered this awesome way of simulating a Rubik's Cube. I only did some golfing and some minor changes in respect of the challenge.
def f(a):
 s=t="UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR".split()
 for m in a.split():q="FLBR FRBL FDBU FUBD URDL ULDR".split()['UDLRFB'.index(m[0])];n=2+"2'".find(m[-1]);s=[[p,p.translate(str.maketrans(q,q[n:]+q[:n]))][m[0]in p]for p in s]
 return s==t

The idea behind this is the following. s represents the location of the pieces of UF, UR, and so on. For instance: s = ['DF', 'BL', ...] means, that the piece UF is at the position DF, the piece UR is at the position BL, ...
How does the position of a piece change, when doing a move. If you do a U-move, all stickers (colors) of the U-layer, which faced the front face, move to the left face. The stickers of the left face move to the back, these to the right and these to the front face. Encoded by FLBR. Some examples: UF moves to UL, UFR moves to ULF and so on. Therefore, applying a move is simply translating the faces of pieces in the corresponding layer.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Keep your distance!
Every player has a number. Can yours be the farthest from them all?
Requirements
Write a Java, Python 2, or Ruby function named choose() that accepts three arguments:

an integer - the number of rounds already completed
an integer - the number of players
an array of strings - the results of each previous round

each string is a space-separated list of integers, sorted from lowest to highest

For example, choose(2, 4, ["4 93 93 174", "1 84 234 555"]) means:

there were already two rounds (this is the third round)
there are a total of four players
in the first round, the numbers chosen were 4, 93, 93, 174
in the second round, the numbers chosen were 1, 84, 234, 555

You must return a whole number from 1 to 999 (inclusive).
For each other player, your score is the square root of the distance between your number and theirs. Your score for the round is the total of all of these scores.
100 rounds will be played. The highest total score wins!
Rules

Your code may not use any I/O, including console, files, network, etc.
You may not interfere with the control program or any other players.
Programs which look like they violate the above rules will be excluded.
Each call of a function should take under five seconds on my computer (Intel Core i5 2450M with 8GB of RAM).
If a program throws an exception or returns an invalid value, it will be treated as if it returned 1.
Each user may submit at most one program.

Miscellaneous

The control program is on GitHub.
There are three built-in players. They can be found in this answer.
The winner will be chosen on January 28.

Leaderboard
The winner is Conservator.
Honorable mention to Gustav, the highest scoring player with a non-constant strategy.

Conservator - 36226
High - 36115
FloorHugger - 35880
NumberOne - 35791
Overestimator - 35791
Gustav - 35484
Historian - 35201
Sampler - 34960
Incrementer - 34351
JumpRightIn - 34074
Vickrey - 34020
Teenager - 33907
Randu - 33891
Weightlifter - 33682
Middleman - 33647
BounceInwards - 33529
NastyMathematician - 33292
Jumper - 33244
Copycat - 33049

The full results can be found here. (I recommend disabling text wrapping.)

Do I have any way of telling which was my own number in those previous rounds?

@MartinBüttner No.

I'm trying to compile the controller, and I have no clue how to get org.python.core and the org.ruby. A quick google search gave me some links to jython. Is the code written in jython or something? Can you give me some links? Thanks.

@Maltysen It uses the Jython and JRuby jar files. I'll mention this in the GitHub readme.

Cool. Thanks for the links.

Wait. I ran the installers but its still not working. Can't find either python or java. BTW the command I'm running is javac *.java since jruby/jython is in my path. Any clue to what I'm doing wrong? Maybe I need the standalone?

I don't know any of those languages :( Could you add JavaScript? Like, run it with node.js?

@TheWobbuffet, I don't know any of them either.  Didn't stop me from making a Python entry.

@Mark Sometimes I want to start learning a new language, but then I remind myself I'm not even intermediate in any of the languages I do know. I would be able to do this because I know the basic syntax of python, but I don't know anything about return statements and I'm too lazy to search the doc... yeah... there's also the fact that I don't know which version of python I want to learn.

@Maltysen I'm not sure. (I used NetBeans to write, compile, and run everything.) If the Java can't be found, check to make sure the folders are correct - all players should be in KotH/src/Players/ , and the code in KotH/src/koth/ . What are the exact error messages you're facing?

It gives me "PythonPlayer.java:4: error: package org.python.core does not exist" for all of them and the ruby equivelant. I'm using javac -cp jruby.jar:jythonn.jar *.java

Wow. Based on the current leaderboard it looks like it's just best to pick 1 or 999 all the time.

Holy moly, I thought it was not a bad choice, but wow :)

I think it would have been more interesting if the space was a circle/loop so that the distance between 1 and 999 is 1. That would keep the "guess a single number every turn" from dominating, since there aren't "edges" to park on. Obviously too late to change now though ;)

@Geobits, perhaps "Keep your distance on a circle" could be a separate question. The results would be much more interesting.

@CarpetPython Someone should ask that. I thought it seemed pretty obvious that picking 1 or 999 every time would be the best strategy.

@CarpetPython Mind if I post that challenge?

@KSFT, please do. If the "duplicate police" don't get you, I will be posting an answer for sure.

@CarpetPython Why? Is it a duplicate of something else, or do you just mean this?

I meant this. Some people may say the "circle" variant to too much like this challenge. You may have to describe how the circular aspect makes it a different puzzle needing different answers. I don't much like the duplicate rules here (as long as credit is given to earlier work), but we have inherited them from the Q&A format where it is a very good rule.

@CarpetPython I just started writing the question when I realized that I don't have a controller. I don't know Java very well, so I guess I'll just write a new one in Python. Is it just supposed to take the names of files containing two programs as input and output the winner?

@KSFT I think you only need to change line 45 of Contest.java

@CarpetPython/kaine/anyone else  I'm about to post it. Am I supposed to run the control program to determine scores? Should I run it with every pair of programs? Also, I can't figure out how to compile the control program.

Okay, I figured out how to compile the control program, but I'm still not sure what I'm supposed to do and what people who write submissions are supposed to do.

I posted it here: https://codegolf.stackexchange.com/questions/45216/keep-your-distance-on-a-circle

I can't get the control program to work. Do the Java submissions need to be surrounded with class declarations?

@KSFT Yes. Use package Players; class ProgramName {public static int choose(int ...

Why only Python 2? Is there something wrong with Python 3?

Python, Conservator
def choose(round, players, scores):
    return 999

Since every exception throws 1, it stays away as much as possible from it. Makes its fortune at the expense of the weak.
Fun fact: I thought about improving it, but couldn't find a better way than just hiding in a corner.

Looks like I picked the wrong corner.   :(

It is good for a simple reason: Others try to minimize the distance to you. They will automatically make your score better. A game changer would be an opponent who trys to get as close to you as possible.

Eww...a semicolon in Python?

@KSFT hehe I'm rusty on Python, and I've never been that expert anyway

Number One, Java
The name explains this one completely.
public static int choose(int round, int players, String[] args) {
    return 1;
}

Why the down vote?

I especially like how the user name ties into the submission

Python, AncientHistorian
Firmly believes that the future will be exactly like the past, but believes the last round is too recent to be histiry, so it just loops through 1 - 999 and chooses what would have been the best the previous rounds exept the last. First 2 round returns 500.
def choose(round, players, scores):
    calc = lambda n, scores: sum([abs(int(i)-n)**.5 for i in scores.split(' ')])
    return max(range(1, 1000), key=lambda n: sum([calc(n, j) for j in scores[1:]])) if round>1 else 500

Python, Vickrey
def choose(rounds, players, results):
    if not results:
        return (id(0)/7)%999 + 1

    def best(array):
        score = lambda x: sum(abs(x-y)**.5 for y in array)
        m = max(score(x) for x in range(1, 1000))
        return [x for x in range(1, 1000) if score(x) == m]

    def second_best(array):
        array.extend(best(array))
        options = best(array)
        return options[(id(0)/7) % len(options)]

    results = [map(int, s.split()) for s in results]
    counts = {}

    for round_ in results:
        for number in round_:
            counts[number] = counts.get(number, 0) + 1

    most_common = sorted([(c, n) for n,c in counts.items()], reverse=True)
    to_avoid = [t[1] for t in most_common[:players]]

    return second_best(to_avoid)

Makes a list of numbers which have been played often, assumes that everyone else will play optimally and opts for the second best choice given the list.
For example, if the most common numbers are [1, 990, 999], then Vickrey inserts the optimal play 200 to give [1, 200, 990, 999], then picks the best option for the new array (which is 556).

Java, Overestimator
As the name suggests, this program assumes all the other programs will try to play "well" by picking the best answer based on the last round - so this "overestimator" always picks the worst possible position based on the previous round.
 public static int choose(int round, int players, String[] args) {
     String[] lastRoundStrings = args[args.length - 1].split(" ");
     int[] lastRound = new int[lastRoundStrings.length];
     int worstSelection = 0;
     for (int i = 0; i < lastRound.length; i++) {
         double worstScore = Double.MAX_VALUE;
         for (int j = 1; j < 999; j++) {
             double computedScore = score(j, lastRound);
             if (computedScore < worstScore) {
                 worstScore = computedScore;
                 worstSelection = j;
             }
         }
     }
     return worstSelection;
 }

 public static double score(int position, int[] otherPositions) {
     double total = 0;
     for (int i = 0; i < otherPositions.length; i++) {
         total += Math.sqrt(Math.abs(otherPositions[i] - position));
     }
     return total;
 }

How come this played a constant "1"? Was there a bug? Mind you, playing "1" proved to be quite successful. :)

Sadly the code has a bug, yes - it never actually parses the scores it reads from the last round. (But I realised it too late and it seemed wrong to edit a submission by then, plus as you say it was doing pretty well so... whatever :p)

Java - Weightlifter
Loops through 1-999 to figure out which would be the best for each round. Weighs them according to recency (recent rounds have more weight), and returns its best overall guess. Hopefully if patterns form in later round, this will be able to pick up on it.
Edit: Now with +Inf% more recursion!
Not being able to store/save/see what you chose on previous rounds is a drag. Taking your own inputs into account messes you up when trying to figure out what others are going to do. So, let's compute it! This will now recurse to figure out what it chose on the previous round and ignore that when calculating the next move.
Note that it only really ignores its own input from the last turn, but since that one is weighted the highest, it seems to work okay. This could be fixed with a bit more work, but I'll wait for the leaderboard to see if it's needed.
int choose(int rounds, int players, String[] hist){
    if(rounds < 1)
        return 1;

    int lastChoice = choose(rounds-1,players,java.util.Arrays.copyOf(hist, hist.length-1));

    int[][] history = new int[hist.length][players];
    for(int i=0;i<hist.length;i++){
        String[] tokens = hist[i].split(" ");
        boolean flag = false;
        for(int j=0;j<tokens.length;j++){
            history[i][j] = Integer.parseInt(tokens[j]);
            if(i==history.length-1 && history[i][j]==lastChoice && !flag){
                flag = true;
                history[i][j] = -1;
            }
        }
    }

    double best = 0;
    int guess = 1;
    for(int i=1;i<1000;i++){
        double score = 0;
        for(int j=0;j<history.length;j++){
            double weight = (double)(j+1)/history.length;
            for(int k=0;k<history[j].length;k++){
                if(history[j][k] > 0)
                    score += Math.sqrt(Math.abs(history[j][k]-i)) * weight;
            }
        }
        if(score > best){
            best = score;
            guess = i;
        }
    }
    return guess;
}

Note: Even at round 100, it completes in under a second on my somewhat-slow PC. If it takes too long on yours for some reason, let me know so I can limit the recursion.

It's very fast on my machine as well.

Gustav (Python 2)
This is a pretty straight forward meta strategy, shamelessly copied from one of my old answers in a similar KotH challenge. It considers a few simple strategies, looks how they would have performed over all previous rounds, and then follows the highest scoring one for the next round.
def choose(k, N, h):
    if k<2: return 999
    H = [[int(x) for x in l.split()] for l in h]
    score = lambda x,l: sum(abs(x-y)**.5 for y in l)
    S = [range(1,1000)
         + [max(range(1,1000), key=lambda x: score(x, H[i-1]))]
         + [max(range(1,1000), key=lambda x: score(x, H[i-2]))]
         + [min(range(1,1000), key=lambda x: score(x, H[i-1]))]
         + [min(range(1,1000), key=lambda x: score(x, H[i-2]))]
         for i in range(2,k+1)]
    scores = [sum(score(s[j],l) for s,l in zip(S[:-1], H[2:]))
              for j in range(len(S[0]))]
    return max(zip(scores, S[-1]))[1]

I realize now that the algorithm still has some flaws. E.g. it might keep "chasing itself" because it does not distinguish its own moves from those of the opponents. However, I'll leave it like this for now.

Ruby, JumpRightIn
def choose(round, players, args)
    return 500 if args.size == 0
    last_round = args[-1].split.map(&:to_i) + [1000]
    max_gap = 0
    last = 0
    move = 1
    last_round.each { |i|
        gap = i - last - 1
        if gap > max_gap
            max_gap = gap
            move = (i + last)/2
        end
        last = i
    }
    move
end

It's probably the most straight-forward strategy. It finds the largest gap in the last round, and chooses the number right in the middle of that gap.

What does it return for the first round? 1?

@mbomb007 Oh, I always forget these pesky initial rounds. Thanks, it now returns 500.

Ruby, Copycat
Simply returns whichever number won last time.
def choose r, p, hist
  last = hist.last.split.map &:to_i
  scores = last.map{|n| last.map{|m| (n-m).abs ** 0.5 }.inject :+ }
  last[scores.index scores.max]
end

What does it return for the first round? Oh never mind. Exceptions would return 1.

Python, Randu
Numbers selected by the most ill-conceived random number generator ever.
def choose(round, players, scores):
    x = 15
    for i in range(round * players + 1):
        x = (x * 65539) % 2147483648
    y = int((x / 2147483648.0) * 999.0)+1
    return y

Java, BounceInwards
Starting at 1, it gradually gets closer to 500 while bouncing between the higher and lower option.
public static int choose(int round, int players, String[] args) {
    return round%2 == 0 ? round * 5 : 1000 - round * 5;
}

NastyMathematician (Java)
Examines the last two rounds (if the best numbers were 70 and 80, it will output 90). It is nasty because it tries to take as high numbers as possible to win against his opponents.
public static int choose(int round, int players, String[] args) {
    if (round == 0) {
        return 999;
    }

    int[][] results = new int[args.length][players];

    // parse input
    for (int i = 0; i < args.length; i++) {
        String[] rounds = args[i].split(" ");
        for (int j = 0; j < rounds.length; j++) {
            results[i][j] = Integer.parseInt(rounds[j]);
        }
    }

    int bestNumber = 0;
    double bestScore = -1;

    // get the best number for the last round
    for (int i = 1; i < 1000; i++) {
        double score = 0;
        for (int result : results[results.length - 1]) {
            score += Math.sqrt(Math.abs(i - result));
        }
        if (score >= bestScore) {
            bestScore = score;
            bestNumber = i;
        }
    }

    if (round == 1) {
        return bestNumber;
    }

    int bestNumber2 = 0;
    double bestScore2 = -1;

    // get the best number for the second last round
    for (int i = 1; i < 1000; i++) {
        double score = 0;
        for (int result : results[results.length - 2]) {
            score += Math.sqrt(Math.abs(i - result));
        }
        if (score > bestScore2) {
            bestScore2 = score;
            bestNumber2 = i;
        }
    }

    // add the difference between last round and second last round to get this rounds best number
    int difference = bestNumber - bestNumber2;
    bestNumber = bestNumber + difference;

    return bestNumber > 999 ? 999 : bestNumber;
}

Python - I don't want to think of a name...
If the average of the numbers chosen in the past rounds is less than 500, it picks 999. It picks 1 otherwise.
def choose(a,b,c):
    total=0
    for i in c:
        for j in i.split(" "):
            total+=int(i)
    average=total/(a*b)
    if average<500:
        return 999
    return 1

The following three programs are built-in.
High (Ruby)
def choose(round, players, args)
    return 990
end

Incrementer (Java)
public static int choose(int round, int players, String[] args) {
    return round * 10 + 5;
}

FloorHugger (Python)
def choose(round, players, args):
    if len(args) == 0:
        return 10
    last = args[-1].split();

# next line from http://stackoverflow.com/a/7368801/3148067
    last = map(int, last)

    dist = 0
    for i in range(1, 999):
        if i in last:
            dist = 0
        else:
            dist = dist + 1
            if dist == 10:
                return i
    return 500

Python, Sampler
Out of a list of places, choose the one that is farthest away from recently used
numbers, ignoring the previous turn.
def choose(turn, players, history):
    sample = map(int, (' '.join( history[-5:-1] )).split())
    def distance(x): return sum(abs(x-y)**0.5 for y in sample)
    places = range(1, 1000, 13)
    score, place = max((distance(x), x) for x in places)
    return place

Python, Middleman (based on conservator by @clabacchio)
def choose(round, players, scores):
    return 500;

After I noticed that the upper edge scores high (and outperformed the lower edge), I wondered whether there could be anything worse than just getting caught in the middle.

Jumper (Ruby)
def choose(round, players, args)
    495*(round%3)+5
end

Alternates between bottom, middle and top.
(5,500,995)


text:
Make a caeser cipher
I love my encryption but I need a program that is dedicated to making a caeser cipher. It will take an input string and will output a ciphered text with the number to decode it. The number can be made whatever you want
The shortest code wins!

I wanted to borrow some code from http://rosettacode.org/wiki/Caesar_cipher but these are a bit large

I've voted to close as "too broad", due to the lack of specifics. This leaves glaring loopholes (as can be seen by current answers) and renders the challenge trivial/uninteresting.

I went for unclear, but w/e. Any close reason will do.

@JanDvorak I think it's pretty clear what he's asking.

Golfscript, 1 character
0

Outputs the input string rotated by 0 characters, plus the digit 0 to show how to decode it.
(sorry, I couldn't resist)

also powershell [0-9], for letters 'a'

Ruby - 12
This was my first idea.
puts gets+?0

I see Doorknob posted an answer as I'm typing this, similar to my next idea:
CJam - 4
q0pp

Both of these shift by 0.
This might not count, because I haven't actually released the interpreter yet, but my golfing language KSFTgolf can do it like this:
0

That's zero bytes. It takes a byte to print the zero
Here are more:
Python 2 - 21
print raw_input()+"0"

Python 3 - 18
print(input()+"0")

Perl 5 - 10
print<>.0;

Your Ruby solution would output quotes around the string (inspect it), making it invalid. You have to use puts or $><< instead. (You could also save a character by replacing "0" with ?0.)

@Doorknob Is that invalid? I don't think it says so in the question.

@Doorknob Meh, I changed it anyway


text:
Generate all 4-perfect numbers
Your program or function should output all the 36 4-perfect numbers in increasing order  separated by newlines.
An n positive integer is a k-perfect number (multiply perfect number) if the sum of its divisors including itself (i.e. the sigma function of n) equals k*n.
For example 120 is a 3-perfect number because 1 + 2 + 3 + 4 + 5 + 6 + 8 + 10 + 12 + 15 + 20 + 24 + 30 + 40 + 60 + 120 = 360 = 3*120.
Details

Your entry should actually produce the output and terminate on your machine before you submit your answer. (i.e. the program should terminate in a reasonable time)
Hardcoding is allowed.
Built-in functions or data closely related to the problem (e.g. sigma function) are disallowed.
This is code-golf but as the task is non-trivial without major
hardcoding non-golfed entries are welcomed too.

(This is a great detailed page about the history of all multiply perfect numbers.)

What counts as "partial" hardcoding?

"Your entry should actually produce the output on your machine not just in theory." In what time frame? Furthermore, what functions are closely related? Is Divisors[n] closely related? Is Divisible[m,n] closely related? Is Mod[m,n] closely related?

@MartinBüttner No time frame. Non of those are closely related. The purpose of that rule is to disallow simple one-liners available in some languages.
@Geobits Removed partial.

@MartinBüttner I don't know how else can I say that if you had seen the output appear on your screen than you can post the program because it actually produced the output not just theoretically.

For those of you trying to get started, here's some structure I noticed: The numbers tend to have many small prime factors, and the large prime factors are all one less than a product of smaller prime factors in the factorization. For example, the largest number 1598455815964665104598224777343146075218771968 is divisible by 2^37, its largest prime factor 524287 is 2^19-1, and its second-largest prime factor 174763 = 4*43691 - 1, where 43691 is its third-largest prime factor.

Everyone answer by hardcore?

CJam, 377 bytes
All the characters are part of extended ASCII, so I'm counting this as a single byte per character
"Ò|+^ø¥©~öôxõÕÊïB.X}Ã+ç
âà©¥;ØÓé@ä¦qØH®üzGOwCàæ/Â$ªh#þ>üJNDÂTR{^ÌýÂ±OáÉÚ6ï®I?Çvqf³e1é^¶[Y½5ãþ#_-__xF'IMØ*¬È6Vô+§mâ?µTJÉ9$·Ùöµ¨±Dac&¼'h,q÷ZwÎE^§Å{åÁûà\µ;óÛ¤{n'ÜGÐÓR!³¥èè>(~\"NbU*ötmù¦ªUe|Rñ¾!a9TYÇ&êë½ôâ··¨JÆ#Ù&îCÎÍð4q<ÌÏïj;Åd*òz(x    ?ßâ%d8Æ¬ÔUÎ=¶îÖÀ+mHH9â\"=PÊ±edèËU·  /þr<ÆGR;|úÀè¶¡õrì@öÆ"255bBbAa/N*

I'm sure Stack Exchange will have swallowed some of the characters, so you might want to copy the code from this pastebin.
Test it here.
This solution is purely hardcoded. It interprets the code points of the characters as the digits of a base-255 number, gets the base-11 digits of that, splits on the digit 10 and joins the resulting arrays by newlines.

The byte counter says 314 chars and 451 bytes.

@KSFT As I said in the answer, don't copy the code from my answer, because Stack Exchange strips unprintable characters. Use the link in my answer instead, which should show all 377 characters. Furthermore, that site counts bytes in UTF-8, but it's not necessary to encode the input in UTF-8 since all characters are in extended ASCII, so one only needs a single byte to encode each character.

I did look at the link. It gave the same numbers as copying the code from your answer. It said 314 chars both times.

@KSFT Hm, the link does work for me. Did you copy it in first, and then use the link? In some browsers, the permalinks don't work and are overridden by whatever you last opened in the counter.

Huh...that is weird... I typed something else in the counter, then opened the link in a new tab, and it had what I had typed instead of your code!

@KSFT Lesson learned, replaced it with a pastebin link.

Prime factorization (Ruby ,570 542 bytes)
Rev 0
Below is a table of the prime factorizations of the 36 required numbers (copied from Wolfram, hopefully with no errors.) Only 31 prime factors are involved if I have counted correctly, and some of these always occur together, for example 137*547*1093 and 683*2731*8191.
It should be possible to condense the information in the table, or perhaps even employ a search strategy. This should beat simply compressing the numbers.
Unfortunately the numbers are too big even for a 128-bit integer, which means I can't use C. Ruby and Python do support arbitrary precision integers. I have put the table in valid Ruby syntax, which makes it my first ever Ruby program!
puts 2**5  *3**3  *5    *7
puts 2**3  *3**2  *5    *7           *13
puts 2**2  *3**2  *5    *7**2        *13      *19
puts 2**9  *3**3  *5          *11                         *31
puts 2**7  *3**3  *5**2                  *17              *31
puts 2**9  *3**2        *7    *11    *13                  *31
puts 2**8  *3     *5    *7                    *19             *37       *73
puts 2**10 *3**3  *5**2                               *23 *31                 *89
puts 2**13 *3**3  *5          *11                                 *43                 *127
puts 2**14 *3     *5    *7                    *19         *31                                   *151
puts 2**13 *3**2        *7    *11    *13                          *43                 *127
puts 2**5  *3**4        *7**2 *11**2          *19**2                                  *127
puts 2**8  *3**2        *7**2        *13      *19**2          *37       *73           *127
puts 2**7  *3**10 *5                     *17          *23                        *107                                               *3851
puts 2**7  *3**6  *5                     *17          *23                                  *137           *547           *1093
puts 2**14 *3**2        *7**2        *13      *19**2      *31                         *127      *151
puts 2**5  *3**4        *7**2 *11**2          *19**4                                            *151                *911
puts 2**9  *3**4        *7    *11**3                      *31**2     *61    *83                      *331
puts 2**8  *3**2        *7**2        *13      *19**4            *37     *73                     *151                *911
puts 2**25 *3**3  *5**2                       *19         *31                                                  *683            *2731       *8191
puts 2**17 *3**10       *7                    *19**2  *23       *37     *73      *107 *127                                           *3851
puts 2**17 *3**6        *7                    *19**2  *23       *37     *73           *127 *137           *547           *1093
puts 2**25 *3**4        *7    *11**2          *19**2                                  *127                     *683            *2731       *8191
puts 2**25 *3**5        *7**2        *13      *19**2                                  *127                     *683            *2731       *8191
puts 2**17 *3**10       *7                    *19**4  *23       *37     *73      *107           *151                *911             *3851
puts 2**25 *3**10 *5                          *19     *23                        *107                          *683            *2731 *3851 *8191
puts 2**17 *3**6        *7                    *19**4  *23       *37     *73                *137 *151      *547      *911 *1093
puts 2**25 *3**6  *5                          *19     *23                                  *137           *547 *683      *1093 *2731       *8191
puts 2**25 *3**4        *7    *11**2          *19**4                                            *151           *683 *911       *2731       *8191
puts 2**25 *3**5        *7**2        *13      *19**4                                            *151           *683 *911       *2731       *8191
puts 2**33 *3**4        *7    *11**3                      *31        *61    *83                      *331                                        *43691 *131071
puts 2**33 *3**10       *7    *11                     *23                   *83  *107                *331                      *3851             *43691 *131071
puts 2**33 *3**6        *7    *11                     *23                   *83            *137      *331 *547           *1093                   *43691 *131071
puts 2**37 *3**4        *7    *11**3                      *31        *61    *83                      *331                                        *43691        *174763*524287
puts 2**37 *3**10       *7    *11                     *23                   *83  *107                *331                      *3851             *43691        *174763*524287
puts 2**37 *3**6        *7    *11                     *23                   *83            *137      *331 *547           *1093                   *43691        *174763*524287

Rev 1
Just starting to gather some terms.
#683*2731*8191=15278451143, 137*547*1093=81908327, 107*3851=412057, 174763*524287=91625968981, 19**2*151*911=49659521, 83*331=27473, 11**3*31*61=2516921,37*73=2701,19*19=361

puts 2**5  *3**3  *5       *7
puts 2**3  *3**2  *5       *7           *13
puts 2**2  *3**2  *5       *7**2        *13      *19
puts 2**9  *3**3  *5             *11                         *31
puts 2**7  *3**3  *5**2                     *17              *31
puts 2**9  *3**2           *7    *11    *13                  *31
puts 2**8  *3     *5       *7                    *19                *2701
puts 2**10 *3**3  *5**2                                  *23 *31                 *89
puts 2**13 *3**3  *5             *11                                 *43                 *127
puts 2**14 *3     *5       *7                    *19         *31                               *151
puts 2**13 *3**2           *7    *11    *13                          *43                 *127
puts 2**5  *3**4           *7**2 *11**2          *19**2                                  *127
puts 2**8  *3**2           *7**2        *13      *19**2            *2701                 *127
puts 2**7  *3**10 *5                        *17          *23                                                                           *412057
puts 2**7  *3**6  *5                        *17          *23                                                                *81908327
puts 2**14 *3**2           *7**2        *13      *19**2      *31                         *127  *151
puts 2**5  *3**4           *7**2 *11**2          *19**2                                            *49659521
puts 2**9  *3**4           *7                                *31    *2516921  *27473
puts 2**8  *3**2           *7**2        *13      *19**2            *2701                           *49659521
puts 2**25 *3**3  *5**2                          *19         *31                                                            *15278451143
puts 2**17 *3**10          *7                    *19**2  *23       *2701                 *127                                           *412057
puts 2**17 *3**6           *7                    *19**2  *23       *2701                 *127                               *81908327
puts 2**25 *3**4           *7    *11**2          *19**2                                  *127                                                   *15278451143
puts 2**25 *3**5           *7**2        *13      *19**2                                  *127                                                   *15278451143
puts 2**17 *3**10          *7                    *19**2  *23       *2701                           *49659521                            *412057
puts 2**25 *3**10 *5                             *19     *23                                                                            *412057 *15278451143
puts 2**17 *3**6           *7                    *19**2  *23       *2701                           *49659521                *81908327
puts 2**25 *3**6  *5                             *19     *23                                                                *81908327           *15278451143
puts 2**25 *3**4           *7    *11**2          *19**2                                            *49659521                                    *15278451143
puts 2**25 *3**5           *7**2        *13      *19**2                                            *49659521                                    *15278451143
puts 2**33 *3**4           *7                                       *2516921   *27473                                                               *43691 *131071
puts 2**33 *3**10          *7    *11                     *23                   *27473                                             *412057           *43691 *131071
puts 2**33 *3**6           *7    *11                     *23                   *27473                                       *81908327               *43691 *131071
puts 2**37 *3**4           *7                                       *2516921   *27473                                                               *43691        *91625968981
puts 2**37 *3**10          *7    *11                     *23                   *27473                                             *412057           *43691        *91625968981
puts 2**37 *3**6           *7    *11                     *23                   *27473                                       *81908327               *43691        *91625968981

Rev 2, 570  542 bytes (thanks to Martin for the improvement)
As this is my first Ruby program, I just stuck with the simple approach of continuing to gather terms. Compression of the numbers would be great if anyone knows how to do that.
I could save a few more bytes by evaluating some of the literal-only expressions in the variable assignment part, but I decided to leave them for clarity.
e=361
f=e*e*137561
g=27473
h=2516921
j=2701
k=81908327*729
m=412057*59049
n=15278451143*2**25
p=g*43691*2**33*7
q=131071
r=91625968981*16
s=127
t=1024
w=250240
x=1467648
y=7439488
puts [30240,32760,2178540,23569920,45532800,142990848,510720*j,t*42833475,t*510840*s,t*149417520,t*3099096*s,15367968*e*s,x*e*j*s,w*m,w*k,t*429378768*e*s,15367968*f,8999424*g*h,x*j*f,n*397575,t*m*y*j*s,t*k*y*j*s,n*68607*e*s,n*154791*e*s,t*20608*j*f*m,2185*n*m,t*20608*j*f*k,2185*k*n,68607*f*n,154791*f*n,81*h*p*q,253*p*m*q,253*p*k*q,81*h*p*r,253*p*m*r,253*p*k*r]

no need for all that assignment to z and the for loop at the end. simply put the puts right in front of that array (and I don't think you'll need a space after the puts in that case). you should be able to save a few more bytes, by e.g. assigning j when it's first used, like ...,510720*j=2701,.... and I think a few more if you give 253*p a name.

Thanks @MartinBüttner, I had assumed that puts [1,2,3] would not insert a newline after each number, but it seems it does, at least in interactive mode on my PC (but not on the Ruby website.) I will edit that in later. I reckon with a bit of effort it should be possible to get close to 500 bytes with this type of program, but I'm not that interested in pushing it further right now. When I know more Ruby I'd like to use some kind of compression as well as taking advantage of the prime factorisation. Or you could post an answer and show me how it's done :-D

Ruby has a bit-shift operator a<<b, which lets you write a*2**b shorter.

JavaScript, 572 (?) bytes
_=>`@r>=V6R=bWn3s*Ch=%{Fg>QNM'|c6SMH>wF=*
IElopM2Mw=?-,Knb7bW{\\=\rH3j=N9.3l*jm6Y(.wJP|
tFR7vmvt/))*D.F)  . n}Hk18KTn0a{E6
w1z0]\\o.jV"ytga25d+~VNP{0v:zq[d)  |.]d,t6P5:;:*?9m[8sI>\\R"'
wG*<#[^L/HFzAISvBDnmuy;+JNQj_n{[*d6DH#HtsLt}\`T+DX3T6/17
guv,\\d8G!\\9;Wug[78\\Iw]5"
r!~ZqN96Y\\99-gCoT_w.3SHF:p||;j*uwm+
1mSXJ<bE1UT]\r:(QEJ3LGPM$8Le3WXCoU;3*jW.7:"5m7f"0S3k9Eko`.replace(/./gs,p=>p.charCodeAt().toString(2).padStart(7,0).slice(-7)).replace(/00|01.|1...|111$/g,d=>`0 12
3456789
`[parseInt(d,2)])

Potentially slightly more than 572, but without TIO I'm not sure if a different interpreter I used is counting a few 0x80 bytes (two bytes in UTF-8) correctly.
Explanation:
Uses huffman coding, where between two and four bits map to each digit:
0   00
1   010
2   011
3   1000
4   1001
5   1010
6   1011
7   1100
8   1101
9   1110
\n  1111 or 111

Each character is ASCII, so I get seven bits per byte. Some, like ` and \ need two bytes, and \0 (null) is represented with 0x80.

Scratch, 327 bytes (Illegitimate)
Try it online!
I was really excited to submit this answer, but then I read the first rule, stating that my program must generate all 36 numbers before I can submit. However, this rule makes hard-coding the only viable option, which is not optimal. I decided to circumvent the several millennia necessary to satisfy this rule, and submitted an answer anyway! To make up for this heinous act, I will be explaining the code in depth here, in addition to on Scratch.
Full code
when gf clicked
delete all of[4 v
delete all of[f v
set[N v]to(
forever
change[N v]by(1
set[F v]to(
repeat until<(F)=(N
change[F v]by(1
repeat until<((N)/(F))=(round((N)/(F
change[F v]by(1
end
add(F)to[f v
end
set[S v]to(
repeat(length of[f v
set[S v]to((S)+(item(1)of[f v
delete(1)of[f v
end
if<(S)=((N)*(4))>then
add(N)to[4 v

Setup
when gf clicked       Initiates the code
delete all of[4 v     Clears the list of 4-perfect numbers
delete all of[f v     Clears any residual factors from a previous run of the code
set[N v]to(           Sets the number that will be checked for 4-perfection to 0
forever               Run the following code an infinite amount of times

Factorization
change[N v]by(1                       Increments the number to be tested for 4-perfection
set[F v]to(                           Resets the factor that will be tested on the number
repeat until<(F)=(N                   Runs the following code when there is still a factor to be checked for
change[F v]by(1                       Increments the factor that will be tested on the number
repeat until<((N)/(F))=(round((N)/(F  Loops code until a valid factor is found
change[F v]by(1                       Increments the factor that will be tested on the number
end                                   Marks the end of the code that needs to loop
add(F)to[f v                          Adds the valid factor to the list of factors
end                                   Marks the end of the code that needs to loop

Summation
set[S v]to(                       Resets the sum of the factors
repeat(length of[f v              Loops code for each factor in the list
set[S v]to((S)+(item(1)of[f v     Adds item 1 of the factor list to itself
delete(1)of[f v                   Deletes the obsolete 1st item in the list, making the 2nd item the new 1st item
end                               Marks the end of the code that needs to loop

4-Perfection Check
if<(S)=((N)*(4))>then     Runs code if the sum of factors is 4 times the original value
add(N)to[4 v              Adds the 4-perfect value to the list
                   NB: "if", "repeat", and "forever", blocks don't need an "end" statement when they're at the end of a script.
                   NB: Groupings ([], (), <>) don't need to be closed if they're at the end of a line.

Please understand that I have no intentions of undermining the integrity of the challenge, but I wanted to demonstrate the potential of non hard-coded programs. Scratch is a moderately verbose language- imagine how small a more golf-friendly language could be!

Deadfish~, 3758 bytes
{iiiii}icdddciiciicddddc{dddd}iic{iiii}icdciiiiicdcddddddc{dddd}iic{iiii}cdciiiiiicicdddcdcddddc{dddd}iic{iiii}ciciiciciiicc{d}iiicddc{dddd}iic{iiii}iiciccddcdciiiiiic{d}iicc{dddd}iic{iiii}dciiicddc{i}dddcc{d}ic{i}ddcddddciiiic{dddd}ddddddc{iiii}dciiciiiiciicdddddcicdciiicdddddcddc{dddd}iic{iiii}iicdciiiiicddcdddddciiiciiicicddddcddddcc{dddd}iic{iiii}iiiiccddcdcciiiicdddddcddciiicdcddc{dddd}iic{iiii}dciiiicddcdddcciiiciicdcddddciiiiciiiic{d}iic{dddd}iic{iiii}iicddddciiicdddciiicddciciciiiccddddddc{i}ddc{dddd}ddddddc{iiii}iiiiic{d}iiiciiiiciciicddcdddcciiiiiiccicdddc{dddd}ddddc{iiii}dc{i}dddc{d}iiiciiiiiicdddcddciiiiiiccdddddciciiciiic{d}iciiiiicic{dddd}ddddc{iiii}iiiicddddddc{i}ddccdcdddddciiiiiic{d}iiciicdcciiiiicddddddciiicdcddc{dddd}iic{iiii}dciiiciiiiicdddddcddcdcicicdciiiiicdccddcdddc{i}ddc{d}iiicddc{dddd}iic{iiii}cddciciiiiciiic{d}iiic{i}dddcdddciiicdddciicddcddcddc{i}ddc{d}iciiiic{dddd}ddc{iiii}ciiiiicddccdddddciic{i}dddc{d}icciiiiiciiiicdddddcddddciicdciiicddddc{i}ddc{dddd}ddddddc{iiii}iiiicddddccciiiiiicddcdcdddddciiiiiiciic{d}iiicciiiicddddciiiicddciiiiiic{d}iiic{dddd}c{iiii}iiiiicddddddcdciiiiiicdcdddddc{i}dddcddcddddcdciiiicdddc{i}ddc{d}icc{i}dddcddddcdddc{i}ddcc{dddd}ddddddc{iiii}cddciiiciiiiicddddddcddc{i}dddc{d}iiiccc{i}ddcdddddciiicdddcicddciiicdciicddcdcdcddcc{dddd}iic{iiii}iiiicdddciiciiicdddddcdddciicddciciiiiicccddddddciic{i}dddcdddddcdcddc{i}ddcdcdcicicdddcdddcdc{dddd}c{iiii}dciiiicicddddddciiiciiicicdddciiiicicdddddcciiicddddciiiiiic{d}iciciiiiiicdddciciiiic{d}iicdciiiiiciiciic{d}iiic{dddd}c{iiii}dciiiiicdddddciciiicddcdciiiiiicddcddddddcc{i}dcddciicddddddcdciiiiciicddddddciciiiiicddcicddddciicddddcdciiiic{dddd}ddc{iiii}iciiicdddciiiiic{d}iiic{i}ddcddddddciiiiiicddcddddciiicddddddc{i}dcddddddciiiiicdddcddcdddc{i}ddc{d}iiic{i}ddcdddddciiiicddcdcddddciiiicdddc{dddd}c{iiii}ciiciiiicddcddddcccicdddciiiccddciciiciiicdddcddc{i}dddcdddcddcdddcccdciiicdddc{i}dddcdddciiicddddddciiciiic{dddd}ddddc{iiii}ciiiiicdddddciiiccdddciiiiicddddddcdc{i}dcdccicdddddcdciiicicdcicddddcciiiiicicddddcdddddcciiiccicddddc{i}ddc{d}iic{dddd}iic{iiii}iiiicdddddcdciciiciciiccddddcciiiiiicddddddc{i}dddc{d}iicic{i}dddccdc{d}iiic{i}ddc{d}iiciicdciiicdddciiicddciciiciic{d}iiiciiiiic{dddd}ddddc{iiii}iiiicciiccddcdddddciiiiciicddddciiiiicdddcdddddciiicdddciiiiiicddcddddcciiiciiiiiic{d}iicdc{i}dcddddddcdddc{i}dddciic{d}iiiciicciiiic{d}iic{dddd}iic{iiii}iiiicdddcdddciiiiicddcdciciiciiccddddddcdciiiicddcddcc{i}dddciicddddcdddddc{i}ddcddddcddciiiiiicdddddciiicddddciciicdddddciiiiiciiiic{d}iiic{dddd}c{iiii}dciiicddcciiiicddddddciiiiiicddddddciiiiiicdddcdciiiicddcddddcciiiiicicdddcciiiiiicddddddcdcciciiiiiic{d}iic{i}ddcddcc{d}iiiccc{i}dcdddc{dddd}ddddc{iiii}dc{i}ddc{d}iiiciiiiiicddcddddccicdddcciiciciiicdddcddc{i}dddc{d}iiciiiiciiiiicc{d}iiiciiiiiicddddddciiiciiic{d}iiiciiccddciiiiicddcddddciiicdc{dddd}c{iiii}iiiciiicddddddciciciiiicddddciiiciic{d}iicciiiiciiicdddciicdddcdciiicdddciiiiiic{d}iic{i}ddc{d}iicciiiicdddddciiciiiciiicdciic{d}iic{i}ddc{d}ic{i}dddcddddcdciiiiiic{dddd}ddddddc{iiii}dciiicddc{i}dddc{d}iicc{i}ddccdddcdddcdddc{i}dcddciicdddddciiicddddcciiiiciicdddcdddcdc{i}dddc{d}iiic{i}dddc{d}ic{i}dcddciicdddddciiciic{d}iiicciiiiciiiicdddciic{dddd}ddddddc{iiii}cdciiiiciicddddddciiicdciiiiiicdcdddcdddciiiicddddddcicciiciiiiiicdddddcddciiiicic{d}iiic{i}dddciic{d}iciiiiicdddddciiiiiciicdddddcdciiiiicdddddciiicddciiicdddddc{i}ddc{d}iiciiicdc{dddd}c{iiii}iiiicdcddddciiciicdddddc{i}dddcddddddciiiiiicddcdddddciiciicciiiccddddciiiiiic{d}iiiciiiiiic{d}iiicdcicicdciiicddddciicicicccdddcciiiiiicddddddciiciiiiciicdddciicdddddccdciiiiiic{dddd}ddddddc{iiii}dciiiiciiiicdcddddcicciiic{d}iiiciiiiciiiicdddcddciiccdcddddcdciiiiciciiiicdcddddddcciiciiicccddddcicdcddciiiciicddddddc{i}dddcddcdddcdc{i}dddcdccddddddc{i}ddcdddciic

It had to be done.

Do you use any kind of generators for generating such huge Deadfish~ codes?

Perl, 629 bytes
(Not counting one line break added for legibility)
use bignum;$_="762K7FF8G213DECG167A6O2B6C68K885DEO5238CFOA36590COF77C22S239FB8CS5DD688ASA40BF4CBEKA54B500277O15A1AA76D5D18K3515C82E18268K479DC3635ACS3D2C86DAC7F142K8A2CE47EB04E2O3DA39DD49D1B489O2B29246D35B6E2_34983A6E0D56A03116W8112111C1388B007CAW535DB1D8191384C3E_BC1718A816B9CA38E_139CE2CE0C2A6520D7D64EAW1580287D7C721FC8E0EFE_30219245E63381BDAD34236W34C38D4A316E11A76BA62_1F166FEDE2AA3B8DEE71C2_4623D01AD5164B207D6A72_5F16A2BFB16257500DB6g2BCF9FAD6C4DE65CA22F8C6Eg6B83D96C6A0809DCDEC5BFF2g3F648C3210B25B8737B940492k1D3523B8D99B8761B6AFBE903D97Ak47AD5F744AA0CC4A843901F8DEAA6k";
s#(\w+?)([G-z])#print hex($1)<<(ord($2)-71),$/#ge

The numbers are hard-coded in hexadecimal with a bit of compression applied to the trailing zeroes.
Try it out here.


text:
Find the substring with the most 1's in a sequence
Introduction
I want to find the substring with the most 1's in a sequence of 0's and 1's.
Input
Your program has two inputs, the sequence and the substring length.
The sequence is any number of 0's and 1's:
01001010101101111011101001010100010101101010101010101101101010010110110110

The substring length is any positive non-zero integer:
5

Output
Your program should output the starting index of the first substring of the given length that contains the most 1's. With the above input, the output is:
10

The first character in the string starts at an index of 0.
Scoring
Shortest code wins!
Rules

Your program must always output the correct index for any valid inputs.
You can pick your input/output method from any answer with positive score on the default options. Please specify the method you pick in your answer.

Your title and introduction says "find the substring with the most 1's".  But your program description says you are giving a substring length and looking for the index of the first substring.  So should we assume that the title and introduction are wrong?  Most people seem to be solving the first part.  Who wins?

@swstephe I'm not sure I understand your confusion. If there are more than one substring tied for the most 1's, you output the first substring you found. You identify the substrings with the index of the first character in that substring. Does that help?

Okay, so you are breaking the sequence in substrings and returning the index of the first substring with the most 1's?  It sounded like you were looking for substrings of 1's.

Does requirement "must always output the correct index for any given inputs" still apply if we give infeasible  lengths, e.g. length=99?

@smci you can assume for valid input. You don't have to handle a case where the substring length is longer than the sequence.

Dyalog APL, 11
(-∘1+⍳⌈/)+/

Try it here. Usage:
   f ← (-∘1+⍳⌈/)+/
   4 f 0 1 1 0 1 1 1 0 0 0 0 1 1
1

Explanation
This is a dyadic (meaning binary) function that takes the substring length from the left, and the sequence from the right. Its structure is the following:
   ┌───┴────┐
 ┌─┴──┐     /
 ∘  ┌─┼─┐ ┌─┘
┌┴┐ + ⍳ / +
- 1   ┌─┘
      ⌈

Explanation by explosion:
(-∘1+⍳⌈/)+/
(       )+/  ⍝ Take sums of substrings of given length, and feed to function in parentheses
    + ⌈/     ⍝ The array of sums itself, and its maximum
     ⍳       ⍝ First index of right argument in left
 -∘1         ⍝ Subtract 1 (APL arrays are 1-indexed)

As an example, let's take 4 and 0 1 1 0 1 1 1 0 as inputs. First we apply the function +/ to them and get 2 3 3 3 3. Then, + and ⌈/ applied to this array give itself and 3, and 2 3 3 3 3 ⍳ 3 evaluates to 2, since 3 first occurs as the second element. We subtract 1 and get 1 as the final result.

In your example, the length is 4, but there are no 4 same items in a row (01101110), so why does it output anything at all?

@ThomasW. The example in the challenge has no 5 same items in a row either, and yet the output is 10. The way I interpret the task is that I need to find the first index of a substring of the given length that has m ones, where m is maximal.

Ruby, 42
f=->s,n{(0..s.size).max_by{|i|s[i,n].sum}}

Takes input by calling it, e.g.
f['01001010101101111011101001010100010101101010101010101101101010010110110110',5]
This compares substrings using their total ASCII value and returns the index of the maximum. I'm not sure if max_by is required by the Ruby spec to be stable but it appears to be in the C implementation.

Python 2, 56
lambda s,l:max(range(len(s)),key=lambda i:sum(s[i:i+l]))

Accepts an array of integers, then the length.

This needs an array of integers as input, so if you start with a string, you need to do: [int(s) for s in "010010...0"]

Bug: f(ss, 999) will return 0 (instead of None). Can you fix that? This arguably violates rule 1.

@smci I have no idea what you're talking about. How am I supposed to know what's in the variable ss? None is never a desired output in any case as the answer is an integer.

C# (Regex), 196
class Test{static void Main(string[]a){System.Console.Write(System.Text.RegularExpressions.Regex.Match(a[1],"(?=((?<o>1)|0){"+a[0]+"})(?!.+(?=[10]{"+a[0]+"})(?!((?<-o>1)|0){"+a[0]+"}))").Index);}}

The actual regex is not that long, but all the fluffs needed for a C# program to compile double the size of the code.
The actual regex, setting the length to 5:
(?=((?<o>1)|0){5})(?!.+(?=[10]{5})(?!((?<-o>1)|0){5}))

(?=((?<o>1)|0){5}): Look-ahead to read 5 characters without consuming, and push all 1's into "stack" o.
(?=[10]{5})(?!((?<-o>1)|0){5}): At a position which has 5 characters ahead, there is not enough item in "stack" o to pop out, i.e. the substring has strictly more 1 than what we have in the current position.
(?!.+(?=[10]{5})(?!((?<-o>1)|0){5})): A position as described above can't be found for the rest of the string, i.e. all position  has less than or equal number of 1's.

Taking the first result gives the answer, since all substrings in front of it has some substring ahead with more 1's, and we have check that any index larger than the current index has less than or equal number of 1's.
(And I learn something nice: the "stack" is restored on backtracking).

Very cool, I wouldn't have guessed you could do this with a regex.

Batch - 222
Batch is obviously the perfect language for this kind of operation.
@echo off&setLocal enableDelayedExpansion&set s=%1&set l=-%2
:c
if defined s set/Al+=1&set "s=%s:~1%"&goto c
set s=%1&set x=0&for /l %%a in (0,1,%l%)do set c=!s:~%%a,%2!&set c=!c:0=!&if !c! GTR !x! set x=!c!&set y=%%a
echo !y!

Un-golfed / dissected:
Initial setup. The variable s is the input string, and l will be the length of the input string, minus the sub-string length (initialized at negative %2 where %2 is the given sub-string length).
@echo off
setLocal enableDelayedExpansion
set s=%1
set l=-%2

Get the length of the input as l, using a pure Batch string length solution - this mangles the variable s containing the input string, so we then set it again.
:c
if defined s (
    set /A l += 1
    set "s=%s:~1%"
    goto c
)
set s=%1

The value of x is used to check which sub-string had the greatest number of 1's. Start a loop from 0 to the length of the string, minus the sub-string length (variable l). Get the sub-string starting from the current point in the loop (%%a), c is set as the input string starting at %%a, and taking %2 (the given sub-string length) characters. Any 0s are removed from c, then the value of c is compared to x - i.e. 111 is a greater number than 11 so we can just use the 'string' to do a greater than comparison. y is then set to current location in the string - which is finally outputted.
set x=0
for /l %%a in (0, 1, %l%) do (
    set c=!s:~%%a,%2!
    set c=!c:0=!
    if !c! GTR !x! (
        set x=!c!
        set y=%%a
    )
)
echo !y!

Using OPs example -
h:\>sub1.bat 01001010101101111011101001010100010101101010101010101101101010010110110110 5
10

Matlab (42)
Let s denote the string and n the substring length. The result is r.
Compute convolution of s with a sequence of n ones, then find the maximum. Convolution is done easily with conv, and the max function returns the position of the first maximum. It's necessary to subtract 1 to the resulting index, because Matlab indexing starts at 1, not 0.
[~, r] = max(conv(s, ones(1,n), 'valid'));
r = r-1;

Golfed:
[~,r]=max(conv(s,ones(1,n),'valid'));r=r-1

Pyth, 12
Mho/<>GNHZUG

This defines a function g, which requires a list of numbers and a number as input.
E.g.
Mho/<>GNHZUGg[0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0)5

You can test it here: Pyth Compiler/Executor
Explanation:
Mho/<>GNHZUG
M             defines a function g(G,H), G is the sequence, H the sequence length
  o       UG  orders the numbers between 0 and len(G)-1 according to the following key
    <>GNH     take the subsequence G[N:N+5]
   /     Z    count the zeros in this subsequence (this is the key)
 h            return the first value of the sorted list (minimum)

Alternative:
Mho_s<>GNHUG

You can get a same length answer using a program that takes a string of values ( 01001...) then the number: ho/<>zNQ\0Uz Sadly, count on a string doesn't auto-convert what you are looking for to a string :(

J, 15 14 chars
   ([:(i.>./)+/\)

   5 ([:(i.>./)+/\) 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0
10

I find it interesting when real languages beat out languages specifically made for code golf. My K entry was eaten or I would have posted it, but it came to 20 characters anyways.

Haskell, 64 62 Bytes
n#l=0-(snd$maximum[(sum$take n$drop x l,-x)|x<-[0..length l]])

Usage:
5#[0,1,0,0,1,0,1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,0,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,1,0,1,0,1,0,0,1,0,1,1,0,1,1,0,1,1,0]

You can save 2 bytes by defining an infix function: n#l=...

you could use an infix function for p. also, I think the 0 is redundant (although the parentheses aren't, and you might need a space instead of that 0).

APL (Dyalog Unicode), 5 bytes
⊃∘⍒+/

Try it online!
⊃∘⍒ is an idiom for "index of maximum", or "argmax", and n +/ bitarray computes the sums over all n-length segments. Uses the system setting ⎕IO←0 to make the output 0-based.

PHP (96)
for($a=$b=$c=0;(($d=@substr_count($s,1,$a,$n))>$c&&($b=$a)&&($c=$d))||$a++<strlen($s););echo $b;
http://3v4l.org/J4vqa
variables $s and $n should be defined on the command line to the search string and substring length, respectively.
This would also work in any C-like language with appropriate functions for substr_count() and strlen().

JavaScript (ES6) 73
A function returning the requested value.
The for loop scans the input string keeping a running total, saving the position of the max value.
F=(a,n)=>(x=>{for(r=t=i=x;a[i];t>x&&(x=t,r=i-n))t+=a[i]-~~a[i++-n]})(0)|r

Ungolfed
F=(a, n) => {
   for(x = r = t = i = 0; a[i]; i++)
     t += a[i] - ~~a[i-n], // ~~ convert undefined values (at negative index) to 0
     t > x && (x=t, r=i-n+1);
   return r;
}

Test In FireFox/FireBug console
F("01001010101101111011101001010100010101101010101010101101101010010110110110",5)

Output 10

To reduce your code, you don't need to define the variables x and r. This should reduce 4 bytes, being the final length of 69 bytes. Also, you probably might be able to replace && with &. But nice one with the ~~ trick!

@IsmaelMiguel you need to init x, else error at first t > x. You need to init r: try F("00000"). And && is needed to emulate and if

You are completely right. I didn't noticed that you were expecting it to ignore (x=t, r=i-n+1) if t was lower or equal than x. That's a good use of lazy evaluation! I wish it could be chopped off somewhere, but I guess you did all the work.

F=(a,n)=>(x=>{for(;a[i];t>x&&(x=t,r=i-n))t+=a[i]-~~a[i++-n]})(r=t=i=0)|r?

Mathematica, 38 36
f=#-1&@@Ordering[-MovingAverage@##]&

Example:
f[{0,1,0,0,1,0,1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,0,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,1,0,1,0,1,0,0,1,0,1,1,0,1,1,0,1,1,0},5]

Output:

10

K (ngn/k), 11 6 bytes
*>+/':

Try it online!
Uses the "argmax" trick from Bubbler's answer.

+/': do a window-reduce (with the first implicit arg being the window length, and the second the sequence)
*> argmax/index of first maximum

C# (Linq), 148 bytes
using System.Linq;class C{int F(string s,int l){return s.IndexOf(s.Skip(l-1).Select((c,i)=>s.Substring(i,l)).OrderBy(p=>-p.Sum(c=>c)).First());}}

Formatted:
using System.Linq;

class C
{
    int F(string s, int l)
    {
        return s.IndexOf(
            s
                .Skip(l - 1)
                .Select((c, i) => s.Substring(i, l))
                .OrderBy(p => -p.Sum(c => c))
                .First()
        );
    }
}

Takes input as method params.
What it does:
string result = s // string is also char collection
    .Skip(l - 1) // make it collection shorter by l-1
    .Select((c, i) => s.Substring(i, l)) // so we can iterate, and select all substrings
    .OrderBy(p => -p.Sum(c => c)) // order substrings descending by sum of characters
    .First() // take first (most ones)

return s.IndexOf(result); // find index of result string

Scala - 70 Bytes
readLine.sliding(readInt).zipWithIndex.maxBy(x=>x._1.count(_=='1'))._2

But with function names as long as zipWithIndex I guess Scala is not the best choice for code golf.

C, 245 185
#include <stdio.h>
main(int argc,char **argv){char *p,*q;int i,s,m=0;for(p=argv[1];*p;p++){for(s=0,q=p;q-p<atoi(argv[2])&&*q;q++)s+=*q-'0';if(s>m){m=s;i=p-argv[1];}}printf("%d\n", i);}

Formatted:
#include <stdio.h>
main(int argc, char **argv) {
        char *p, *q;
        int i, s, m = 0;
        for (p = argv[1]; *p; p++) {
                for (s = 0, q = p; q - p < atoi(argv[2]) && *q; q++)
                        s += *q - '0';
                if (s > m) {
                        m = s;
                        i = p - argv[1];
                }
        }
        printf("%d\n", i);
}

Usage:
$ ./m1s 01001010101101111011101001010100010101101010101010101101101010010110110110 5
10

Jelly, 5 bytes
ṡ§MḢ’

Try it online!
How it works
ṡ§MḢ’ - Main link. Takes the sequence s on the left and the length n on the right
ṡ     - Overlapping slices of s of length n
 §    - Sum of each slice
  M   - Indices of the maximal element
   Ḣ  - First (smallest) one
    ’ - Decrement as Jelly uses 1 indexing

Perl 5 -pl, 50 bytes
$i++,$;[y/1//]||=$i-1for<>=~/(?=(.{$_}))/g;$_=pop@

Try it online!
Input is on two lines with the length first and then the string.

Java  329 bytes
was going to implent a .matches(regex), but it would have been near identical to the python solutions above,  so i tried a sliding window instead. new here, so if anyone has any pointers be glad to hear them.
public class ssMostOnes{
public static void main(String[] a){
    int b=0,w=0;
    for(int i=0;i<a[0].length()-Integer.valueOf(a[1]);i++){
        int c=a[0].substring(i,i+Integer.valueOf(a[1])).length() - a[0].substring(i,i+Integer.valueOf(a[1])).replace("1","").length();
        if(c>w){w=c;b=i;}
    }
    System.out.println(b);
}

}

Some tips: You can initialize i in the third line. Most of the whitespace can be removed. Use System.out.print( (no newline needed). Instead of Integer.valueOf(, you can use new Integer(.

CJam, 25 21 bytes
q~_,,{1$>2$<:+~}$(]W=

Test it here.
Takes input as an integer for the substring length, and an array of zeroes and ones as the sequence:
5
[0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0]

Explanation
q~_,,{1$>2$<:+~}$(p];
q~                    "Read and evaluate the input.";
  _,                  "Duplicate the sequence and get its length N.";
    ,                 "Get an array [0 1 ... N-1].";
     {         }$     "Sort this array stably by the result of the given block.";
      1$              "Copy the sequence.";
        >             "Slice off the first i bits.";
         2$           "Copy the substring length.";
           <          "Truncate the sequence.";
            :+        "Get the sum to find the number of 1s.":
              ~       "Bitwise complement in order to sort from highest to lowest.";
                 (    "Shift off the first index from the sorted list.";
                  ]   "Wrap the entire stack in an array.";
                   W= "Extract the last element (the result), discarding the rest.";

The result is printed automatically at the end of the program.
Note that I'm also considering slices that start closer to the end than the desired substring length, but that's okay, because they are substrings of the last valid substring and will therefore never have more 1s than that last valid substring.

Burlesque, 12 bytes
J'0;;qL[>mss

Try it online!
J     # Duplicate input
'0;;  # Split by 0s
qL[>m # Maximum by length
ss    # Find index of substring in original