Write a compact spelling checker Here is a list of 1000 basic English words. Yes, I'm aware that there are only 997 words in the list! It was taken from Wiktionary so blame them!

Your task is to write a program that accepts a word and returns TRUE or FALSE (or 0 or 1) depending on whether the word is in the list or not. You must use the spelling as it appears in the list, so it is colour, not color (sorry Americans!). As far as I am aware, there is only one word in the list that uses a capital letter: I. This means that i (Roman numeral for 1) should return FALSE. All other words may be spelt with an initial capital letter, i.e. Colour should return TRUE.

Rules for letter cases: Your program should return TRUE for any word that has just the first letter capitalised. If the entire word is capitalised, e.g. COLOUR it's your choice whether it is correct or not, as long as it is found in the word list in its lowercase form. If you accept COLOUR you must accept all other words entirely in capitals. If you don't accept COLOUR you must not accept any other word entirely in capitals. Any other mixture of lower and upper case e.g. coLoUR should return FALSE. As stated above only I is correct, not i. Briefly, both lowercase colour and titlecase Colour must be TRUE, uppercase COLOUR may be either TRUE or FALSE and any other mixed case must be FALSE.

Standard rules apply, you may not use external libraries or spelling libraries built into your language, etc. If you use any external files, such as reading the word list via the internet, you must include that number of bytes in your score. Reading the uncompressed word list will add 5942 to your score.

Your code must be at least 95% accurate, including both false positives and false negatives. So if you have 30 false positives and 20 false negatives there are 50 errors in total which is acceptable (even though there are only 997 words, 94.98% accurate if you're being pedantic). One more false positive or false negative invalidates your code. You must post all the errors for verification. Don't make people guess where the errors are!

Shortest code in bytes wins. Add 10 points for each error. Please post a non-golfed version of your code as well so that other people can try to break it / verify that it works. If you can provide a link to a working online version that would be great! The list is 5942 bytes long so ideally you want your code to be shorter than that.

Start your post with the following:

<Language> - Bytes: <num>, False +ves: <num>, False -ves: <num> = Score: <num>

Score = bytes + 10 × (false_pos + false_neg)

I might provide a list of false positives to check against as people post answers.

Python - Bytes: 4411, False +ves: 0, False -ves: 0 = Score: 4411

import base64,zlib,sys;T=eval(zlib.decompress(base64.b64decode("[encoded data, 4228 characters]")));t=T;f=1
for c in sys.argv[1]:
 C=c.lower()
 if c in t:t=t[c]
 elif f and C in t:f=0;t=t[C]
 else:t={}
print""in t

This is a python program that expects one command line argument, the word. From the list of words I constructed a trie, zlib'ed the argument and finally encoded it with base64. If the word is in the trie, the program prints True, otherwise it prints False. I wanted to create a spell checker that has 100% accuracy.

I could substantially decrease the number of characters, by not encoding the zlib'ed string (specifically, zlib'ed string is 1113 characters shorter than base 64 encoded), but I wanted to have a code that you can copy/paste directly.

Examples

$python check.py colour
True

$python check.py Colour
True

$python check.py coLoUr
False

$python check.py color
False

$python check.py Color
False

$python check.py I
True

$python check.py i
False

The trie is traversed with characters of the word, each time getting a new trie from the key of current character. If the word is in the trie, then a "" must be present in the final trie.

Ungolfed version

import base64, zlib, sys

TRIE = eval(zlib.decompress(base64.b64decode("[encoded data, 4228 characters]")))

trie = TRIE
first = True
for character in sys.argv[1]:
    CHARACTER = character.lower()
    if character in trie:
        trie = trie[character]
    elif first and CHARACTER in trie:
        first = False
        trie = trie[CHARACTER]
    else:
        print False
if "" not in trie:
    print False
print True

Construction of base 64 encoded, zlib'ed trie

f = file("dictionary","r")
END = ""
TRIE = {}

def addWord(word):
    trie = TRIE
    for character in word:
        trie = trie.setdefault(character, {})
    trie.setdefault(END, 0)

for line in f.readlines():
    l = line.replace("\n", "")
    addWord(l)

import zlib, base64
compressed = zlib.compress(str(TRIE).replace(" ", ""), 9)
print base64.b64encode(compressed)


Determining the rotation of square given a list of points In this challenge, you will be given a list of points.  These points lie on the perimeter of an imaginary square.  Your goal is to:

If possible, print out the rotation of the square, which will be a value from [0, 90) where 0 represents a square with lines vertical and horizontal.  The rotation is to be given in degrees counted counter-clockwise.
If the rotation of the square is ambiguous (such as only being given 2 points), print out "Unknown"
If creating a square given the points is impossible, print out "Impossible"

The points you are given are guaranteed to be unique, and are in no particular order.  You can use any format you wish to input the list, but for my examples, my points will be in the format x,y, and space separated.  The numbers are floating-point numbers, and you can assume they are within a range that your language can handle.  Your output should be accurate to at least 3 decimal places, and assume your language handles floating point numbers with perfect accuracy.

Here are some test cases (I have made most of these using whole numbers for easy visualizing, but your program should handle floating points):

Unknown:

0,0
0,0 1,0
0,0 1,0 0,1
0,0 1,0 0,1 1,1
0,1 0,2 1,0 1,3 2,0 2,3 3,1 3,2

Impossible:

0,0 1,0 2,0 3,1 4,2
0,0 1,0 2,0 1,1
0,1 0,2 1,0 1,3 2,0 2,3 3,1 3,2 2,2
2,0 0,1 2,2 0,3
0,0 2,1 0,2 2,2 -1,1

Possible (if not designated, should return 0):

0,0 1,0 2,0
0,0 0.3,0.3 0.6,0.6  (should return 45)
0,0 0.1,0.2 0.2,0.4  (should return appx 63.435 (the real value is arctan(2)))
0,0 0,1 2,1 2,2
0,1 0,2 1,0 1,4 2,0 2,4 4,1 4,3

I may have missed some interesting test cases.  If so, please comment to add them.

This is code-golf, so the shortest-code wins!

Rev 1: Ruby, 354 bytes

further golfing thanks to blutorange.

->a{t=s=Math::PI/18E4
d=r=c=0
a=a.map{|e|e-a[0]}
0.upto(36E4){|i|b=a.map{|e|(e/Complex.polar(1,i*s)).rect}.transpose
m,n=b
if n.min>=f=0
l=[m.max-x=m.min,n.max].max
a.each_index{|j|f+=((l-w=n[j])*(x+l-v=m[j])*(x-v)*w)**2}
(1E-9>q=f/l**8)&&(c>0&&(i-d)%9E4%89E3>1E3?c=9E9:0;c+=1;d=i)
q<t&&(r=i)&&t=q;end}
c<101&&a[1]?c<1?'impossible':r%9E4/1.0E3:'unknown'}

Ruby, 392 bytes

->(a){
s=Math::PI/18E4
t=1
d=r=c=0
a=a.map{|e|e-a[0]}
(0..36E4).each{|i|
b=a.map{|e|(e/Complex.polar(1,i*s)).rect}.transpose
m=b[0]
n=b[1]
x=m.min
if n.min>=0
l=[m.max-x,n.max].max
f=0
a.each_index{|j|f+=((l-n[j])*(x+l-m[j])*(x-m[j])*n[j])**2}
q=f/l**8
if q<1E-9
c>0&&(i-d)%9E4%89E3>1E3?(c=9E9):0
c+=1
d=i
end
if q<t
r=i
t=q
end
end
}
c>100||a.size<2?'unknown':c<1? 'impossible':r%9E4/1.0E3
}

The algorithm is as follows:

-Pick an arbitrary point (the first one) and move that to the origin (subtract the coordinates of this point from all points in the list.)

-Try all rotations of the square about the origin in 0.001 degree increments, through 360 degrees.

-For a given rotation, if all points are above the y axis, draw the smallest possible square around all the points, incorporating the lowest and leftmost point.

-Check if all points are on the edge. This is done with a soft calculation that takes each point, finds the squared distances from all edges, and multiplies them together. This gives a good fit rather than a yes/no answer. It is interpreted that a solution is found if this product divided by sidelength^8 is less than 1E-9. In practice this is less than a degree of tolerance.

-The best fit is taken mod 90 degrees and reported as the correct angle.

Currently the code returns a value of ambiguous if over 100 solutions are found (at 0.001 degree resolution. That's 0.1 degrees of tolerance.)

first fully working function, in test program

I left the resolution at 1/10th of the required resolution to make the speed reasonable. There is an error of 0.01 degress on the very last test case.

g=->(a){
 s=Math::PI/18000
 t=1
 d=r=-1
 c=0
 a=a.map{|e| e-a[0]}

 (0..36000).each{|i|
    b=a.map{|e|(e/Complex.polar(1,i*s)).rect}.transpose

    m=b[0]
    n=b[1]
    x=m.min

    if n.min>=0

       l=[m.max-x,n.max].max
       f=0
       a.each_index{|j|f+=((l-n[j])*(x+l-m[j])*(x-m[j])*n[j])**2}
       q=f/l**8

       if q<1E-9

         j=(i-d)%9000
         c>0&&j>100&&j<8900?(c=9E9):0
         c+=1
         d=i
       end

       if q<t
         r=i
         t=q
       end

     end
  }

 print "t=",t,"   r=",r,"     c=",c,"    d=",d,"\n"
 p c>100||a.size<2?'unknown':c<1? 'impossible':r%9000/100.0
}

#ambiguous
#g.call([Complex(0,0)])
#g.call([Complex(0,0),Complex(1,0)])
#g.call([Complex(0,0),Complex(1,0),Complex(0,1)])
#g.call([Complex(0,0),Complex(1,0),Complex(0,1),Complex(1,1)])
#g.call([Complex(0,1),Complex(0,2),Complex(1,0),Complex(1,3),Complex(2,0),Complex(2,3),Complex(3,1),Complex(3,2)])

#impossible
#g.call([Complex(0,0),Complex(1,0),Complex(2,0),Complex(3,1),Complex(4,2)])
#g.call([Complex(0,0),Complex(1,0),Complex(2,0),Complex(1,1)])
#g.call([Complex(0,1),Complex(0,2),Complex(1,0),Complex(1,3),Complex(2,0),Complex(2,3),Complex(3,1),Complex(3,2),Complex(2,2)])
#g.call([Complex(2,0),Complex(0,1),Complex(2,2),Complex(0,3)])
#g.call([Complex(0,0),Complex(2,1),Complex(0,2),Complex(2,2),Complex(-1,1)])

#possible
g.call([Complex(0,0),Complex(1,0),Complex(2,0)])
g.call([Complex(0,0),Complex(0.3,0.3),Complex(0.6,0.6)]) #(should return 45)
g.call([Complex(0,0),Complex(0.1,0.2),Complex(0.2,0.4)]) #(should return appx 63.435 (the real value is arctan(2)))
g.call([Complex(0,0),Complex(0,1),Complex(2,1),Complex(2,2)])
g.call([Complex(0,1),Complex(0,2),Complex(1,0),Complex(1,4),Complex(2,0),Complex(2,4),Complex(4,1),Complex(4,3)])

golfed version, resolution compliant with spec, takes about a minute per call, in test program.

There's still a pesky error of 0.001 degrees on the last test case. Increasing resolution further would probably eliminate it.

g=->(a){                                                            #take an array of complex numbers as input
  s=Math::PI/18E4                                                   #step size PI/180000
  t=1                                                               #best fit found so far
  d=r=c=0                                                           #angles of (d) last valid result, (r) best fit; c= hit counter
  a=a.map{|e|e-a[0]}                                                #move shape so that first point coincides with origin
  (0..36E4).each{|i|                                                #0..360000
    b=a.map{|e|(e/Complex.polar(1,i*s)).rect}.transpose             #rotate each element by dividing by unit vector of angle i*s, convert to array...
    m=b[0]                                                          #...transpose array [[x1,y1]..[xn,yn]] to [[x1..xn],[y1..yn]]...
    n=b[1]                                                          #...and assign to variables m and n
    x=m.min                                                         #find leftmost point
    if n.min>=0                                                     #if all points are above x axis
       l=[m.max-x,n.max].max                                        #find the sidelength of smallest square in which they will fit
       f=0                                                          #f= accumulator for errors. For each point
       a.each_index{|j|f+=((l-n[j])*(x+l-m[j])*(x-m[j])*n[j])**2}   #...add to f the product of the squared distances from each side of the smallest square containing all points
       q=f/l**8                                                     #q= f normalized with respect to the sidelength.
       if q<1E-9                                                    #consider a hit if <1E-9
         c>0&&(i-d)%9E4%89E3>1E3?(c=9E9):0                          #if at least one point is already found, and the difference between this hit and the last exceeds+/-1 deg (mod 90), set c to a high value
         c+=1                                                       #increment hit count by 1 (this catches infinitely varible cases)
         d=i                                                        #store the current hit in d
       end
       if q<t                                                       #if current fit is better than previous one
        r=i                                                         #store the new angle
        t=q                                                         #and revise t to the new best fit.
       end
    end
  }
  c>100||a.size<2?'unknown':c<1? 'impossible':r%9E4/1.0E3           #calculate and return value, taking special care of case where single point given.
}
#ambiguous
puts g.call([Complex(0,0)])
puts g.call([Complex(0,0),Complex(1,0)])
puts g.call([Complex(0,0),Complex(1,0),Complex(0,1)])
puts g.call([Complex(0,0),Complex(1,0),Complex(0,1),Complex(1,1)])
puts g.call([Complex(0,1),Complex(0,2),Complex(1,0),Complex(1,3),Complex(2,0),Complex(2,3),Complex(3,1),Complex(3,2)])

#impossible
puts g.call([Complex(0,0),Complex(1,0),Complex(2,0),Complex(3,1),Complex(4,2)])
puts g.call([Complex(0,0),Complex(1,0),Complex(2,0),Complex(1,1)])
puts g.call([Complex(0,1),Complex(0,2),Complex(1,0),Complex(1,3),Complex(2,0),Complex(2,3),Complex(3,1),Complex(3,2),Complex(2,2)])
puts g.call([Complex(2,0),Complex(0,1),Complex(2,2),Complex(0,3)])
puts g.call([Complex(0,0),Complex(2,1),Complex(0,2),Complex(2,2),Complex(-1,1)])

#possible
puts g.call([Complex(0,0),Complex(1,0),Complex(2,0)])
puts g.call([Complex(0,0),Complex(0.3,0.3),Complex(0.6,0.6)]) #(should return 45)
puts g.call([Complex(0,0),Complex(0.1,0.2),Complex(0.2,0.4)]) #(should return appx 63.435 (the real value is arctan(2)))
puts g.call([Complex(0,0),Complex(0,1),Complex(2,1),Complex(2,2)])
puts g.call([Complex(0,1),Complex(0,2),Complex(1,0),Complex(1,4),Complex(2,0),Complex(2,4),Complex(4,1),Complex(4,3)])

Note that for about 30% more code this algorithm could be adapted to work fast: it is obvious that in cases with a finite number of solutions, one of the edges lies flat along a a cube, so all we really have to try is those angles that correspond to each pair of vertices.  It would also be necessary to do a bit of wiggling to check there aren't there aren't infinitely many solutions.


Can Alice win the game? Can Alice win the game?

The game's rules are as follows. First, a finite non empty set of positive integers \$X\$ is defined. Then, Alice and Bob take turns choosing positive integers, with Alice going first. Each integer must be strictly less than the previous one, and the game ends when one of the players chooses \$1\$.

Alice wins if the numbers she and Bob chose sum to a number in \$X\$, otherwise Bob wins.

Example games

Define \$X=\{20, 47\}\$. Alice chooses \$19\$, Bob chooses \$2\$, Alice chooses \$1\$. We have \$19+2+1=22\$ which is not in \$X\$ so Bob wins.

Define \$X=\{5, 6, 7, 8\}\$. Alice chooses \$4\$, Bob chooses \$3\$, Alice chooses \$1\$. We have \$4+3+1=8\$ which is in \$X\$ so Alice wins.

Challenge

Your challenge is to write a program or function without standard loopholes which, when given a collection of positive integers \$X\$, will output or produce some consistent value if Alice has a winning strategy, and a different consistent value if Alice does not have a winning strategy.

A winning strategy is a strategy which will let Alice win no matter how Bob plays.

Note that in the first example game Alice did not have a winning strategy: If her first choice was any number other than \$19\$ or \$46\$ then Bob could choose \$1\$ and win. On the other hand if her first choice was \$19\$ or \$46\$ then Bob could choose \$2\$ and win.

In the second example, Alice did have a winning strategy: After choosing \$4\$, she could choose \$1\$ after any of Bob's possible choices and win (or Bob could choose \$1\$ and she would win immediately).

Input and output

The input will be a collection of positive integers in ascending order, in any convenient format, given with any convenient input method. This collection represents the set \$X\$. The output will be one of two distinct values chosen by you, depending on whether or not Alice has a winning strategy with the given collection. Example IO:

Input    -> Possible Output
20 47    -> false
5 6 7 8  -> true
5 6 7 10 -> true (Alice chooses 4. If Bob chooses 3, Alice chooses 2; otherwise she chooses 1.)
5 6 7 11 -> false (A chooses n>6, B chooses n-1. A chooses 6 or 5, B chooses 2. A chooses 4, B chooses 3. A chooses n<4, B chooses 1.)

Rules

No standard loopholes
Shortest code in bytes wins

Note

This was the result of trying to make a finite version of the Banach Game.

JavaScript (ES6),  89 85 83  81 bytes
Takes input as a set. Returns either \$0\$ or \$1\$.
Note: Although it doesn't make sense from a theoretical perspective, the set is expected to be defined in ascending order so that the highest value appears at the end once it's converted back to an array.

f=(s,n=~[...s].pop(),b,t=0,g=i=>--i>n?b^f(s,i,!b,t-i)||g(i):0)=>~n?b^g``:s.has(t)

Try it online!
Commented
  f = (         // f is a recursive function taking:
    s,          //   s = input set
    n = ~[...s] //   n = opposite of the value played by the previous player,
        .pop(), //       or -(maximum value of the set + 1) for the first iteration
    b,          //   b = flag telling whether it's Bob's turn
    t = 0,      //   t = sum of all (positive) values played so far
    g = i =>    //   g is a recursive function taking a counter i <= 0
      --i > n ? //     decrement i; if i is greater than n:
        b ^     //       invert the result of the following call if it's Bob's turn
        f(      //       recursive call to g:
          s,    //         pass s unchanged
          i,    //         pass the new value of i
          !b,   //         invert the flag b
          t - i //         subtract i from the sum
        )       //       end of recursive call
        || g(i) //       if the above result is falsy, try a recursive call to g
      :         //     else:
        0       //       stop recursion
  ) =>          //
    ~n ?        // if n is not equal to -1:
      b ^ g``   //   invoke g with i = [''] (zero'ish)
                //   and invert the result if it's Bob's turn
    :           // else:
      s.has(t)  //   return true if t is in s (Alice wins), or false otherwise


Resistors of Unusual Value Introduction

When building an electronics project, a schematic may call for a resistor of an unusual value (say, 510 ohms).  You check your parts bin and find that you have no 510-ohm resistors.  But you do have many common values above and below this value.  By combining resistors in parallel and series, you should be able to approximate the 510-ohm resistor fairly well.

Task

You must write a function or program which accepts a list of resistor values (resistors you stock) and a target value (which you aim to approximate). The program must consider:

Individual resistors
Two resistors in series
Two resistors in parallel

The program should compute all possible combinations of 1 and 2 resistors from the stock list (including two copies of the same resistor value), compute their series and parallel resistance, then sort the configurations according to how well they approximate the target value.

The output format should be one configuration per line, with a + denoting series and | denoting parallel, and some space or an = sign before the net resistance.

Formulas

The resistance of one resistor is R1
The net resistance of two resistors in series is R1 + R2
The net resistance of two resistors in parallel is 1 / (1/R1 + 1/R2)
The distance between an approximated resistance value and the target value can be calculated as pseudo-logarithmic distance, not linear distance:  dist = abs(Rapprox / Rtarget - 1). For example, 200 is closer to 350 than it is to 100.
A better distance measure is true logarithmic distance  dist = abs(log(Rapprox/Rtarget)), but since this was not specified in the original question, you are free to use either measurement.

Scoring

Score is measured in characters of code, per usual golf rules. Lowest score wins.

Example

We have the following resistors in stock [100, 150, 220, 330, 470, 680, 1000, 1500, 2200, 3300, 4700] and wish to target 510 ohms. The program should output 143 configurations, approximately as shown (you can change the format, but make sure the meaning is easily determined):

680 | 2200     519.444
1000 | 1000    500.
150 + 330      480.
220 + 330      550.
470            470
680 | 1500     467.89
680 | 3300     563.819
100 + 470      570.
220 + 220      440.
100 + 330      430.
470 | 4700     427.273
680 | 4700     594.052
1000 | 1500    600.
470 | 3300     411.406
680 | 1000     404.762
150 + 470      620.
...
many more rows
...
2200 + 4700    6900.
3300 + 4700    8000.
4700 + 4700    9400.

In this example, the best approximation of 510 ohms is given by 680- and 2200-ohm resistors in parallel.

Best of each language so far (1 June 2014):

J - 70 char
APL - 102 char
Mathematica - 122 char
Ruby - 154 char
Javascript - 156 char
Julia - 163 char
Perl - 185 char
Python - 270 char

Mathematica, 151 122 characters

Expects the target resistance to be stored in r and the list of available resistors in l.

SortBy[Join[{#,#}&/@l,Join@@(#@@@Union[Sort/@N@l~Tuples~{2}]&/@{{"+",##,#+#2}&,{"|",##,#*#2/(#+#2)}&})],Abs[#[[-1]]/r-1]&]

Less golf:

SortBy[Join[{#, #} & /@ l,
  Join @@ (# @@@
       Union[Sort /@ N@l~Tuples~{2}] & /@ {{"+", ##, # + #2} &, {"|", ##,
        #*#2/(# + #2)} &})], Abs[#[[-1]]/r - 1] &]

The output format differs from the suggested one but configurations are easily determinable. The output is a list of configurations. Each configuration is of one of the following forms:

{R1, Total}
{"+", R1, R2, Total}
{"|", R1, R2, Total}

So the first three elements of the output read

{{"|", 680., 2200., 519.444}, {"|", 1000., 1000., 500.}, {"+", 150., 330., 480.}, ...}

If you're fine with rational numbers, I could save two characters from omitting N@. That is, the first element (for instance) would be returned as 4675/9 instead of 519.444.


Write a Quine in Plain English Write a quine that consists of real English words separated by single spaces. A "word" is defined as a string containing only lowercase and uppercase letters (/[a-zA-Z]+/ in regex). To be "real" your word must be recognized by the official Scrabble dictionary.
I'm using the Scrabble dictionary since it gives a definitive answer on what is and isn't valid. There are too many gray areas with a normal dictionary. Note that "A" and "I" (not to mention "quine") are not valid scrabble words.
Since writing a quine only using letters and spaces is close to impossible in most programming languages, you have the option to replace the single spaces between words with a character of your choice. You also have the option to append characters to the front of the first word and the end of the last word. These added characters may be anything (including newlines and non-ASCII) except letters (a-z, A-Z). There is a penalty for adding them though (see Scoring.)
Details

As usual, the quines may not read or access their own source code. (I'd say that HQ9+'s Q command violates this.)
Output should go to stdout or a similar alternative. There is no input.
The words do not need to be capitalized correctly. They can have caps and lowercase anywhere. The sequence of words does not need to make any sense.
No word may be used more than 3 times in your program. Differently capitalized words are still the same word (e.g. 'DOG', 'dog', and 'dOg' are all the same word).
Using languages like PHP or HTML that can just cat out their contents is considered a trivial loophole and is not allowed.
The program must contain at least one word.

Scoring
Your score is the number of "real words" in your program plus these penalties:

+1 for every space that was replaced with another character
nn for every n characters you added before the first word (yes, that's n to the power n)
nn for every n characters you added after the last word

For example, the program
We all LIKE PROgraMmING

would score 4 because it contains 4 words; no characters were added or replaced any spaces. It's output would of course be We all LIKE PROgraMmING.
The program
!We@all LIKE#PROgraMmING- =

would score 4 + 2 + 1 + 27 = 34; 4 for the words, 2 for the replaced spaces, 1 for the ! at the front, and 27 for the - = at the end. It's output would of course be !We@all LIKE#PROgraMmING- =.
The lowest score wins. Tiebreaker goes to the answer with the fewest penalty points. If there's still a tie the highest voted answer wins.

><>, 25 words + (22 + 11 + 11) extra = 57 49

Oh god, my brain.

'brr3deep*clap6beep+orb5flap*leap4deep+clap5beep5flap*leap9deep9clap*beep+flap0placed apple alp0leap=clip?lob8blip*flip0clip.

Since the rules state "There is no input.", for this program to work you'll need to pipe in an empty file.

Oh and yes, brr is a valid Scrabble word, as are tsktsk and pfft.

Explanation

First of all, the following words are no-ops:

deep clap beep flap leap clip blip flip

This is because of two reasons:

abcdefl push numbers (10, 11, 12, 13, 14, 15 and the length of the stack respectively). In addition, i pushes -1 if EOF is met, seeing as there is no input.
The p command pops three chars v,y,x and places v at the position x,y.

Yes, ><> lets you modify the source code on the fly! We don't really make use of that though, as we only need the p for popping.

If we get rid of these no-ops, we get:

'brr3*6+orb5*4+55*99*+0placed apple alp0=?lob8*0.

In a similar way, the laced app part of placed apple and the e alp part of apple alp are also no-ops, and the rr of brr just reverses the stack twice, which we can also remove:

'b3*6+orb5*4+55*99*+0pl0=?lob8*0.

Finally, something that looks like a regular ><> program! The idea is to make use of the standard ><> quine, which works like so:

The initial ' starts string parsing, pushing every char met until we hit another '
We keep pushing chars until the end of the line, at which point we wrap the instruction pointer back to the start (since ><> is toroidal)
We land on the initial ' again, and stop string parsing. The result is that we've pushed every single char in the program (except the initial ') onto the stack.

Then the following happens:

b3*6+o                Print the initial ' quote (ASCII 39)
r                     Reverse the stack
b5*4+                 Push a ';' (ASCII 59)
55*99*+0p             Replace the 'l' of 'lob' with ';'

(print loop)
l0=?;                 If the stack is empty, terminate. Otherwise...
o                     Print the top of the stack
b8*0.                 Jump back to the beginning of the loop


(The other day) I met a bear Meta discussion: Is "(The other day) I met a bear" a duplicate?

Your challenge is to output this text:

The other day,
The other day,
I met a bear,
I met a bear,
A great big bear,
A great big bear,
Oh way out there.
Oh way out there.

The other day,
I met a bear,
A great big bear,
Oh way out there.

He looked at me,
He looked at me,
I looked at him,
I looked at him,
He sized up me,
He sized up me,
I sized up him.
I sized up him.

He looked at me,
I looked at him,
He sized up me,
I sized up him.

He said to me,
He said to me,
"Why don't you run?
"Why don't you run?
I see you ain't,
I see you ain't,
Got any gun."
Got any gun."

He said to me,
"Why don't you run?
I see you ain't,
Got any gun."

I says to him,
I says to him,
"That's a good idea."
"That's a good idea."
"Now legs get going,
"Now legs get going,
get me out of here!"
get me out of here!"

I says to him,
"That's a good idea."
"Now legs get going,
get me out of here!"

And so I ran,
And so I ran,
Away from there,
Away from there,
But right behind me,
But right behind me,
Was that bear.
Was that bear.

And so I ran,
Away from there,
But right behind me,
Was that bear.

In front of me,
In front of me,
There was a tree,
There was a tree,
A great big tree,
A great big tree,
Oh glory be!
Oh glory be!

In front of me,
There was a tree,
A great big tree,
Oh glory be!

The lowest branch,
The lowest branch,
Was ten feet up,
Was ten feet up,
So I thought I'd jump,
So I thought I'd jump,
And trust my luck.
And trust my luck.

The lowest branch,
Was ten feet up,
So I thought I'd jump,
And trust my luck.

And so I jumped,
And so I jumped,
Into the air,
Into the air,
But I missed that branch,
But I missed that branch,
A way up there.
A way up there.

And so I jumped,
Into the air,
But I missed that branch,
A way up there.

Now don't you fret,
Now don't you fret,
And don't you frown,
And don't you frown,
I Caught that branch,
I Caught that branch,
On the way back down!
On the way back down!

Now don't you fret,
And don't you frown,
I Caught that branch,
On the way back down!

This is the end,
This is the end,
There aint no more,
There aint no more,
Unless I see,
Unless I see,
That bear once more.
That bear once more.

This is the end,
There aint no more,
Unless I see,
That bear once more.

Pattern:

First, each line is repeated once, linebreak-separated, and then 2 newlines, and then the above stanza is printed without the repetition. Then the next stanza.

Rules

Trailing whitespace is allowed at the end of the output, but the rest must be printed as-is.

JavaScript (ES6), 690 bytes

f=(n=0)=>n<139?[...'DEFJKLMPQRVXYZ~0123456789'].map(c=>s=(e=s.split(c)).join(e.pop()),s=`P2other day9Xme8a 03 09Oh ~F8t6.|H2Yme9XYM9H2VZXV M.|H2said4oZ"Why7run?|Xse2yFEin't9Go8anyDun."|Xsays4o M9"That'sEDood idea."|"Now legsDe8going9ge8m2F8of 6!"1ran9A~Lm469Bu8riKbehindZWasQa80.|In Ln8ofZT6 wasE4Re34Re9OhDlory be!P2lowes5Was4en fee8up9So IQFKI'd jump9J4rus8my luck.1jumped9IntoQ2air9Bu8XmissedQa5A ~up46.|Now7fRt9J7Lwn9XCauKtha5OnQ2~back down!Pis isQ2end9T6Ein8no moR9Unless Xsee9Tha80 onc2moR.9,|8t 7 don'8yF 6heR58branch94 t39ADRa8big2e 1|J so X0bear~way Z me9YlookedE8XI Vsized upRreQ4hP|ThMhimLfroKgh8JAndFouE aD g`)&&s.split`|`[(i=+'11223344012340'[n%14])&&i+(n/14<<2)]+`
`+f(n+1):''

console.log(f())

How?
The 41 unique lyric lines (including the empty one) are stored in a pipe-separated string s.
"|The other day,|I met a bear,|A great big bear,|...|Unless I see,|That bear once more."

This string is compressed by replacing the most frequent sub-strings with characters that are not used anywhere else. The character set is "DEFJKLMPQRVXYZ~0123456789" and the substitutions are processed as follows (note that this is the decompression order):
 1. "D" -> " g"         | 10. "R" -> "re"         | 19. "3" -> "9A grea8big"
 2. "E" -> " a"         | 11. "V" -> "sized up"   | 20. "4" -> " t"
 3. "F" -> "ou"         | 12. "X" -> "I "         | 21. "5" -> "8branch9"
 4. "J" -> "And"        | 13. "Y" -> "looked a8"  | 22. "6" -> "here"
 5. "K" -> "gh8"        | 14. "Z" -> " me9"       | 23. "7" -> " don'8you "
 6. "L" -> "fro"        | 15. "~" -> "way "       | 24. "8" -> "t "
 7. "M" -> "him"        | 16. "0" -> "bear"       | 25. "9" -> ",|"
 8. "P" -> "|Th"        | 17. "1" -> "|And so I " |
 9. "Q" -> "4h"         | 18. "2" -> "e "         |

The compressed format is the one used in several popular JS packers such as RegPack: the substituted string is stored just after a last occurrence of the substitution character. Below is an example for "TwoBearsThreeBearsFourBearsFiveBears!", where "Bears" is packed as "~":

Hence the decompression formula:
c => s = (e = s.split(c)).join(e.pop())

Once s has been decompressed, we rebuild the original verses by applying the pattern:
00 - Line A
01 - Line A
02 - Line B
03 - Line B
04 - Line C
05 - Line C
06 - Line D
07 - Line D
08 - (empty)
09 - Line A
10 - Line B
11 - Line C
12 - Line D
13 - (empty)


Display Frames from .txt file The Task:

Given a .txt file with frames of ASCII art each separated by a \n (see this example if you are unclear) output a motion picture with frame with 1 frame per second.

Note that there is a trailing \n on the final frame.

Each frames dimensions will be:

X<80
Y<20

The Rules

The Previous frame must be cleared before the next is displayed, so just printing each frame onto the terminal isn't a valid answer.
New You can grab the file name however you want, either from it being stored in a variable or from sys args.
New The images must Loop indefinitely
This is code golf: smallest program wins.

Example

Input

0   0
0   0
00000
0   0
0   0

00000
0
00000
0
00000

0   0
 0 0
  0
  0
  0

Output

Un-golfed

import curses, time

stdscr = curses.initscr()

Frames = file.read(file('Frames.txt')).split('\n')
while True:
    y = 0
    for i in range(len(Frames)):
        stdscr.addstr(y,0,Frames[i])
        stdscr.refresh()
        y += 1
        if Frames[i] == '':
            y = 0
            stdscr.clear()
            time.sleep(1)

Mathematica, 41 bytes

Import@f~StringSplit~"\n\n"~ListAnimate~1

Expects the file name to be stored in variable f.

This is the first time Mathematica's precedence rules for @ and .~.~. are exactly the way I need them.

Btw, this snippet could go horribly wrong if the file extension is anything else than .txt (because Mathematica will try to guess how to do the import based on that), but luckily that file ending is part of the challenge specification.


The Note of Destiny - place a note on a staff The zombie apocalypse has come, and the world is coming to an end. Suddenly, someone discovers a formula that takes the current hour, minute, and day, and spits out the perfect note to play on a piano that instantly kills every zombie that hears it. Unfortunately, there is only one piano player left in the world, and he has forgotten how to read notes, but he still knows how to read sheet music. Of course, this is a very time-sensitive thing, so it seems natural to have a computer do it.1

Your challenge is to take a note, such as G, and output the note placed on a staff (in treble clef), like this:

-----

-----
   |
---|-
   |
--O--

-----

Specification:

You must output a staff of alternating lines of ----- (5 dashes) and a blank line. There will be 5 -----s total. The note must be superimposed on top of this staff.
The input will specify where the note is located. The input will be:

an optional H or L, specifying "high" or "low"
a letter from A to G, specifying the pitch
an optional # or b, specifying sharp or flat.

The "note" is defined as:

One O (capital O) aligned to the middle of the staff, which is in the place of the note. (The top line is HF (high F), and the bottom line is E (a normal E).)
Three |s (vertical bars), the stem, which will be:

one space to the left of the note and going downwards (starting one space below the note) if the note is on the middle line (B) or above, or
one space to the right of the note and going upwards (starting one space above the note) if the note is below the middle line.

A # or b one space directly to the left of the note if specified in the input.

Ledger lines must be added if the note is too high or low. These lines will be --- (only 3 dashes in width, as opposed to 5) and will only appear if the note is on or above/below (for top/bottom ledger lines respectively) the ledger lines.
Extraneous spaces may be placed anywhere you want; for example, you could make the blank lines have spaces or have a space after the ledger lines if it helps you save any characters.

Here is a visualization, to understand the specification more easily, with all the note names next to the lines:

      HB
 ---  HA
      HG
----- HF
      HE
----- HD
      HC
----- B
      A
----- G
      F
----- E
      D
 ---  C
      LB
 ---  LA
      LG
 ---  LF
... (bottom cut off for brevity, you get the idea anyway)

Here are some more examples that you can use to test your program:

Input: HG#

 #O
-|---
 |
-|---

-----

-----

-----

Input: LAb

-----

-----

-----

-----

-----
   |
 --|
   |
 bO-

Input: HB

  O
 |--
 |
-|---

-----

-----

-----

-----

Input: C

-----

-----

-----

-----
   |
---|-
   |
 -O-

This is code-golf, so the shortest code in bytes will win!

1: most realistic exposition evar! :-P

Ruby – 271 267 252 249 234 229 220 214 characters

I literally just learned Ruby for this. So there is certainly room for improvement in golfing it down. Or doing anything really. But I needed a language with mutable strings. :)

def f(n)s=[0]*20
s.fill{|i|i%2>0?i<3||i>11?" ---":?-*5:" "*5}
s[l=(3-n[(p="H_L".index n[0])?1:0].ord)%7+7*(p||1)][1,2]=("#b"[n[-1]]||s[l][1])+?O
s[l+3-2*o=l>7?3:1,3].map{|t|t[o]=?|}
puts s[[3,l].min..[11,l].max]end

Somewhat ungolfed:

def f(note)
  staff=[]
  0.step(20) {|i| staff[i] = " "*5}
  1.step(19,2) {|i| staff[i] = " ---"}
  3.step(11,2) {|i| staff[i] = "-"*5}
  level = 7
  if !(pos="HL".index note[i=0]).nil?
    level = 14*pos
    i += 1
  end
  level += (73-note[i].ord)%7
  staff[level][2] = "O"
  mark = note[-1]
  if !"#b".index(mark).nil?
    staff[level][1] = mark
  end
  offset = (level > 7) ? 3 : 1
  staff[level-2*offset+3,3].map {|line| line[offset] = "|"}
  first = [3,level].min
  last = [11,level].max
  puts s[first..last]
end

I can cut it by another 2 characters down to 212 characters if leading blank lines are allowed. This solution doesn't fill the lines that aren't printed anyway:

def f(n)s=[]
[3,l=(3-n[(p="H_L".index n[0])?1:0].ord)%7+7*(p||1)].min.step(l>11?l:11){|i|s[i]=i%2>0?i<3||i>11?" ---":?-*5:" "*5}
s[l][1,2]=("#b"[n[-1]]||s[l][1])+?O
s[l+3-2*o=l>7?3:1,3].map{|t|t[o]=?|}
puts s
end

Are lambda's fair game? Then I can get 210 characters with the first approach

f=->n{s=[0]*20
s.fill{|i|i%2>0?i<3||i>11?" ---":?-*5:" "*5}
s[l=(3-n[(p="H_L".index n[0])?1:0].ord)%7+7*(p||1)][1,2]=("#b"[n[-1]]||s[l][1])+?O
s[l+3-2*o=l>7?3:1,3].map{|t|t[o]=?|}
puts s[[3,l].min..[11,l].max]}

Or 207 characters with additional blank lines:

f=->n{s=[]
[3,l=(3-n[(p="H_L".index n[0])?1:0].ord)%7+7*(p||1)].min.step(l>11?l:11){|i|s[i]=i%2>0?i<3||i>11?" ---":?-*5:" "*5}
s[l][1,2]=("#b"[n[-1]]||s[l][1])+?O
s[l+3-2*o=l>7?3:1,3].map{|t|t[o]=?|}
puts s}

Of course, now you'd need to do f.call("HGb").


PPCG's Unanswered Questions This dear StackExchange site has so many challenges, and so many good answers. But what about the challenges that were never answered?

Task

Write a program or a function that will print a pseudo-random open unanswered (as in, a question with exactly zero answers) challenge from PPCG. All possible challenges should be produced with the same probability.

Input

No input will be taken.

Output

Must only be the title, tags and the link which should be separated by newlines.

The title must be exactly like it is in the challenge.
The tags don't have a strict output format but must include all tags.
The link may or may not include the question-name after the question id and must lead to the challenge.

May or may not be translated to a human readable format.

&amp; to &

Leading and trailing whitespace is allowed.

Examples

Encode a steganographic encoder into a package
code-challenge,unicode,steganography
https://codegolf.stackexchange.com/questions/65159/encode-a-steganographic-encoder-into-a-package

Simple predictive keyboard CG
code-golf
https://codegolf.stackexchange.com/questions/76196/simple-predictive-keyboard-cg

Scoring

As this is code-golf, shortest answer in bytes wins.

JavaScript + HTML, 271 250 232 bytes
Apparantly you can use Dates as pseudo-random numbers. I stole this from Shaggy's answer.
(Only uses about 4 of your quota)

q=[]
g=f=>fetch('//api.stackexchange.com/questions/unanswered?site=codegolf&page='+f).then(r=>r.json().then(j=>(q=[...q,...j.items])^j.has_more?g(f+1):document.write(`<pre>${(q=q[new Date%q.length]).title}
${q.tags}
`+q.link)))
g(1)

It makes an array q, then calls g(1), which fetches the first page of results and adds it to q. Then, if the request says it has_more, then it calls g(f+1), which fetches the next page, until it reaches the end and writes out to the HTML document (Which will automatically unescape the response)
If we don't care about all of the unanswered questions, just the most recent 30 (Only uses 1 of your quota):
JavaScript + HTML, 213 196 179 bytes

fetch`//api.stackexchange.com/questions/unanswered?site=codegolf`.then(r=>r.json().then(j=>document.write(`<pre>${(j=j.items[new Date%j.items.length]).title}
${j.tags}
`+j.link)))


Alphabetically permute a string Task

Your goal, should you choose to accept it, is to write a program, that, given an input string (or array of characters), outputs every possible permutation of the letters in that string. I'm finicky with my output, so it should be sorted alphabetically, with no duplicates.

Example:

Input: buzz

Output:

buzz
bzuz
bzzu
ubzz
uzbz
uzzb
zbuz
zbzu
zubz
zuzb
zzbu
zzub

Rules

This is code-golf so the shortest code wins.
Trailing spaces on each/any line are ok
A single newline after the last line is allowed (but no more)

Jelly, 5 bytes
ṢŒ!QY

Try it online!
Explanation
Ṣ         Sort
 Œ!       All permutations
   Q      Unique
    Y     Join by linefeeds


(RGS 1/5) Binary multiples A binary multiple of a positive integer k is a positive integer n such that n is written only with 0s and 1s in base 10 and n is a multiple of k. For example, 111111 is a binary multiple of 3.

It is easy to show that a positive integer has infinitely many binary multiples. See here for a construction proof of one binary multiple for each k. Multiplying by powers of 10 you get infinitely many more.

Your task

Given a positive integer k, return the smallest binary multiple of k.

Input

A positive integer k.

Output

A positive integer n, the smallest binary multiple of k.

Test cases

2 -> 10
3 -> 111
4 -> 100
5 -> 10
6 -> 1110
7 -> 1001
8 -> 1000
9 -> 111111111
10 -> 10
11 -> 11
12 -> 11100
13 -> 1001
14 -> 10010
15 -> 1110
16 -> 10000
17 -> 11101
18 -> 1111111110
19 -> 11001
20 -> 100
100 -> 100

This is code-golf so shortest submission in bytes, wins! If you liked this challenge, consider upvoting it... And happy golfing!

This is the first challenge of the RGS Golfing Showdown. If you want to participate in the competition, you have 96 hours to submit your eligible answers. Remember there is 450 reputation in prizes! (See 6 of the rules)

Otherwise, this is still a regular code-golf challenge, so enjoy!

05AB1E, 6 bytes
∞b.ΔIÖ

Try it online! or verify all test cases (courtesy of @KevinCruijssen)

Explanation
∞b           - Infinite binary list
  .Δ         - Find the first value such that..
    IÖ       - It's divisible by the input


Output the hours at 90 degrees Today while playing with my kids I noticed that an apparently simple toy in the park hid a challenge.

The wheel has a triangle that points to a number, but also has three circles that point to the numbers every 90 degrees from the first one. So:

Challenge (really simple)

Given an integer between 1 and 12 (the one pointed by the triangle) in any acceptable form, output also in any acceptable form and order the three numbers pointed by the circles (the ones every 90 degrees).

Test cases

In       Out
1        4, 7, 10
2        5, 8, 11
3        6, 9, 12
4        7, 10, 1
5        8, 11, 2
6        9, 12, 3
7        10, 1, 4
8        11, 2, 5
9        12, 3, 6
10       1, 4, 7
11       2, 5, 8
12       3, 6, 9

This is code-golf, so may the shortest code for every language win!

Python 3, 33 bytes

lambda n:{*range(n%3,13,3)}-{n,0}

Try it online!

Python 2, 35 bytes

lambda n:[(n+c)%12+1for c in 2,5,8]

Try it online!


Write program in your favorite language in another language The determined Real Programmer can write Fortran programs in any language.

from Real Programmers Don't Use Pascal

Your task is to write program in your programming language of choice, but you are allowed to use only another language. That is, throw away all coding conventions from one language and replace them with coding conventions from other language. The more the better. Make your program look as if it was written in another language.

For example, Python fan who hates Java could write following Python program in Java:

void my_function()                                                             {
    int i = 9                                                                  ;
    while(i>0)                                                                 {
        System.out.println("Hello!")                                           ;
        i = i - 1                                                              ;}}

Pascal enthusiast forced to use C could write this:

#define begin {
#define end }
#define then
#define writeln(str) puts(str)

if (i == 10) then
begin
    writeln("I hate C");
end

You have to write complete program. The program desn't have to do anything useful.

Good Luck. This is a popularity contest so the code with the most votes wins!

C in C++
#include <stdio.h>

int main(int argc, char** argv)
{
        printf("Hello world!\n");
        return 0;
}


Compute my Sacred Geometry In the tabletop RPG named Pathfinder, there is a feat that characters can take called Sacred Geometry, which allows a character who has it to buff their spells in exchange for doing some math: to use it, the character rolls a number of six-sided dice equal to their ranks in a particular skill, consults a table based on their spell level to determine which three prime numbers are the "Prime Constants" for that spell level, then calculates whether or not it's possible to produce one of the Prime Constants by performing some combination of addition, subtraction, multiplication, and division and parenthetical grouping on all the numbers rolled.

The table of Prime Constants by Spell Level are as follows:

+-------------+-----------------+
| Spell Level | Prime Constants |
+-------------+-----------------+
| 1st         | 3, 5, 7         |
| 2nd         | 11, 13, 17      |
| 3rd         | 19, 23, 29      |
| 4th         | 31, 37, 41      |
| 5th         | 43, 47, 53      |
| 6th         | 59, 61, 67      |
| 7th         | 71, 73, 79      |
| 8th         | 83, 89, 97      |
| 9th         | 101, 103, 107   |
+-------------+-----------------+

So, for instance, if a character has 5 skill ranks and they're casting a 4th level spell, they would roll five six-sided dice and would need to be able to calculate a value of 31, 37, or 41. If they rolled a 6, 6, 4, 3 and 1, then they could produce a value of 37 by performing the following computation: (6 × 6) + (4 – 3) × 1 = 37, or they could produce a value of 41 by doing ([6 + 6] × 3) + 4 + 1 = 41. As a result, their casting of the spell would succeed.

For this programming puzzle, your job is to write a function with two input parameters, Spell Level and Skill Ranks, roll a number of six-sided dice equal to the Skill Ranks parameter, then compute if you can produce (at least) one of the Prime Constants associated with the Spell Level parameter, then output a Boolean value.

Answers would be ranked primarily by the efficiency of their algorithm (I'm pretty sure that a brute force algorithm would scale very quickly as the Skill Ranks parameter increases), and then by the size of the submitted source code in bytes.

Python 2.7, 285 bytes

from itertools import*
from random import*
def f(s,r):
 p=[];n=1;k=1;P=1;d=choices('123456',k=r);D=permutations(d,r);O=product('+-*/',repeat=r-1)
 while-~s*3>n:p+=P%k*[k];n,k,P=n+P%k,k+1,P*k*k
 return any(n in{eval('int(%s)'%'%s'.join(i)%o)for i in D for o in O}for n in p[-4:-1])

Technically conforms to the specifications of the challenge. Only returns True/False, does not expose the dice rolls used or the expression used to caller.

Also, this algorithm ignores grouping, since we can perform the same operations without grouping by using ordering instead. (This would not be true if exponentiation was one of the possible operations, for example.)

Exponential runtime, since it generates all possibilities and then checks if at least one solution exists.


Numbers Manipulation challenge Use any programming language to generate two random digits between 1 and 9 (including both). Then your program should display:

in the first line: the first random digit,
in the second line: the second random digit,
in the third line: a number whose tens and units digits are the first and second random digits respectively,
in the fourth line: the number from the third line raised to the power of 2.

For example, if digits "9" and "2" were generated, your program should display exactly:

9
2
92
8464

R, 48 47 bytes

cat(x<-sample(9,2,T),y<-x%*%c(10,1),y^2,fill=1)

Try it online!

Thanks to J.Doe for golfing down a byte.


Number of valid mazes Given a WxH grid, how many possible mazes are there?

Things you know about the maze:

The grid is exactly H squares high and W squares wide.
There are three types of squares: Start, Finish, and Empty.  Your maze must contain exactly 1 Start and 1 Finish, and all remaining squares are Empty.
There are walls surrounding the entire maze.
Walls can exist on the edge between any two squares, unless it breaks the below rule:
There must exist a path from the Start square to the Finish square.

Therefore, given two numbers, W and H, you must return a single number representing the number of possible square/wall configurations.  You are guaranteed that W*H > 1

For example, the 2x2 maze has exactly 100 different possible configurations.

This is a code-golf so the shortest answer wins!

Python 2, 329 310 bytes

from itertools import*
w,h=input()
R=range(w*h)
p=product
n=0
Z=[(x,y)for x,y in p(R,R)if abs(x%w-y%w)+abs(x/w-y/w)<2]
for s,f,W in p(R,R,p(*[((),z)for z in Z if z[0]<z[1]])):
 V={s};C=[s];v=0
 while C:
  c=C.pop();v|=c==f!=s;V|={c}
  for o,q in Z:C+=(c==o)*len({q,(o,q),(q,o)}-(V|set(W)))/3*[q]
 n+=v
print n

This is the golfed (and much more inefficient) version of the program I was using while discussing the problem with @Nathan. I can save a few bytes by replacing some space indents with tabs, but I'll save that for later.

The algorithm is simply generate every maze, then flood fill from the start, seeing if we pass the finish at some point or not.


Remove vowels without using too many different characters The challenge is to remove vowels (a, e, i, o, u) from string from STDIN (yes, I know, simple). You can expect that your program will be not ran with any arguments in argv.

Example:

This program will remove VOWELS.
So we can now speak without them.

Is changed to:

Ths prgrm wll rmv VWLS.
S w cn nw spk wtht thm.

There is a catch. The winning entry is decided basing on number of different bytes. For example a ab has three different bytes (a, b and space). If two or more entries will have this same ammount of different bytes, then fallback is done on number of bytes for those entries.


Code Golf: Your own pet ASCII snake So, I wrote myself a one-liner which printed out a snake on the console. It's a bit of fun, and I wondered how I might condense my code...

Here's a (short) example output:

                +
                 +
                  +
                   +
                   +
                   +
                  +
                   +
                    +
                    +
                    +
                     +
                     +
                      +
                      +
                       +
                      +
                     +
                     +
                    +

Here's the specs:

In each line, a single non-whitespace character (whichever you like) is printed to the console, initially with 29 to 31 spaces padding to the left of it.
Each iteration, a random decision is made between these three actions

The amount of padding decreases by 1
The amount of padding remains the same
The amount of padding increases by 1

Do this 30 times, to print 30-segment long a snake to the console.

The shortest answer in bytes wins.

05AB1E, 15 14 bytes
30DF2Ý<+ΩD0sú,

Try it online!
Uses 0.
Explanation
30DF2Ý<+ΩD0sú,
30D            # Push 30 to the stack (One for the amount of iterations we are going to perform and one for the initial padding)
   F           # Pop one of the 30s and perform the following that many times...
    2Ý          # Push [0,1,2] ...
      <         # and create [-1,0,1] from that
       +        # Add the last padding to every entry (e.g. 30 in the beginning resulting in [29,30,31]
        Ω       # Pick one of the results at random ...
         D      # and push it to the stack twice
          0     # Push 0 (Any character will work fine here) ...
           sú   # and pad it with the randomly chosen amount of spaces in the front
             ,  # Finally print the result with a trailing newline


Same code shape and output shape I am not sure if this is possible. I have tried it and couldn't make it work at all, but I am being hopeful.

If this is not possible please flag this question and I will promptly delete it.

Conditions are simple,

Write code that will output same amount of character in the same shape as the code.

For example (A very stupid example).

If code says

#include<stdio.h>

main()
{
    printf("Hello World");
}

Then output must be

kjh#$@#)(12398n,s

lkrjop
t
    jherl;k@&##*$&@3n,2m$*
t

I really do not care which characters are being used in the output or anything like that except that space is space and tab is tab. So whatever is the shape of the code, the output should be the same.

Winner: Either popularity , or help me decide the criteria.

The only way I managed to make this work, is I created a file reader that reads the code and does rot13 on every character in the code and prints it out. However I was not fond of it, because the shape was not interesting, nor do I want to use file reader to do something like this because it is too easy.

JS

I know it's still being contested, but I thought I'd have a go:

          (function (){a='';
       a           ;         a=
     '             ';           h
    =             '#'            ;
   s             = ' '            ;
  s             ;  s  ;            s
 ;             s   ;   s            ;
s             ;    s    ;            s
;            s     ;     s           ;
s           ;      s      ;          s
;          s       ;       s         ;
 b        =       '';       s       ;
  s      ;      return(      a     +
   b    +     b+arguments[    b   +
    'ca'   +'llee'].toString   ( )
      .replace(/\S/g,h)+'###');s;
          s                 ;
               s;s;s})()

When run in Chrome's console produces:

Not 100% accurate, but I thought it was quite close. As intangible as the criteria were to begin with, I did like the idea of the challenge, despite how easy/difficult is in differing languages.


Prime numbers between n and 2n Bertrand's postulate states that there is always at least 1 prime number between n and 2n for all n greater than 1.

Challenge

Your task is to take a positive integer n greater than 1 and find all of the primes between n and 2n (exclusive).

Any default I/O method can be used. Whoever writes the shortest code (in bytes) wins!

Test cases

n    2n     primes

2    4      3
7    14     11, 13
13   26     17, 19, 23
18   36     19, 23, 29, 31
21   42     23, 29, 31, 37, 41

Jelly, 4 bytes

‘æRḤ

Try it online!

waiting for OP's answer in comment...

(doesn't work for n=1)


Alex is sometimes right This challenge is to lift the spirits of our mod Alex A., who is usually wrong.

Suppose you have a friend named Alex who needs help with basic logic and math, specifically mathematical equivalence.

He gives you a list of equations of the form [variable] = [variable] where a [variable] is always a single uppercase letter A to Z (not a lowercase letter, not a number, nor anything else). There's one equation per line in the list except for a single line that only says therefore.

All the equations above the therefore are premises, facts that are assumed to be true. All the equations below the therefore are unverified propositions, facts that Alex is attempting to infer from the premises, and they may or may not be true.

For example, in this equation list the single conclusionary proposition A = C happens to be true:

A = B
B = C
therefore
A = C

It's your job to tell Alex if all of his propositions logically follow from the given premises. That is, you need to tell Alex if he is wrong or right in his conclusions.

Write a program/function that takes in a string of a list of equations as described and prints/returns

Alex is right

if all the conclusions follow logically from the premises, and otherwise outputs

Alex is wrong

if any conclusion does not logically follow from the premises.

The shortest code in bytes wins.

Be sure to watch out for these cases:

Variable always equals themselves. e.g.

B = A
therefore
A = A
X = X

results in Alex is right.
Variables with unknown relationships cannot be assumed to be equal. e.g.

P = Q
therefore
E = R

results in Alex is wrong.
When there are no equations after the therefore then the conclusions are vacuously true. e.g.

D = C
therefore

and

therefore

both result in Alex is right.
When there are no equations before the therefore then only self-equality can be inferred. e.g.

therefore
R = R

results in Alex is right, but

therefore
R = W

results in Alex is wrong.

More Examples

Alex is wrong cases: (separated by empty lines)

A = B
C = D
therefore
A = C

A = L
E = X
A = I
S = W
R = O
N = G
therefore
G = N
L = I
R = O
S = A
X = X
X = E

D = K
D = Q
L = P
O = L
M = O
therefore
K = L

A = B
therefore
B = C

Z = A
S = S
therefore
A = Z
A = A
S = A
A = S
Z = A
Z = A

K = L
K = X
therefore
X = P
L = X
L = P

therefore
A = B
B = C
A = C

therefore
A = A
B = B
C = C
D = D
E = E
F = F
G = G
H = H
I = I
J = J
K = K
T = I
L = L
M = M
N = N
O = O
P = P
Q = Q
R = R
S = S
T = T
U = U
V = V
W = W
X = X
Y = Y
Z = Z

A = B
B = C
C = D
D = E
E = F
F = G
G = H
H = I
I = J
J = K
K = L
L = M
M = N
N = O
O = P
P = O
Q = R
R = S
S = T
T = U
U = V
V = W
W = X
X = Y
Y = Z
therefore
A = Z

therefore
C = D
T = Y
A = Z

P = Q
therefore
E = R

therefore
R = W

Alex is right cases:

H = J
therefore
J = H

K = L
K = X
therefore
L = X

C = B
B = A
therefore
A = B

K = L
K = X
K = P
therefore
L = X
L = P
X = P

A = Y
Y = Q
Q = O
therefore
O = Y
O = A

C = C
therefore
C = C

A = B
B = A
therefore
A = B
B = A

A = B
B = C
C = D
therefore
A = A
A = B
A = C
A = D
B = A
B = B
B = C
B = D
C = A
C = B
C = C
C = D
D = A
D = B
D = C
D = D

therefore
A = A
B = B
C = C
D = D
E = E
F = F
G = G
H = H
I = I
J = J
K = K
L = L
M = M
N = N
O = O
P = P
Q = Q
R = R
S = S
T = T
U = U
V = V
W = W
X = X
Y = Y
Z = Z

D = I
F = H
J = M
therefore
M = J
D = I
H = F

A = B
B = C
C = D
D = E
E = F
F = G
G = H
H = I
I = J
J = K
K = L
L = M
M = N
N = O
O = P
P = Q
Q = R
R = S
S = T
T = U
U = V
V = W
W = X
X = Y
Y = Z
therefore
Z = A
F = R
G = I
W = L

A = B
B = C
therefore
A = C

B = A
therefore
A = A
X = X

P = P
C = G
M = C
therefore

D = C
therefore

therefore

therefore
R = R

Ruby, 80 76 + 2 = 78

With command-line flags p0, run

gsub$1,$2%p=$`[/e/]while~/(.) = (?!\1)(.)/
$_="Alex is #{p ?:wrong: :right}"

Explanation:

This uses pure string manipulation. p0 reads the full input as a single string into the variable $_. Then, we repeatedly match that string against the regular expression /(.) = (?!\1)(.)/, which finds all strings of the form "X = Y" where X and Y aren't the same letter, and assigns X to $1 and Y to $2. When such a match is found, gsub$1,$2 replaces all instances of X with Y in the string. We also check whether this match occurred before or after the "therefore" with

$`[/e/]

If it occurred after, it's an unjustified claim and Alex is wrong. We track whether any such occurrences have happened using p=. The use of p as a tracking variable prevents things from breaking if the loop never hits even once, since p will return nil if it's never been assigned to.

As of this post, the CJam solution is longer. A proud, if no doubt fleeting moment.

Edit: Yup, quickly dethroned. Also, to finish the explanation, with the p flag the final value of $_ is output at the end of execution, so the last line is the output.


Self-Replicating Numbers Background
For the purpose of this challenge, all numbers and their string representations are assumed to be in decimal (base 10). I tried to find proper terminology for this challenge, but I do not think there is any, so I made it up.
A self-replicating number is a number that appears as a substring in any of its multiples up to and including its square, excluding itself. An \$n\$-order self-replicating number appears as a substring in exactly \$n\$ multiples of itself up to its square, including itself. All numbers are at least 1st-order self-replicating numbers, because they appear as a substring in their first multiple (1 times the number).
For example: 5 is a 3rd-order self-replicating number, because it appears 3 times in the multiples of itself up to its square: 5, 10, 15, 20, 25. On the other hand, 4 is a 1st-order self-replicating number, because it appears only once: 4, 8, 12, 16.
There are only 6 1st-order replicators, because numbers will always have a self-replicator order \$\geq\lfloor\log_{10}(x)\rfloor+1\$, where \$x\$ is the number, as multiples of the number and any power of ten are guaranteed to have the number as a substring. Because of this property of self-replicating numbers, the series of \$n\$-order self-replicating numbers cannot ever be an infinite series. The last possible \$n\$-order self-replicating number is \$10^n-1\$.
The Challenge
Your task is to write a program which takes two integers, \$m\$ and \$n\$, and does one of the following:

return the first \$m\$ \$n\$-order self-replicating numbers \$or\$
return the \$m^{th}\$ \$n\$-order self-replicating number (0 or 1-indexed, your choice) \$or\$
output the series of numbers that are either \$m\$-order or \$n\$-order self-replicating numbers. You may treat this series as if it were infinite; in other words, your code is not required to halt - it'd be very cool if it did, though. \$or\$
By popular demand, and because the previous option was a source of valid misinterpretation, you may now instead take a single integer, \$n\$, and output the series of \$n\$-order self-replicating numbers. As with the last option, you may treat the series as if it were infinite.

Rules

You are allowed undefined behavior for values of \$m\leq0\$ or \$n\leq0\$.
Your code is not required to halt if the next number in the sequence does not exist. For example: if you chose either of the first two output options and your code receives \$m=7, n=1\$ as input, a 7th 1st-order self-replicating number will never be found because no 1st-order self-replicating numbers higher than 9 exist.
Standard loopholes forbidden.
This is code-golf, shortest program in bytes for each language wins.

Test Cases

\$m\$
\$n\$
Output

5
0
undefined

6
1
1,2,3,4,7,9

7
1
1,2,3,4,7,9 \$or\$ undefined

20
2
6,8,10,11,12,13,14,15,16,17,18,19,21,22,23,24,26,27,29,31

30
4
30,45,48,52,55,59,68,69,82,94,110,115,122,128,130,136,137,139,144,145,152,168,170,171,176,177,184,187,190,192

10
38
650,3520,3680,3920,6050,6350,6840,7640,7880,7960

3
101
7125,8900,9920

1
2778
5000

Jelly, 11 bytes
1ẇⱮ×R$SƊ=¥#

Try it online!
Takes \$n\$ then \$m\$ on the command line and outputs the first \$m\$ \$n\$-order self-replicating numbers
How it works
1ẇⱮ×R$SƊ=¥# - Main link. Takes n on the left
         ¥  - Group the previous 2 links into a dyad f(k, n):
       Ɗ    -   Group the previous 3 links into a monad on k:
     $      -     Group the previous 2 links into a monad on k:
    R       -       Yield the range [1, 2, ..., k]
   ×        -       Multiply each element by k
  Ɱ         -     For each element i in [k, 2k, ..., k²]:
 ẇ          -       Is k a substring of i?
      S     -     Sum; Count the 1s
        =   -   Does this equal n?
1         # - Count up k = 1, 2, 3, ... until m such k return true under f(k, n)


Rearranging a set of numbers into order The Question
Given a set of 9 numbers, m[], which contains only numbers 1 through 9 in a random order, with no two numbers being the same, create a program in any language which rearranges the number to be in numerical order (1, 2, 3, etc. etc.) by only switching two numbers which are next to each other (ie. 1, 3, 2 → 1, 2, 3).
Rules

You may only modify the set by switching two numbers which are next to each other
The ending numbers (1 through 9 in order) should be contained in m[]
You can use any language you would like
The answer with the smallest amount of bytes wins

Edit:
Your code does not have to print the output, but the rearranged array must be in m[].

CJam, 15 bytes
q~A{{a+$~}*]}*p

How it works:
q~                     e# Read the CJam styled input array (For ex. [1 3 4 2 5 6 8 7 9])
  A{        }*         e# Run the loop 10 times. This is enough times for a 10 length
                       e# input array in a bubble sort
    {    }*            e# reduce
     a+$~              e# Rearrange the pair so that they are sorted
           ]           e# After each loop, wrap the numbers back into the array
              p        e# Print the array after the loops are done

Try it online here


Cops - square times square root Note: This is the cops' thread, where one should post the scrambled code. Here is the robbers' thread where the cracked source should be posted and linked to the cop's answer.

Task: Write the shortest safe program which multiplies the square root of an integer n by the square of n
This is cops-and-robbers, so the rules are:

In your answer, post a scrambled version of your source code (the characters should be written in any order). The scrambled version should not work!
You can take input in any standard way, the same goes for output. Hardcoding is forbidden
After the code is cracked by the robbers (if this happens), you must mention that your code has been cracked in your title and add a spoiler to your answer's body with your exact code
The same applies to safe answers (mention that it's safe and add the spoiler)
The code is considered safe if nobody has cracked it in 5 days after posting it and you can optionally specify that in the title
You must specify your programming language
You should specify your byte count
You must state the rounding mechanism in your answer (see below)

You can assume that the result is lower than 232 and n is always positive. If the result is an integer, you must return the exact value with or without a decimal point; otherwise the minimum decimal precision will be 3 decimal places with any rounding mechanism of your choice, but can include more. You must state the rounding mechanism in your answer. You are not allowed to return as fractions (numerator, denominator pairs - sorry, Bash!)
Examples:
In -> Out

4 -> 32.0 (or 32)
6 -> 88.18163074019441 (or 88.182 following the rules above)
9 -> 243.0
25 -> 3125.0

The shortest safe answer by the end of April will be considered the winner.

Python 3, 44 bytes (cracked)

'**:(((paraboloid / rabid,mad,immoral))):**'

No rounding. Floating point accuracy.


ASCII art reflection In this challenge, you will be given a text block, and you need to perform reflection on the text.
Input:

A string to be reflected. The text may not be supplied as an array whose elements are the lines of text. For example, "ab\ncd" and ['a','b','\n','c','d'] are allowed, but ['ab','cd'] or [['a','b'],['c','d']] are not. You can assume that all of the lines have the same number of characters (padded with whitespace where needed).
A boolean where True indicates Y reflection and False indicates X reflection

The two inputs can be passed in any order.
Output:
The reflected string. The characters do not change, only their position. The resulting image block should be aligned to the top left (the first row and column must each contain a non-whitespace character). Trailing whitespace (on any of the lines) is allowed.
Test cases:
False
  o /
--|/
  |
 / \

/ o
 /|--
  |
 \ /

True
  o /
--|/
  |
 / \

 / \
  |
--|/
  o /

True
text

text

False
text

txet

True
P
P
C
G

G
C
P
P

False
P
P
C
G

P
P
C
G

True
abcde
fghij
kl mn
opqrs
tuvwx

tuvwx
opqrs
kl mn
fghij
abcde

This is a code-golf, so answer with the shortest answer in your favorite language!

C#, 168 144 141 120 Bytes
using System.Linq;i=>y=>string.Join("\n",y?i.Split('\n').Reverse():i.Split('\n').Select(x=>string.Concat(x.Reverse())));

New version utilizes the obvious string.Join overload that takes an IEnumerable, the first solution was using it inadvertently I was just able to use it for the else side of the ternary as well.
Update:
New version is an anonymous lambda and uses currying to save 21 bytes total. This changes usage to be f("text")(false) where f is the anonymous function.
Ungolfed:
using System.Linq;

//Using currying to save one byte
input => IsYReflect =>
         //Lambda makes return implicit
         string.Join("\n", IsYReflect
            //Y Reflect, just need to reverse the array
            ? input.Split('\n').Reverse()
            //X Reflect, reverse each line into an IEnumerable
            : input.Split('\n').Select(x => string.Concat(x.Reverse())));


The strange life of a beehive Researchers recently discovered an interesting bee colony that lives in an
infinite field of honeycomb:

Each cell can house a bee or not. In fact, the lives of those creatures
appear to be a bit ... chaotic. It could be calculated that a colony
always starts with the following pattern:

(Bee drawn by
Emmanuel Boutet
on Wikimedia Commons. This
honeycomb-and-bees image thus is released under
CC-By-SA.
grumbles)

After that the bee's life cycles are divided into so-called generations.
Each generation old bees die and new ones hatch and it primarily depends
on their cell's neighbors:

If a bee has less than two neighbors it dies due to loneliness.
If a bee has more than three neighbors it dies due to overcrowding.
If a cell has two, three or four living bees in neighboring cells a new
bee hatches there in the next generation.

Dying bees don't die until the end of a generation so they still affect
surrounding cells that might hatch bees in the next generation.

Now that we know how such a colony works, we can simulate it through any
number of generations.

Input

Input is a single number N, given on standard input, terminated by a line
break. 0 ≤ N ≤ 150. This is the number of generations to simulate.

Output

Output is a single number, on standard output and optionally followed by a
single line break, which represents the number of living bees after N
generations.

Additional output on standard error is ignored.

Sample inputs

0
5
42
100

Sample outputs

6
44
1029
5296

Winning condition

Shortest code wins, as is customary in golf. In case of a tie, the earlier
solution wins.

Test cases

There are two tests scripts, containing identical test cases:

bash
PowerShell

Invocation is in both cases: <test script> <my program> [arguments],
e.g. ./test ruby beehive.rb or ./test.ps1 ./beehive.exe.

I know there are only 22 tests instead of 151 (mainly because solutions are often quite slow). Please refrain from
embedding the exact test cases instead of solving the task. These scripts
are a convenience for you to test whether a change still causes the
program to behave correctly; not that you can adapt your code to the
specific test cases.

Another note

This task was part of a golf contest held at my university during
2011-W24. The scores and languages of our contestants were as follows:

336 – C
363 – C
387 – C
389 – Haskell
455 – C

Our own solution was

230 – Ruby

Ruby, 181 163 153 146 characters
h=[0]*4e4
[0,-200,201,202,2,3].map{|i|h[i]=1}
gets.to_i.times{h=h.map{[g=1,200,201].map{|x|g+=h[x]+h[-x]};g>5-h.rotate![-1]||g<3?0:1}}
p h.count 1

This implementation follows a standard approach using an array h (dimensions 200 x 200 flattened), where each element is either 0 (no bee) or 1 (bee included). The array [0,-200,201,202,2,3] describes the initial positions of bees (relative to any initial cell).
Input and output as specified above, passes all test cases defined.
Edit 1: changed back to a wrapping solution instead of the "additional space"-version (which was shorter in an intermediate version but now is several characters longer).
Edit 2: removed variable b completely.
Edit 3: warning: this edit made the program horribly slow. I thus reduced the dimensions to 200 each which still is sufficient for up to 150 iterations. Instead of indexing the array by a variable we constantly rotate the array forward. Not really good design, but now we are considerably below the 150.


Detect Perfect Pairings Let's have a function \$f\$ that takes a string and removes all pairs of adjacent identical characters.  For example

\$f(a\color{red}{bb}ba\color{red}{cc}) = aba\$

Note that when two pairs overlap we only remove one of them.

We will call a string perfectly paired if repeated application eventually yields the empty string.  For example the string above \$abbbacc\$ is not perfectly paired because if we apply \$f\$ again we still get \$aba\$.  However a string like \$eabbccadde\$ is perfectly paired because if we apply \$f\$ three times we get the empty string

\$f(ea\color{red}{bbcc}a\color{red}{dd}e) = eaae\$

\$f(e\color{red}{aa}e) = ee\$

\$f(\color{red}{ee}) =\$

Your task is to write perfectly paired computer code that takes a string (of printable ASCII) and decides if it is perfectly paired. The bytestring of your source must be itself a perfectly paired string, although your code doesn't necessarily have to be restricted to printable ASCII.

You may output two distinct values: one for the case where the input is perfectly paired, and another one for cases where it isn't.

This is a code-golf question so answers will be scored by the size in bytes of their source with fewer bytes being better.

Test Cases

\$abbbacc \rightarrow \mathrm{False}\\
abcba \rightarrow \mathrm{False}\\
abab \rightarrow \mathrm{False}\\
abbbaabacc \rightarrow \mathrm{True}\\
eabbccadde \rightarrow \mathrm{True}\\
bbbb \rightarrow \mathrm{True}\$

Haskell, 146 124 bytes

((""##))
a===bb=bb==a
((aa:bb))##((cc:dd))|aa===cc=bb##dd|1==1=((cc:aa:bb))##dd
a##""=""===a
""##cc=((cc!!00:cc!!00:""))##cc

No comments. Returns either True or False.

Try it online!

Edit: -22 bytes thanks to @Cat Wizard


Add comments to a Python script and make it a bilingual Python/C++ “program” Given the following Python 3 script:

def greet():
    print("Hello, world!")

greet()

Prepend some lines to this text file so that it can be both executed as a Python program as well as compiled and run as a C++ program producing the same output Hello, world! (including the newline at the end):

$ python3 bilingual.py.cpp
Hello, world!
$ g++ bilingual.py.cpp && ./a.out
Hello, world!

The solution will be scored by the count of non-whitespace characters of the entire program, including the Python script:

sed 's/\s//g' bilingual.py.cpp|wc -c

Score 119
(Thx @Linus for the byte count)
(1 byte saved thx @Conor O'Brien)
(1 byte saved thx @PieCot)
Counting bytes again by hand, I found 113. Maybe it's right this time. No it's not
#include <cstdio>
#define def main(){0?
#define print(x) puts(x);}
#define greet()

Notes: stdio and puts are still alive and kicking in C++. The missing int type is valid in C++ 4. Test


How can I get a repdigit? In honor of how much rep I had several hours ago, when I first thought of this challenge:

Numbers like this that are made up of a single digit repeating are called repdigits. Repdigits are fun! Every body would be more happy if the amount of rep they had was a repdigit¹, but I am impatient, so you need to help me find out the fastest way to get to a repdigit.
Here is your challenge:
Given a positive integers representing reputation, output the minimum amount of rep they need to gain to get to a repdigit. For example, at the time of writing this challenge, user Martin Ender had 102,856 rep. The nearest rep-digit is 111,111, so he would need to gain: 8255 rep to be at a repdigit.
Since people dislike losing rep, we will only consider non-negative changes. This means that, for example, if someone is at 12 rep, rather than losing 1 rep, the solution is to gain 10 rep. This allows '0' to be a valid output, since anyone who has 111 rep is already at a repdigit.
Input and output can be in any reasonable format, and since it is impossible to have less than 1 rep on any Stack Exchange site, you can assume no inputs will be less than 1.
One cornercase to note:
If a user has less than 10 rep, they are already at a repdigit, and so they also need '0'.
Test IO:
#Input      #Ouput
8           0
100         11
113         109
87654321    1234567
42          2
20000       2222
11132       11090

Standard loopholes apply, and the shortest solution in bytes wins!

Haskell, 39 bytes
until(((==).head>>=all).show)(+1)>>=(-)

Try it online


Create an analogue clock Create an analogue clock

Goal: To create a working analogue clock using any programming language.

Requirements:

Your clock should feature at least the hour and minute pointers.
The produced clock could be in the form of an image, an animation or ASCII-art.
It is expected that the clock shows local time.

Optional:

You might make your clock to show the seconds pointer in addition to the minutes and hours pointers.
You might also make the timezone to be configurable if you wish.
You are free to choose if you may either neglect or handle issues about leap seconds.
You might think about what happens to your program if the user adjusts the system clock or if a daylight change occurs.

Since this is a popularity-contest, please be creative and draw some nice and beautiful clocks to deserve the upvotes. Most upvoted answer wins, with the exception that I will not accept my own answer.

Finally, it is recommended (but not required) that you post at least one screenshot (or text output in case of ASCII-art) of your clock in your answer. This way, people will not need to compile and run it to see what it is.

This question is intended to be a revival of a deleted question.

Note that it is not a duplicate of this other question. That question was a code-golf asking for ASCII-art. This one is not restricted to ASCII-art and is a popularity-contest instead, so the answers are expected to be very different.

SVG + Javascript

▶▶▶ Live demo here ◀◀◀
This uses SVG's built-in animation functions to turn the hands, with a bit of additional Javascript to fetch the local time and set the initial hand positions. It works OK in Chrome and Safari, and should be compatible with most modern browsers as it doesn't use any filter effects.
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 400 400" width="400" height="400" version="1.0">
  <defs>
    <linearGradient id="a" x1="0%" y1="100%" x2="0%" y2="0%">
      <stop offset="0%" style="stop-color:#777799"/>
      <stop offset="100%" style="stop-color:#ffffff"/>
    </linearGradient>
    <linearGradient id="b" x1="0%" y1="100%" x2="0%" y2="0%">
      <stop offset="0%" style="stop-color:#ffffff"/>
      <stop offset="25%" style="stop-color:#b6b6cc"/>
      <stop offset="40%" style="stop-color:#515177"/>
      <stop offset="48%" style="stop-color:#ffffff"/>
      <stop offset="56%" style="stop-color:#ffffff"/>
      <stop offset="75%" style="stop-color:#8b8baa"/>
      <stop offset="98%" style="stop-color:#efeff4"/>
      <stop offset="100%" style="stop-color:#fbfbfc"/>
    </linearGradient>
    <linearGradient id="c" x1="0%" y1="100%" x2="0%" y2="0%">
      <stop offset="0%" style="stop-color:#ffffff"/>
      <stop offset="100%" style="stop-color:#777799"/>
    </linearGradient>
    <radialGradient id="d" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
      <stop offset="0%" style="stop-color:#ffffff"/>
      <stop offset="40%" style="stop-color:#ffffff"/>
      <stop offset="70%" style="stop-color:#e6e6ee"/>
      <stop offset="92%" style="stop-color:#b6b6cc"/>
      <stop offset="100%" style="stop-color:#636388"/>
    </radialGradient>
    <radialGradient id="e" cx="50%" cy="150%" r="200%" fx="50%" fy="150%">
      <stop offset="0%" style="stop-color:#ffffff;stop-opacity:0"/>
      <stop offset="59%" style="stop-color:#ffffff;stop-opacity:0"/>
      <stop offset="60%" style="stop-color:#ffffff;stop-opacity:0.6"/>
      <stop offset="70%" style="stop-color:#ffffff;stop-opacity:0.3"/>
      <stop offset="100%" style="stop-color:#ffffff;stop-opacity:0.0"/>
    </radialGradient>
  </defs>
  <g transform="translate(200 200)">
    <circle cx="0" cy="0" r="200" fill="#cecedd"/>
    <circle cx="0" cy="0" r="196" stroke="url(#a)" stroke-width="5" fill="url(#b)"/>
    <circle cx="0" cy="0" r="170" stroke="url(#c)" stroke-width="4" fill="url(#d)"/>
    <circle cx="0" cy="0" r="172" stroke="#ffffff" stroke-width="0.5" fill="none"/>
    <circle cx="0" cy="0" r="193.5" stroke="#ffffff" stroke-width="0.5" fill="none"/>
    <g id="O">
      <polygon points="4,155 4,130 -4,130 -4,155" style="fill:#777799;stroke:#313155;stroke-width:1"/>
      <polygon points="4,-155 4,-130 -4,-130 -4,-155" style="fill:#777799;stroke:#313155;stroke-width:1"/>
    </g>
    <g transform="rotate(30)"><use xlink:href="#O"/></g>
    <g transform="rotate(60)"><use xlink:href="#O"/></g>
    <g transform="rotate(90)"><use xlink:href="#O"/></g>
    <g transform="rotate(120)"><use xlink:href="#O"/></g>
    <g transform="rotate(150)"><use xlink:href="#O"/></g>
    <polygon id="h" points="6,-80 6,18 -6,18 -6,-80" style="fill:#232344">
      <animateTransform id="ht" attributeType="xml" attributeName="transform" type="rotate" from="000" to="000" begin="0" dur="86400s" repeatCount="indefinite"/>
    </polygon>
    <polygon id="m" points="3.5,-140 3.5,23 -3.5,23 -3.5,-140" style="fill:#232344">
      <animateTransform id="mt" attributeType="xml" attributeName="transform" type="rotate" from="000" to="000" begin="0" dur="3600s" repeatCount="indefinite"/>
    </polygon>
    <polygon id="s" points="2,-143 2,25 -2,25 -2,-143" style="fill:#232344">
      <animateTransform id="st" attributeType="xml" attributeName="transform" type="rotate" from="000" to="000" begin="0" dur="60s" repeatCount="indefinite"/>
    </polygon>
    <circle cx="0" cy="0" r="163" fill="url(#e)"/>
  </g>
  <script type="text/javascript"><![CDATA[
    var d = new Date();
    var s = d.getSeconds();
    var m = d.getMinutes() + s/60;
    var h = (d.getHours() % 12) + m/60 + s/3600;
    document.getElementById('st').setAttribute('from',s*6);
    document.getElementById('mt').setAttribute('from',m*6);
    document.getElementById('ht').setAttribute('from',h*30);
    document.getElementById('st').setAttribute('to',360+s*6);
    document.getElementById('mt').setAttribute('to',360+m*6);
    document.getElementById('ht').setAttribute('to',360+h*30);
  ]]></script>
</svg>


Do the auto-super-logarithm Given a positive integer n and a number a, the n-th tetration of a is defined as a^(a^(a^(...^a))), where ^ denotes exponentiation (or power) and the expression contains the number a exactly n times.
In other words, tetration is right-associative iterated exponentiation. For n=4 and a=1.6 the tetration is 1.6^(1.6^(1.6^1.6)) ≈ 3.5743.
The inverse function of tetration with respect to n is the super-logarithm. In the previous example, 4 is the super-logarithm of 3.5743 with "super-base" 1.6.
The challenge
Given a positive integer n, find x such that n is the super-logarithm of itself in super-base x. That is, find x such that x^(x^(x^(...^x))) (with x appearing n times) equals n.
Rules
Program or function allowed.
Input and output formats are flexible as usual.
The algorithm should theoretically work for all positive integers. In practice, input may be limited to a maximum value owing to memory, time or data-type restrictions. However, the code must work for inputs up to 100 at least in less than a minute.
The algorithm should theoretically give the result with 0.001 precision. In practice, the output precision may be worse because of accumulated errors in numerical computations. However, the output must be accurate up to 0.001 for the indicated test cases.
Shortest code wins.
Test cases
1    ->  1
3    ->  1.635078
6    ->  1.568644
10   ->  1.508498
25   ->  1.458582
50   ->  1.448504
100  ->  1.445673

Reference implementation
Here's a reference implementation in Matlab / Octave (try it at Ideone).
N = 10; % input
t = .0001:.0001:2; % range of possible values: [.0001 .0002 ... 2]
r = t;
for k = 2:N
    r = t.^r; % repeated exponentiation, element-wise
end
[~, ind] = min(abs(r-N)); % index of entry of r that is closest to N
result = t(ind);
disp(result)

For N = 10 this gives result =  1.5085.
The following code is a check of the output precision, using variable-precision arithmetic:
N = 10;
x = 1.5085; % result to be tested for that N. Add or subtract 1e-3 to see that
            % the obtained y is farther from N
s = num2str(x); % string representation
se = s;
for n = 2:N;
    se = [s '^(' se ')']; % build string that evaluates to iterated exponentiation
end
y = vpa(se, 1000) % evaluate with variable-precision arithmetic

This gives:

For x = 1.5085: y = 10.00173...
For x = 1.5085 + .001: y = 10.9075
For x = 1.5085 - .001 it gives y = 9.23248.

so 1.5085 is a valid solution with .001 precision.

Haskell, 55 54 52 bytes

s n=[x|x<-[2,1.9999..],n>iterate(x**)1!!floor n]!!0

Usage:

> s 100
1.445600000000061

Thanks to @nimi for 1 byte!

Thanks to @xnor for 2!


Well that's odd... no wait, that's even! Preamble
Integers are always either even or odd. Even integers are divisible by two, odd integers are not.
When you add two integers you can infer whether the result will be even or odd based on whether the summands were even or odd:

Even + Even = Even
Even + Odd = Odd
Odd + Even = Odd
Odd + Odd = Even

Likewise, when you multiply two integers you can infer whether the result will be even or odd based on whether the factors were even or odd:

Even * Even = Even
Even * Odd = Even
Odd * Even = Even
Odd * Odd = Odd

Thus, if you know the evenness or oddness of all the variables in a math expression that only involves addition and multiplication, you can infer whether the result will be even or odd.
For example, we can confidently say that (68 + 99) * 37 results in an odd because an even plus an odd (68 + 99) is an odd, and that odd times another odd (odd * 37) gives an odd.
Challenge
Write a program or function that takes in a string only containing the four characters eo+*. This string represents a mathematical expression given in prefix notation involving only addition (+) and multiplication (*). Each e represents some arbitrary even number, and each o represents some arbitrary odd number.
Your task is to simplify the expression, printing or returning a single e or o based on whether the result of the expression is even or odd.
You can assume that the input will always be in valid prefix notation. Specifically, each + and * will always have two corresponding operands occurring after it. These operands may be a single e or o, or another + or * expression that in turn has operands.
For example, the input *+eoo could be read as mul(add(e, o), o), or (e + o) * o in normal infix notation. The e and the first o are the operands corresponding to the +, and +eo and the last o are the operands corresponding to the *.
Just to make it clear, here are some invalid inputs that have incorrect prefix notation:
eo
ooe
o+e
ee*
+*oe
+e*o

A single trailing newline in the output is fine, but otherwise a plain e for even or o for odd is all that should be output.
The shortest code in bytes wins.
Test Cases
(Empty lines are only to help visually separate similar cases.)
e -> e
o -> o

+ee -> e
+eo -> o
+oe -> o
+oo -> e
*ee -> e
*eo -> e
*oe -> e
*oo -> o

+e+ee -> e
+e+eo -> o
+e+oe -> o
+e+oo -> e
+e*ee -> e
+e*eo -> e
+e*oe -> e
+e*oo -> o

+o+ee -> o
+o+eo -> e
+o+oe -> e
+o+oo -> o
+o*ee -> o
+o*eo -> o
+o*oe -> o
+o*oo -> e

*e+ee -> e
*e+eo -> e
*e+oe -> e
*e+oo -> e
*e*ee -> e
*e*eo -> e
*e*oe -> e
*e*oo -> e

*o+ee -> e
*o+eo -> o
*o+oe -> o
*o+oo -> e
*o*ee -> e
*o*eo -> e
*o*oe -> e
*o*oo -> o

++eee -> e
++eeo -> o
++eoe -> o
++eoo -> e
++oee -> o
++oeo -> e
++ooe -> e
++ooo -> o

+*eee -> e
+*eeo -> o
+*eoe -> e
+*eoo -> o
+*oee -> e
+*oeo -> o
+*ooe -> o
+*ooo -> e

*+eee -> e
*+eeo -> e
*+eoe -> e
*+eoo -> o
*+oee -> e
*+oeo -> o
*+ooe -> e
*+ooo -> e

**eee -> e
**eeo -> e
**eoe -> e
**eoo -> e
**oee -> e
**oeo -> e
**ooe -> e
**ooo -> o

+e+e+e+ee -> e
+o+o+o+oo -> o
*e*e*e*ee -> e
*o*o*o*oo -> o
+e+o+e+oe -> e
+o+e+o+eo -> o
*e*o*e*oe -> e
*o*e*o*eo -> e
+e*e+e*ee -> e
+o*o+o*oo -> o
*e+e*e+ee -> e
*o+o*o+oo -> o

+**++*+*eeoeeooee -> e
+**++*+***eooeoeooeoe -> e
+**+***+**++**+eooeoeeoeeoeooeo -> o

+e*o*e**eoe -> e
+*e+e+o+e**eeoe -> e
**o++*ee*++eoe*eo+eoo -> o

CJam, 18 17 13 bytes

Thanks to aditsu for saving 4 bytes.

qW:O%eu~"eo"=

Try the test suite here. (The test suite is too long for the permalink. Just copy them from the challenge spec.)

Explanation

q     e# Read the input.
W:O   e# Push a -1 and store it in variable O.
%     e# Use the -1 to reverse the string, because CJam's stack-based nature and the
      e# commutativity of the operators means we can evaluate the code in postfix notation.
eu    e# Convert the string to upper case, turning 'e' into 'E' (a variable with even value
      e# 14) and 'o' into 'O' (which we've stored the odd value -1 in).
~     e# Evaluate the string as CJam code, leaving the result on the stack.
"eo"= e# Use the result as an index into the string "eo". CJam's indexing is cyclic so it
      e# automatically takes inputs modulo 2. Negative indices also work as expected.


Where will the ball land? Given a string where the first line contains spaces and one period (., the "ball"), followed by lines containing spaces, forward slashes (/), and backslashes (\), determine what column the ball will land in after falling from its starting position. Each / moves it to the left by 1 column and each \ moves it to the right by 1 column.

Sample input

    .
  /   \  \
    /   /
 \   \/  \
   \   /\
    \ /\  \
     \    /

Sample output

The ball starts in column 5, hits the / on line 3, then the three \'s on lines 5 through 7 for a final position of:

7

Note that columns are 1-indexed, mostly for consistency with text editor conventions.

Edge cases

If the ball hits a / in the first column, it's eternally stuck in the nonexistent column 0. Your program should handle this correctly by printing 0.

If the ball hits either side of a \/ pattern, the result is undefined. Your program is permitted to terminate with no output, loop infinitely, or print an error message (my solution prints -1), but it must not print anything that can be perceived to be valid output.

If the ball hits the left slash in a \\ pattern, it should end up directly beneath the right slash, not to the right of it. The solution I originally envisioned was prone to getting this wrong, so don't go down that path!

There may or may not be spaces after the . or the last / or \ on each line. Your program should not rely on such padding being available. On a similar note, there may or may not be any lines following the first line.

You may assume that the first line will have zero or more spaces and exactly one .. Subsequent lines, if any, will have zero or more spaces and zero or more slashes.

Implementation details

Your program may read from a file (specified as a command-line argument) or read from standard input, at your convenience.

Your program must output a single number to standard output. (Yes, a trailing newline is fine. Yes, the number may have more than one digit.)

Test cases

  Input:

.

  Output:

1

  Note that the input here is exactly one byte. This is the smallest case you should be able to handle.

  Input:

 .
 \
  \
   \
    \

  Output:

 6

  Note that there are no spaces after these slashes.

  Input:

  .
  /
 /\\  /  \
//\ \/// //
\\/ \/\ /\/

  Output:

0

  Input:

  .
/ / /
 \\\
  /\\
 /   \

  Output:

1

  Input:

   .

 \
       /
/

      \

  Output:

4

  Input:

 .
 \

\/\/\/

  Output:

(anything but a nonnegative number)

Closing remarks

This question is similar to Simulate a (gravity-based) billiard-ball-type computer, but significantly simpler, so hopefully it will gain more interest.

I have a 169-character solution in Python. I'm sure the talented golfers here can tear that record to pieces, though. :^)

This is code-golf, so the shortest answer in characters will be accepted at the end of the month!

Python, 143B
import sys
for l in sys.stdin:
 a=l.find('.')
 if a>-1:F=a
 elif F>-1:
    if'\\/'in l[F-1:F+2]:z
    F+={'\\':1,'/':-1}.get((l+' '*F)[F],0)
print F+1

Using the space/tab indentation trick. I haven't done anything particularly clever here. F is the current index, l is the current line; z is undefined so it throws an exception, which is definitely not a positive integer, handling the \/ situation.


Output with the same number of digits of pi as the length of the code Your challenge is to print x digits of pi where x is your code length.

Examples:

Source code (length) -> output
foo!        (4)         3.141
foobar      (6)         3.14159
kinda long  (10)        3.141592653
+++++       (5)         3.1415
123456789   (9)         3.14159265

You can use floor(π/10 * 10code_length) / 10code_length - 1 to determine the number of digits you need to print. Note that the decimal point does not count as a digit of pi - so code of length 3 should have output 3.14, of length 4.

Rules:

Your code length must be larger than three characters.
You may not use any standard loopholes.
You may use any standard allowed output methods.
You may not read your source to determine code length.
You may not use a builtin pi constant.
Pi must be completely accurate and not approximated.
The decimal point in the output is necessary. If you choose to output via return value, you must return a floating point integer.
The goal of this challenge is to find the shortest solution in each language, not the shortest language for the solution. Don't be afraid to post a solution in a language when a shorter solution is posted in the same language as long as your solution uses a different method.

Mathematica, 18 bytes
using zeta function

Sqrt[6Zeta@2]~N~18

Try it online!


Sort numbers represented in an unknown base Given a list of strings, sort the list as numbers without knowing what base is used. The values of the digits are also unknown (it is possible that '1' > '2').

Since the values of digits are unknown, use Benford's Law (or First Digit's Law) to determine the relative value of the digits. For distributions that follow Benford's Law, lower valued digits appear as a leading digit more frequently than higher valued digits.

Rules

This is code-golf
The list of strings can come from a source of your choosing (stdin, variable, file, user, etc.)
Strings are limited to ASCII characters.
Characters that do not appear as a leading character have the highest values. (assume there are no zeros, and sort strictly by leading frequency.)
Characters that appear as leading digits the same number of times as other characters are weighted equally.

Example

Unsorted

['c','ca','ac','cc','a','ccc','cx','cz','cy']

Sorted

['c','a','cc','ca','cz','cy','cx','ac','ccc']

Note: In the example, 'cz','cy' and 'cx' can appear as the 5th, 6th and 7th elements in any order since the digits 'x','y' and 'z' are equally weighted.

Python, 59 108 112

sorted(a,None,lambda x:(-len(x),map(zip(*a)[0].count,x)),1)

Input is provided as the list a, and this expression produces the sorted list (+2 characters to assign to a variable). This sorts the list in reverse by negated length and then by frequency.