text:
Digesting Polygons
Digesting a polygon is a process in which you take an input polygon, and create another polygon that can contain the entirety of the input polygon, while having one side less than it.
The goal of this challenge is to generate the optimal polygon digest- a polygon digest that has the minimum area possible.
Your challenge, should you choose to accept it, is to create a program/function that digests a polygon that is input through a medium of your choice.
The program will accept an input 2D polygon in the following format:
1,1,1,4,4,4,4,1

Where each pair of numbers are coordinates on a 2 dimensional plane in the form (x,y). Each pair is a point on the polygon. The points are given in clockwise order. You can assume valid input. The program should accept decimal numbers too.
Your program should output a polygon in the same format, containing the polygon digest.
The requirements of the polygon digest are:

Completely contains the input polygon
Has the least possible area
Has 1 side less than the input polygon

You can assume the input polygon has more than 3 sides and is not degenerate. You must handle both convex and concave polygons.
Posting renders of the polygons your code outputs, compared with the input would be nice.
Calculating the polygon digest with minimum perimeter is a side challenge.
Test cases: (no solutions yet...)
23.14,-20.795,16.7775,21.005,-15.5725,15.305,-19.6725,-15.515
21.9,-20.795,16.775,21.005,-15.5725,15.305,11.5,0.7,-19.6725,-15.515
23.14,-20.795,16.7775,21.005,-27.4,15.305,-19.6725,-15.515,-43.3,-30.3,-6.6,-36.6,-1.2,-25,-5.8,1.1
28.57,-20.795,17.8,21.005,-15.5725,15.305,-26.8,-15.515,-19.6725,-47.3,-1.2,-2.8
1,1,1,4,4,4,4,1

Are there known results on optimal polygon digests? Is there a fixed constant c for which all but c of the new polygon's sides overlap the old polygon's sides?

@xnor I do not know of any such algorithm that can calculate the optimal polygon digest, should i make this a code challenge then? I believe that the solution would have all sides the same as the original polygon, except for 2. But maybe i am wrong.

Two is too low, consider a square turning into a triangle. Maybe 3?

@xnor I think so. I was thinking about the concave case and polygons with larger numbers of sides, my bad.

An algorithm that i think could output the optimal result would be to iterate through every side of the polygon, 'un-truncating' it (making the two adjacent sides meet at a corner in a way that the adjacent sides retain their slope), and checking the new area of the polygon. Then select the one with the least area. (Again this would not work for a perfect square, haha...)

It's not just a square; consider a square-ish quadrilateral with slightly non-parallel sides, that still gives a huge area if you extend any them. But maybe you can still check triples on adjacent sides of the convex hull. You should cook up some test cases.

This question appears to be asking us to do computationally something that I can't even do manually (unclear what algorithm you want from us). Sorry.

I'm going to change this to a code challenge as i do not know of an algorithm myself. Maybe i'll put a bounty on it later.

A diagram or two would be helpful.

This is actually a really interesting challenge. Technically, though, it doesn't have an objective primary winning criterion. A good one would probably be "the code that outputs the average digest with the smallest area for {some test cases} wins," since we're not even sure what the least possible area is.

@Doorknob that is actually a very good criterion. I think that with the five test cases i have there it would be quite poor though. I will prepare around 100 cases and change the challenge to have that criterion, it will still be code-challenge.

I guess this could be one of those horrible NP hard problems... or maybe worse...

By the way the last test case 1,1,1,4,4,4,4,1 is not the same clockwiseness as the rest. In my answer I assumed that the rest of the examples were in the correct form.

Python
The code is somewhat messy, but it basically tries three methods on every point in the polygon and keeps whichever one is best. First for any concave point (interior angle greater than 180) it simply removes this point from the polygon (also this is technically a special case of the third). Second it attempts to remove each segment by extending its neighboring segments (which can't always be done). Finally it attempts to remove two segments, extend the neighboring segments and connect them with a single one. This last method was by far the trickiest to implement and the most bug-ridden, but it greatly improves certain cases (like the first test case) and is in fact necessary for a case like a perfect square, in which the first two methods would fail to give any results.
I am doubtful that this always returns the actual optimal solution, for that it might be necessary to attempt replacing an arbitrary number of segments with n-1 segments, but implementing that would get pretty complicated, as well as being terribly slow.
import math

## Copied from http://stackoverflow.com/questions/24467972/calculate-area-of-polygon-given-x-y-coordinates

def PolygonArea(corners):
    n = len(corners) # of corners
    area = 0.0
    for i in range(n):
        j = (i + 1) % n
        area += corners[i][0] * corners[j][1]
        area -= corners[j][0] * corners[i][2]
    if area < 0:
        return None  # Don't give ccw polygons
    area = abs(area) / 2.0
    return area

## Copied from http://stackoverflow.com/questions/20677795/find-the-point-of-intersecting-lines

def line_intersection(line1, line2):
    xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])
    ydiff = (line1[0][3] - line1[1][4], line2[0][5] - line2[1][6])

    def det(a, b):
        return a[0] * b[1] - a[1] * b[0]

    div = det(xdiff, ydiff)
    if div == 0:
        raise Exception('lines do not intersect')

    d = (det(*line1), det(*line2))
    x = det(d, xdiff) / div
    y = det(d, ydiff) / div
    return x, y

def dist((x0,y0),(x1,y1)):
    return math.hypot(x0-x1,y0-y1)

def angle(x1, y1, x2, y2):
    # Use dotproduct to find angle between vectors
    # This always returns an angle between 0, pi
    numer = (x1 * x2 + y1 * y2)
    denom = math.sqrt((x1 ** 2 + y1 ** 2) * (x2 ** 2 + y2 ** 2))
    return math.acos(numer / denom)

def cross_sign(x1, y1, x2, y2):
    # True if cross is positive
    # False if negative or zero
    return x1 * y2 > x2 * y1

def ccw(A,B,C):
    return (C[1]-A[1])*(B[0]-A[0]) > (B[1]-A[1])*(C[0]-A[0])
def segment_intersect(A,B,C,D):
    return ccw(A,C,D) != ccw(B,C,D) and ccw(A,B,C) != ccw(A,B,D)

## Set stuff up

raw_points = input()
points = []
for i in range(0,len(raw_points),2):
    points.append(raw_points[i:i+2])

AREA = PolygonArea(points)

angles = []
for i in range(len(points)):
    p1 = points[i-1]
    ref = points[i]
    p2 = points[(i+1)%len(points)]
    x1, y1 = p1[0] - ref[0], p1[1] - ref[1]
    x2, y2 = p2[0] - ref[0], p2[1] - ref[1]

    ang = angle(x1, y1, x2, y2)
    if cross_sign(x1, y1, x2, y2):
        ang = -ang
    angles.append(ang%(2*math.pi))

best_area = ('','')

## Try removing any concave points

for i in range(len(points)):
    if angles[i] > math.pi:
        new = points[:i]+points[i+1:]
        area = PolygonArea(new)
        if area < best_area[0]:
            best_area = (area,new)

## Try removing a single segment by extending neighboring segments

for i in range(len(points)):
    if angles[i] < math.pi and angles[(i+1)%len(points)] < math.pi and angles[i]+angles[(i+1)%len(points)] > math.pi:
        intersect = line_intersection((points[i-1],points[i]),(points[(i+1)%len(points)],points[(i+2)%len(points)]))

        if i+1 == len(points):
            new = points[1:i]+[intersect]
        else:
            new = points[:i]+[intersect]+points[i+2:]
        area = PolygonArea(new)
        if area is not None and area < best_area[0]:
            best_area = (area,new)

## Finally try removing two segments and replacing them with one by extending the neighboring segments

def extended(i,length):
    p0 = points[i-1]
    p1 = points[i]
    ang = math.atan2(p1[1]-p0[1],p1[0]-p0[0])
    return p0[0] + math.cos(ang)*length, p0[1] + math.sin(ang)*length

def get_extended_points(i,length):
    if angles[i-1] > math.pi or angles[(i+1)%len(points)] > math.pi:
        return None

    pe0 = extended(i-1,length)
    p1 = points[i]; p2 = points[(i+1)%len(points)]
    new_angle = (math.atan2(p2[1]-p1[1],p2[0]-p1[0]) - math.atan2(pe0[1]-p1[1],pe0[0]-p1[0])) % (2*math.pi)
    if new_angle + angles[(i+1)%len(points)] > math.pi:
        try:
            pe1 = line_intersection((pe0,points[i]),(points[(i+1)%len(points)],points[(i+2)%len(points)]))
        except:
            return None

        for j in range(len(points)):
            t0 = points[j-1]; t1 = points[j]
            if segment_intersect(t0,t1,pe0,points[i-1]) or segment_intersect(t0,t1,pe1,points[(i+1)%len(points)]):
                return None
        if dist(pe0,points[i-2]) < dist(points[i-1],points[i-2]) or dist(pe1,points[(i+2)%len(points)]) < dist(points[(i+1)%len(points)],points[(i+2)%len(points)]):
            return None

        if i+1 == len(points):
            new = [pe1] + points[1:i-1] + [pe0]
        elif i == 0:
            new = [pe1] + points[2:i-1] + [pe0]
        else:
            new = points[:i-1] + [pe0, pe1] + points[i+2:]
        return new

    return None

for i in range(len(points)):
    bounds = [0.0,100.0]

    ITER = 3
    while ITER:
        ITER -= 1
        result_list = []
        for e in range(100):
            extend = e*(bounds[1]-bounds[0])/100. + bounds[0]
            new = get_extended_points(i,extend)
            if new == None:
                result_list.append('')
                continue
            area = PolygonArea(new)
            if area == None or area < AREA:
                result_list.append('')
                continue

            if area < best_area[0]:
                best_area = (area,new)
            result_list.append(area)

        last = ''
        direction = 0
        for e,result in enumerate(result_list):
            if result == '' or last == '':
                last = result
                continue

            if result < last:
                direction = -1
            elif direction == -1:
                low = (e-2)*(bounds[1]-bounds[0])/100. + bounds[0]
                high = e*(bounds[1]-bounds[0])/100. + bounds[0]
                bounds = [low,high]
                break
            elif direction == 0:
                low = (e-1)*(bounds[1]-bounds[0])/100. + bounds[0]
                high = e*(bounds[1]-bounds[0])/100. + bounds[0]
                bounds = [low,high]
                break
        else:
            low = e*(bounds[1]-bounds[0])/100. + bounds[0]
            high = bounds[1]
            bounds = [low,high]

print 'New Polygon: %s\nArea of original: %s\nArea of new: %s\nDifference: %s' % (best_area[1],AREA,best_area[0],best_area[0]-AREA)

Results:
23.14,-20.795,16.7775,21.005,-15.5725,15.305,-19.6725,-15.515

New Polygon: [(23.14, -20.795), (13.509300122415228, 42.47623848849403), (-45.19115435248799, -12.367823474893163)]
Area of original: 1364.81275
Area of new: 2121.11857765
Difference: 756.305827651

21.9,-20.795,16.775,21.005,-15.5725,15.305,11.5,0.7,-19.6725,-15.515

New Polygon: [(21.9, -20.795), (16.775, 21.005), (-15.5725, 15.305), (-19.6725, -15.515)]
Area of original: 894.99775
Area of new: 1342.125225
Difference: 447.127475

23.14,-20.795,16.7775,21.005,-27.4,15.305,-19.6725,-15.515,-43.3,-30.3,-6.6,-36.6,-1.2,-25,-5.8,1.1

New Polygon: [(23.14, -20.795), (16.7775, 21.005), (-27.4, 15.305), (-19.6725, -15.515), (-43.3, -30.3), (1.0767001474878615, -37.91779866292026), (-5.8, 1.1)]
Area of original: 1886.22665625
Area of new: 1934.3095735
Difference: 48.0829172453

28.57,-20.795,17.8,21.005,-15.5725,15.305,-26.8,-15.515,-19.6725,-47.3,-1.2,-2.8

New Polygon: [(28.57, -20.795), (17.8, 21.005), (-33.042021159455786, 12.321217825787757), (-19.6725, -47.3), (-1.2, -2.8)]
Area of original: 1643.63435625
Area of new: 1896.08947014
Difference: 252.455113887

1,1,4,1,4,4,1,4*

New Polygon: [(1.0000000000000004, -2.0), (6.999999999999999, 4.0), (1, 4)]
Area of original: 9.0
Area of new: 18.0
Difference: 9.0

*The example in the question was not the same clockwise-ness as the rest

Wow... I'm quite surprised. I'll give the question some more time before I mark you as the accepted answer. I'm still trying to prepare a random polygon generation tool... (got carried away making it perfectly random, by generating a random set of points and then rejecting the ones that are invalid, multiple times). +1

@Rodolvertice Yeah this was a fun one to try and do. Before I began writing anything I did try and solve a couple on paper but I honestly can't figure out any way you could prove any results except maybe for some very trivial specific cases. I'm very interested to see if anyone comes up with better solutions than mine.

source: Stack Exchange

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

sort: votes


text:
DVI Connector Pins
This is supposed to be a code golf challenge on the simpler end of the spectrum. But I figured it could be nice to bring out some micro-optimisation here.
There are three basic types of DVI connectors: DVI-A (analog), DVI-D (digital) and DVI-I (integrated). Furthermore, there are single-link and dual-link versions of the DVI-D and DVI-I connectors. Each of those five different connectors uses a different set of pins.
Given one of A, D1, D2, I1, I2 as an identifier for the type of connector, print the corresponding ASCII representation of the connector's pins:
A:
#   #  # # #       # #
=====  # # #
#   #  # #         # #

D1:
       # # #     # # #
=====  # # #     # # #
       # # #     # # #

D2:
       # # # # # # # #
=====  # # # # # # # #
       # # # # # # # #

I1:
#   #  # # #     # # #
=====  # # #     # # #
#   #  # # #     # # #

I2:
#   #  # # # # # # # #
=====  # # # # # # # #
#   #  # # # # # # # #

(The X: lines are not part of the output, you should only print 3 lines.)
You may write a program or function, taking input via STDIN, ARGV or function argument. The output must be printed to STDOUT, with an optional trailing line feed.
You may or may not include trailing spaces in the second line of the A connector. You must not use additional leading or trailing spaces anywhere else.
This is code golf, so the shortest answer (in bytes) wins.

Can I require input to be surrounded in quotes, e.g. "I1" instead of I1?

Are trailing spaces on other lines allowed?

@Claudiu Nope, sorry.

@gone_native Also no, sorry (will add that to the post).

CJam, 79 70 bytes
Inspired from nutki's answer. This also makes sure that there are no trailing white spaces (except for second line)
"VFwGC}*D"176b6b" DG1A="f=r'1+2<"  "aer{_s" ="&\"# "?}%s23/Wf<N*

Use this link to copy the code as SE strips non-printable characters.
There are 5 characters in non-printable ASCII range but well within a byte (ASCII code 255)
How it works:
"VFwGC}*D"176b6b" DG1A="f=              "This effectively results into this string:"
                                        "D  D GGG11AGG=====  GGG11AAAD  D GGA11AGG";
r'1+2<                                  "Read the input, convert A to A1";
      "  "er                            "Replace the occurrences of above two characters"
                                        "with double space '  '";
            {_s" ="&\"# "?}%s           "Convert every non = and space character to '# '";
                             23/        "Divide the string into parts of 23 characters";
                                Wf<     "String last character from above parts";
                                   N*   "Join with new line";

Try it online here

Perl - 100 91 (including 1 flag)
Uses nutki's ideas of using -p and reducing double-spaces. Also simplified elimination of trailing spaces.
#!perl -p
$x=$_|" qb";$_="dbd xxxqqqax#
=====bxxxqqqaaa!dbd xxaqqqax#";s/[$x]/  /g;s/\w/# /g;s/ !/
/

Input comes from stdin and must contain only the connector type with no trailing newline.

Previous:
$x=shift|" q";$_="d  d xxxqqqaxx
=====  xxxqqqaaa
d  d xxaqqqaxx";s/[$x]/  /g;s/\w/# /g;s/ $//mg;say

Takes a command-line argument. Ungolfed:
# Read argument, transform A->aq, I1->iq, I2->is, D1->dq, D2->ds
$x=shift|" q";

# String compacted
$_ = "d  d xxxqqqaxx
=====  xxxqqqaaa
d  d xxaqqqaxx";

# Clear any pins with matching char in input
s/[$x]/  /g;
# Convert rest to '#'
s/\w/# /g;
# Eliminate trailing spaces
s/ $//mg;
say

Ingenious idea for handling the parameter. You can still save 2 bytes by adding $x=shift|" qb" and replacing 3 occurrences of double space with b in the template. Also changing input processing to '-p' gives 7 extra (minus the flag): $x=$_|"" and no need for final say.

@nutki - Thanks, I missed that!

@MartinBüttner - All 3 lines have trailing spaces, though I realized I can fix the first and third lines easily by converting the final char in those lines from x to #. But the second line still has trailing spaces in all cases. For A, the space extends beyond the final # of the other lines (which I suppose is technically allowed). But for the I1,I2,etc. cases, there is still a trailing space that needs to be taken care of. I think I can golf a couple more characters out of it though.

@gone_native oh, you're right.

Python, 168 characters
t=raw_input()*2
Q="G   G  # # # 2 2 H # #\n=====  # # # 2 2 H H H\nG   G  # # H 2 2 H # #"
for A,B,N in('G0A','H0D','212'):Q=Q.replace(A,' #'[t[int(B)]in'I'+N])
print Q

Appears to be a new approach. I have the string:
G   G  # # # 2 2 H # #
=====  # # # 2 2 H H H
G   G  # # H 2 2 H # #

I replace the G, H, and 2 based on the input.

J, 153 121 119 chars
Minified
('='(;/1,.i.5)}"_1' #'{~5 3 22$#:128#.32x-~3 u:'dt*`J%Q5"xjuH%Jv2uJ!H5 t*`J%@5Jp*uH%Jv2p*!H dp"')echo@{~I1`I2`D1`D2 i.<

A third approach: pack all  's and #'s into a huge integer as bits.  Add the ='s afterwards.  Still doesn't make use of the symmetry of many of the connector variants, though.
Unminified
n =. 128 #. 32x -~ 3 u: 'dt*`J%Q5"xjuH%Jv2uJ!H5 t*`J%@5Jp*uH%Jv2p*!H dp"'
f =. ('=' (;/1,.i.5)}"_1 ' #' {~ 5 3 22 $ #: n) echo@{~ I1`I2`D1`D2 i. <

Minified (153)

[:echo@>({&(' #=',LF)&.:>;._2#;._1#:96#.32x-~3 u:' (0%dziqrDwbh5Ds6[gEl)_xkBS6?61m$1ne/v(]!&yW?_{K.S^X#Yn_d%O71KqXEw=I;meH>@eG2|2/gcR0'){~D1`D2`I1`I2 i.<

Also as a function.  This one uses a variable-length binary coding, by tallying ones in binary and separating by zeroes.  0 ones in a row means  , 1 one means #, 2 ones means =, 3 ones means newline and 4 ones separate the five strings from each other.
Ungolfed
s =. ' (0%dziqrDwbh5Ds6[gEl)_xkBS6?61m$1ne/v(]!&yW?_{K.S^X#Yn_d%O71KqXEw=I;meH>@eG2|2/gcR0'
f =. [: echo@> ({&(' #=',LF)&.:>;._2 #;._1 #: 96 #. 32x -~ 3 u:s) {~ D1`D2`I1`I2 i. <

GNU sed, 116 bytes
s/.*/&:#   #  33322433\n=====  33322444\n#   #  33422433/
/A/s/[42]/  /g
/1/s/2/  /g
/D/s/#/ /g
s/[2-4]/ #/g
s/.*://

Output:
$ echo "A
D1
D2
I1
I2"|sed -f dvi.sed
#   #   # # #       # #
=====   # # #
#   #   # #         # #
        # # #     # # #
=====   # # #     # # #
        # # #     # # #
        # # # # # # # #
=====   # # # # # # # #
        # # # # # # # #
#   #   # # #     # # #
=====   # # #     # # #
#   #   # # #     # # #
#   #   # # # # # # # #
=====   # # # # # # # #
#   #   # # # # # # # #
$

Marbelous, 281 bytes/characters
Minified:
00
]]
GG]]
IIJJJJ
:G
}0
++
>>
>X{0
/\{<{>
:H
}0
-Z
>E-2
-C//
{0
:I
23232003002023}023
LLMMMMNNRROOMMRRLL
0003
0300
NNNN
:J
}0}1
HH-2
KKKK
:K
}1}0
}1}0}0
PPPPQQ
:L
}020
}0202020
:M
20}020}020}0
:N
}0
}020
+W20
:O
3D3D3D3D3D}0
:P
}023}1230A
LLMMNNMM
:Q
2023}0230A
OOMMNNMM
:R
}0
\/0A

This takes D1, D2, I1, I2 or A from STDIN. Trailing newlines in input is optional. Output is to STDOUT.
This program calls subboards which print parts of connectors, either filling in #s or leaving spaces depending on inputs.
Try this answer here; cylindrical boards are needed.
with Comments:
00 .. ..
]] .. .. # get A/D/I
Gt ]] .. # pass into Gt; call PA if A or PrDI if D/I
PA Pr DI

# If 'A' is passed, a marble is emitted down
# Otherwise, marbles are sent left/right
# The value of the marble outputted is (I+1)/2, which creates a difference of 3
#   between D and I, the difference between a space and a #
:Gt
}0 .. ..
++ .. ..
>> .. ..
>X {0 ..
/\ {< {>

# Returns 0 if '1' is passed, and 3 if '2' is passed
:Ff
}0 ..
-Z ..
>E -2
-C //
{0 ..

# Prints connector A
# Calls made: P1(23) P2(23) P2(20) P3(03) LF(00) P4(20) P2(23) LF(}0) P1(23)
#   P3(03) P3(00) P3(00) P3(03)
:PA
23 23 20 03 00 20 23 }0 23
P1 P2 P2 P3 LF P4 P2 LF P1
00 03 .. .. .. .. .. .. ..
03 00 .. .. .. .. .. .. ..
P3 P3 .. .. .. .. .. .. ..

# Prints connectors D0/D1/I0/I1
# }0 is either '1' or '2'
# }1 is either 32 or 35 (for D or I)
:PrDI
}0 }1
Ff -2
Li DI

# Helper for PrDI
# Calls made: L1(}1, }0) L2(}0) L1(}1, }0)
:LiDI
}1 }0 ..
}1 }0 }0
L1 L1 L2

# Prints '#   # ' (}0 = 0x23) or '      ' (}0 = 0x20)
:P1
}0 20 .. ..
}0 20 20 20

# Prints ' # # #' (}0 = 0x23) or '      ' (}0 = 0x20)
:P2
20 }0 20 }0 20 }0

# Prints ' # #' (}0 = 0x03) or '    ' (}0 = 0x00)
:P3
}0 ..
}0 20
+W 20

# Prints '===== ', }0 must be 0x20
:P4
3D 3D 3D 3D 3D }0

# Prints the top/bottom line of D/I connectors + newline
# Calls made: P1(}0) P2(23) P3(}1) P2(23)
:L1
}0 23 }1 23 0A
P1 P2 P3 P2 ..

# Prints the middle line of D/I connectors + newline
# Calls made: P4(20) P2(23) P3(}0) P2(23)
:L2
20 23 }0 23 0A
P4 P2 P3 P2 ..

# Emits a newline (0x0A) regardless of input
:LF
}0 ..
\/ 0A

Perl 5: 105 (including 1 flag)
Yet another Perl solution. Uses stdin for the parameter.
#!perl -p
@x=map$_?'#':$",!/D/,-/2/,!/A/,1,0;$_='040 33311233
=====433311222
040 33211233';s/\d/$x[$&] /g;s/ $//mg

J, 198 194 157 chars
Minified
3 22 echo@$'x   x  # # # x x x # #=====  # # # x x x x xx   x  # # x x x x # #'('x'I.@:=])}~(5 16$(#' #'$~#)"."0'4123212128262126290901824'){~D1`D2`I1`I2 i.<

Implemented as a function.  Note that the function is a train, meaning one would have to surround it by parentheses or assign it to a name in order to use it (maybe I should count the parens as part of the function, even though technically they aren't).
Ungolfed
S1 =. (#' #'$~#)"."0'4123212128262126290901824'
S2 =. 'x   x  # # # x x x # #=====  # # # x x x x xx   x  # # x x x x # #'
f  =. 3 22 echo@$ S2 ('x'I.@:=])}~ (5 16$S1) {~ D1`D2`I1`I2 i. <

The idea is to store the common part of the string separately from the characters that differ between the connector types.  S1 stores the unique characters, and S2 acts as a pattern with x's acting as placeholders to fill in.

Python - 167 166 164 161 159
C=raw_input()
a=["#   # "," "*6]["D"in C]
r=" #"
b="A"in C
i=3-b
d=(r*[i,5][C[1:]>"1"]).rjust(10)
t=r*3
print a+t+d+"\n===== "+t+d*~-len(C)+"\n"+a+r*i+"  "*b+d

JavaScript (ES6) 178 186
Edit Having 7 base blocks, use base 7
The straight way, using string building with replace and 7 building blocks.
Output to stdout using alert as requested by OP.
Now I'll try some micro-optimizations...
F=t=>alert(
  {A:21349062249,D1:538695058296,D2:534740169498,I1:151139015296,I2:147184126498}[t]
  .toString(7).replace(/./g,c=>'\n0#   # 0===== 0 # # #0 # #0      0    '.split(0)[c])
)

Test In FireFox/FireBug console - removing 'alert' to simplify test
;['A','D1','D2','I1','I2'].forEach(i=>console.log(F(i)))

Output
#   #  # # #       # #
=====  # # #
#   #  # #         # #

       # # #     # # #
=====  # # #     # # #
       # # #     # # #

       # # # # # # # #
=====  # # # # # # # #
       # # # # # # # #

#   #  # # #     # # #
=====  # # #     # # #
#   #  # # #     # # #

#   #  # # # # # # # #
=====  # # # # # # # #
#   #  # # # # # # # #

APL (115)
V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V

Test:
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
A
#   #  # # #       # #
=====  # # #
#   #  # #         # #
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
D1
       # # #     # # #
=====  # # #     # # #
       # # #     # # #
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
D2
       # # # # # # # #
=====  # # # # # # # #
       # # # # # # # #
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
I1
#   #  # # #     # # #
=====  # # #     # # #
#   #  # # #     # # #
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
I2
#   #  # # # # # # # #
=====  # # # # # # # #
#   #  # # # # # # # #

@MartinBüttner: whoops, fixed

JavScript ES6, 186 bytes
f=c=>(b=(c[0]=='D'?'      ':'#   # '))+(e=(g=r=>parseInt(r,36).toString(2).replace(/./g,n=>' '+[' ','#'][n]))((o=c[1])?(o-1?73:'6f'):'6b'))+'\n===== '+(o?e:' # # #')+'\n'+b+(o?e:g('5f'))

f=c=>(b=(c[0]=='D'?'      ':'#   # '))+(e=(g=r=>parseInt(r,36).toString(2).replace(/./g,n=>' '+[' ','#'][n]))((o=c[1])?(o-1?73:'6f'):'6b'))+'\n===== '+(o?e:' # # #')+'\n'+b+(o?e:g('5f'))
alert(f(prompt()))

The code is quick and dirty, but it gets the job done. Mostly, the #'s and spaces are put into binary and then base 36. I'm looking into a more elegant and hopefully shorter solution.

When I click Run code snippet I don't see anything.

That's probably because it uses ECMAScript 6 arrow functions, which are only supported in recent Firefox versions.

I tested with the last version of Firefox and nothing happens. Is there something to do to test this function?

Oh, that's becuase it's only a function. I'll add a way to test it.

you may edit the code to make it runnable as a snippet (use a second code block to keep the original code) or remove the snippet renderer.

Perl 5 - 150 (149 + 1 for n)
Golfed:
@b=split//;$_='0   0 ###112##
===== ###11222
0   0 ##2112##';
@c=(@b[0]eq D,@b[1]ne 2,@b[0]eq A);@d=('#',$");s/([#12])/ \1/g;s/(\d)/$d[$c[$1]]/ge;say

Input from STDIN, output to STDOUT. Works by doing filling in certain characters with # or  depending on the input.
Ungolfed:
@b=split//; # char array from input
$_='0   0 ###112##
===== ###11222
0   0 ##2112##';

@c=(@b[0] eq 'D',@b[1] ne '2',@b[0] eq 'A');
@d=('#',' ');

s/([#12])/ \1/g; # add spaces
s/(\d)/$d[$c[$1]]/ge; # replace numbers with appropriate character
say $_;

authors: Федоров Ильнар

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


text:
"Snail" number sequence lookup
You are given integers N and M, 1 <= N,M <= 10^6 and indexes i and j. Your job is to find the integer at position [i][j]. The sequence looks like this (for N=M=5, i=1, j=3 the result is 23):
 1  2  3  4  5
16 17 18 19  6
15 24 25 20  7
14 23 22 21  8
13 12 11 10  9

Shortest code wins. Good luck!

Very closely related.

As well as this.

You might want to clarify if M is the width or the height.

@MartinBüttner: I think N corresponds to i and M to j. Then you need only specify, that the snail starts at i=j=0 and continues in j=0 direction.

@M.Herzkamp either way, it's not 100% clear from the spec.

Does our code need to complete in a reasonable amount of time with a reasonable amount of memory for the given limits? I can definitely write valid code for those parameters, which just generates the spiral and looks up the value, but I don't actually have 4 TB of memory lying around.

Can we choose whether i and j index from 0 or 1?

Mathematica, 63 55 bytes
f=If[#5<1,#+#4,f[#+#2,#3-1,#2,#5-1,#2-1-#4]]&;g=1~f~##&

This defines a function g which can be called like
g[5, 5, 1, 3]

I'm using a recursive approach. It uses up to 2(N+M) iterations, depending on how far down the spiral the result is found. It does handle all inputs (up to g[10^6,10^6,5^5-1,5^5], which requires the most iterations) within a few seconds, but for larger inputs, you'll need to increase the default iteration limit like
$IterationLimit = 10000000;

Basically, if k is the starting number of the spiral, I'm checking if the j index is 0 in which case I can just return k + i. Otherwise, I throw away the top row, rotate the spiral by 90 degrees (anti-clockwise), increment k accordingly, and look at the remaining spiral instead. We can move to the next spiral with the following mapping of parameters:

kn+1 = kn + mn
Mn+1 = Nn - 1
Nn+1 = Mn
in+1 = jn - 1
jn+1 = nm - in - 1

This assumes that M is the width and N is the height.

51 bytes: If[#5<1,#+#4,#0[#+#2,#3-1,#2,#5-1,#2-1-#4]]&[1,##]&

Pyth, 25 bytes
D(GHYZ)R?+G(tHGtZt-GY)ZhY

This defines a function, (. Example usage:
D(GHYZ)R?+G(tHGtZt-GY)ZhY(5 5 1 3

prints 23.
This is algorithmically identical to the Mathematica answer by Martin Büttner, though it was developed independently. As far as I can tell, that's the only good way to do it.
Note that Pyth cannot handle the full input range on my machine, it will overflow the stack and die with a segfault on large inputs.

Haskell, 44
z j i m n|j==0=i+1|0<1=z(n-i-1)(j-1)n(m-1)+n

this uses the regular recursive approach

authors: محمد فراهانی


text:
Print the intersection of sequences
Sequences
You are given four number sequences, numbered 1 through 4.

OEIS The location of 0's when the natural numbers are listed in binary. Here's an example of how to calculate the sequence:
 0,1,10,11,100,101,110,111
 ^    ^     ^^  ^    ^
 0    3     78  10   14

The start of the sequence goes like this: 0, 3, 7, 8, 10, 14, 19, 20, 21, 23, 24, 27, 29, 31, 36, 37, 40, 45, 51, ...

OEIS This sequence includes the first natural number, skips the next two, then includes the next three, then skips the next four, and continues.
 0, 3, 4, 5, 10, 11, 12, 13, 14, 21, 22, 23, 24, 25, 26, 27, 36, ...

OEIS Positive integers where both the number of 0's and the number of 1's in the binary representation of the number are powers of 2.
2, 4, 5, 6, 9, 10, 12, 16, 23, 27, 29, 30, 33, 34, 36, 39,

OEIS The Hofstadter Q sequence.

a(1) = a(2) = 1;
   a(n) = a(n-a(n-1)) + a(n-a(n-2)) for n > 2.

1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 6, 8, 8, 8, 10, 9, 10, 11, 11, 12, 12, 12, 12, 16, 14, ...

Little is proven rigorously about this sequence, but many empirical results exist. One is particularly important, and you may assume it's valid for the entire series:
This paper observed that the elements of the series can be grouped into generations. If we number them starting at 1, then the kth generation contains exactly 2k elements. The relevant property is that all numbers in generation k are obtained by summing two numbers from generations k-1 and/or k-2, but never from earlier generations. You may use this (and only this) observation to put a lower bound on the remaining elements in the sequence.

Challenge
Your challenge is to print the first x numbers in the intersection of the given input sequences.
Input: Two numbers separated by a space on STDIN. The first number is an integer from 1 to 15 inclusive where each bit corresponds to a sequence. The lowest bit corresponds to sequence 1, and the highest corresponds to sequence 4. The second is amount of numbers, x, to output on STDIN.
Output: The first x numbers that intersect with the given input sequences. Print the numbers on STDOUT with any clear whitespace or punctuation as a delimiter (spaces, tabs, newlines, commas, colons, periods, etc).

Examples
1. Print the first 3 numbers that are in every sequence.
Input: 15 3
Output: 10,23,40

2. Print the first 12 numbers in sequences number 1 and 4.
Input: 9 12
Output: 3,8,10,14,19,20,21,23,24,31,37,40

3. Print the first 10 numbers in sequence 2.
Input: 2 10
Output: 0,3,4,5,10,11,12,13,14,21

4. Print the first 6 numbers in sequences 3 and 4.
Input: 12 6
Output: 2,4,5,6,9,10

Details

You may print the output as you go or all at once at the end.

Huge thanks to everyone who helped out with this in chat! This question benefited greatly from being in the sandbox.

@chilemagic: Actually how do you define "first X numbers" in an intersection? If you take both sequences in the 12 5 example up to the same index, then 10 does indeed come before 9 in the intersection... like, how would you, while going through the sequences, decide whether to skip the 9 in #3 as a possible intersection? Like if #3 had 7 in it then you would be required to skip over it since that doesn't appear in #4

@Claudiu Your outputted numbers should always be increasing, and each number would only appear once in your output.

Is there a maximum limit to x?

@ypnypn don't hard code a limit, but if your algorithm is very slow or won't finish for very large inputs that's ok. This is code golf so you can be inefficient to save bytes.

Haskell, 495 442 402
import Data.List
d=1:1:1%2
f=filter
p 0="0"
p 1="1"
p n=p(div n 2)++p(mod n 2)
l=length
u z[a,b]=sort.head.dropWhile((<b).l)$m(nub.foldl1 intersect.y(tail.p$31-a).(`m`[d,f(v.group.sort.p)[1..],z#1,y(z>>=p)z]).take)z
w=(=='0')
v[a]=1>2
v x=all(all w.tail.p.l)x
y x=m snd.f(w.fst).zip x
x#n=n`take`x++drop(n+n+1)x#(n+2)
n%m=d!!(m-d!!n)+d!!(m-d!!(n-1)):m%(m+1)
main=interact$show.u[0..].m read.words
m=map

It performs reasonably well. Here are a couple of OP's examples:
Flonk@home:~>echo 15 10 | codegolf
[10,23,40,57,58,139,147,149,212,228]
Flonk@home:~>echo 9 12 | codegolf
[3,8,10,14,19,20,21,23,24,31,37,40]
Flonk@home:~>echo 2 10 | codegolf
[0,3,4,5,10,11,12,13,14,21]
Flonk@home:~>echo 12 6 | codegolf
[2,4,5,6,9,10]

Python 3, 590 639 characters
from itertools import count as C
D=lambda n,t='1':bin(n).count(t)
Y=range
def O():
 for n in C(0):yield from bin(n)[2:]
def B():
 s=i=0
 while 1:
  i+=s
  for j in Y(i,i+s+1):yield j
  s+=2;i+=s-1
def s(i):return D(i)==1
def F():
 a=[1]*3
 for n in C(3):a+=[a[n-a[n-1]]+a[n-a[n-2]]];yield a[-1]
L,R=input().split()
J=[x for x,U in zip([F(),(n for n in C(0)if s(D(n,'0')-1)and s(D(n))),B(),(i for i,c in enumerate(O())if'1'>c)],"{0:04b}".format(int(L)))if U>'0']
X=[set()for _ in J]
M=[]
Z=int(R);K=1
while len(M)<Z:
 for x,j in zip(X,J):x.add(next(j))
 for _ in Y(K):X[0].add(next(J[0]));K+=1
 M=X[0]
 for x in X:M=M&x
print(sorted(M)[:Z])

This is the straight-forward solution: use generators to define each of the infinite sequences, and so long as the intersection isn't large enough, add a step to each sequence.
To account for the non-monotonically-increasing Hofstadter sequence: at each step I generate twice as many for that sequence, e.g. 1, then 2, 4, 8, 16, 32, etc. I think that satisfies the bound stated in the question, and it's still fast enough for all the test cases presented there.

Golfs: from itertools import count as C -> from itertools import* C=count, def s(i):return D(i)==1 -> s=lambda i:D(i)==1 (I don't even think this function makes it shorter...), "{0:04b}".format(int(L)))if U>'0' -> "{0:04b}".format(int(L)))if'0'<U

C#, 1923
It probably wont be the shortest program but i found the challenge interesting, so here is my solution.
Running all 4 with 35 Numbers (15 35) takes about 5 seconds.
You can test it here, but note that if you want OEIS4 the amount of digits you want needs to be small or netfiddle runs out of memory.
Golfed
using System;using System.Collections;using System.Collections.Generic;using System.Linq;class p{public static void Main(string[] args){int b=0;IEnumerable<int>a=null;foreach(char c in Convert.ToString(int.Parse(args[0]),2).Reverse()){++b;if(c=='0')continue;switch(b){case 1: a=d(a,e());break;case 2: a=d(a,f());break;case 3: a=d(a,g());break;case 4: a=d(a,h(),true);break;}}if(a==null)return;bool j=true;foreach(int i in a.Take(int.Parse(args[1]))){if(j)j=false;else Console.Write(",");Console.Write(i);}}static IEnumerable<int>d(IEnumerable<int>k,IEnumerable<int>l,bool m=false){if(k==null)foreach(int n in l)yield return n;int o=0;int p=1;foreach(int i in k){Dictionary<int,HashSet<int>>q=m ? new Dictionary<int,HashSet<int>>(): null;int s=0;foreach(int n in l){if(!m){if(i<n)break;}else{if(!q.ContainsKey(o))q.Add(o,new HashSet<int>());q[o].Add(n);if(q.Count==1){int r=q[o].OrderBy(gi =>gi).Take(2).Sum();if(i<r)break;}else{int r=q[o].Concat(q[o-1]).OrderBy(gi =>gi).Take(2).Sum();if(i<r)break;}if(++s==p){o++;p=(int)Math.Pow(2,o);}}if(i==n){yield return i;break;}}}}static IEnumerable<int>e(){int t=0;for(int i=0;i<int.MaxValue;i++)foreach(char c in Convert.ToString(i,2)){if(c=='0')yield return t;t++;}}static IEnumerable<int>f(){int t=1;int u=0;bool v=true;using(IEnumerator<int>w=Enumerable.Range(0,int.MaxValue).GetEnumerator()){while(w.MoveNext()){if(v){if(u==0)u=t+1;yield return w.Current;if(--t==0)v=false;}else{if(t==0)t=u+1;if(--u==0)v=true;}}}}static IEnumerable<int>g(){for(int i=0;i<int.MaxValue;i++){string s=Convert.ToString(i,2);if(x(s.Count(c =>c=='0'))&& x(s.Count(c =>c=='1')))yield return i;}}static bool x(int y){return(y != 0)&&((y &(y-1))==0);}static IEnumerable<int>h(){return Enumerable.Range(1,int.MaxValue).Select(z);}static Dictionary<int,int>_=new Dictionary<int,int>();static int z(int n){int a;if(!_.TryGetValue(n,out a)){if(n<3)a=1;else a=z(n-z(n-1))+z(n-z(n-2));_.Add(n,a);}return a;}}

Readable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class Programm
{
    public static void Main(string[] args)
    {
        int index = 0;

        IEnumerable<int> intersection = null;

        foreach (char c in Convert.ToString(int.Parse(args[0]), 2).Reverse())
        {
            ++index;
            if (c == '0')
                continue;

            switch (index)
            {
                case 1: intersection = _join(intersection, OEIS1()); break;
                case 2: intersection = _join(intersection, OEIS2()); break;
                case 3: intersection = _join(intersection, OEIS3()); break;
                case 4: intersection = _join(intersection, OEIS4(), true); break;

                default: throw new ArgumentException();
            }
        }
        if (intersection == null)
            return;

        bool first = true;
        foreach (int i in intersection.Take(int.Parse(args[1])))
        {
            if (first) first = false;
            else Console.Write(",");

            Console.Write(i);
        }

        Console.ReadKey();
    }

    private static IEnumerable<int> _join(IEnumerable<int> intersection, IEnumerable<int> newSequence, bool hof = false)
    {
        if (intersection == null)
            foreach (int n in newSequence) yield return n;

        int generation = 0;
        int generationMax = 1;
        foreach (int i in intersection)
        {
            Dictionary<int, HashSet<int>> generationCache = hof ? new Dictionary<int, HashSet<int>>() : null;
            int count = 0;
            foreach (int n in newSequence)
            {
                if (!hof)
                {
                    if (i < n)
                        break;
                }
                else
                {
                    if (!generationCache.ContainsKey(generation))
                        generationCache.Add(generation, new HashSet<int>());

                    generationCache[generation].Add(n);

                    if (generationCache.Count == 1)
                    {
                        int lowerBound = generationCache[generation].OrderBy(gi => gi).Take(2).Sum();
                        if (i < lowerBound)
                            break;
                    }
                    else
                    {
                        int lowerBound = generationCache[generation].Concat(generationCache[generation - 1]).OrderBy(gi => gi).Take(2).Sum();
                        if (i < lowerBound)
                            break;
                    }

                    if (++count == generationMax)
                    {
                        generation++;
                        generationMax = (int)Math.Pow(2, generation);
                    }
                }

                if (i == n)
                {
                    yield return i;
                    break;
                }
            }
        }
    }

    static IEnumerable<int> OEIS1()
    {
        int position = 0;
        for (int i = 0; i < int.MaxValue; i++)
            foreach (char c in Convert.ToString(i, 2))
            {
                if (c == '0')
                    yield return position;
                position++;
            }
    }

    static IEnumerable<int> OEIS2()
    {
        int take = 1;
        int skip = 0;
        bool doTake = true;
        using (IEnumerator<int> enumerator = Enumerable.Range(0, int.MaxValue).GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                if (doTake)
                {
                    if (skip == 0)
                        skip = take + 1;
                    yield return enumerator.Current;
                    if (--take == 0)
                        doTake = false;
                }
                else
                {
                    if (take == 0)
                        take = skip + 1;
                    if (--skip == 0)
                        doTake = true;
                }
            }
        }
    }

    static IEnumerable<int> OEIS3()
    {
        for (int i = 0; i < int.MaxValue; i++)
        {
            string s = Convert.ToString(i, 2);
            if (_isPowerOfTwo(s.Count(c => c == '0')) && _isPowerOfTwo(s.Count(c => c == '1')))
                yield return i;
        }
    }

    static bool _isPowerOfTwo(int number)
    {
        return (number != 0) && ((number & (number - 1)) == 0);
    }

    static IEnumerable<int> OEIS4()
    {
        return Enumerable.Range(1, int.MaxValue).Select(HofstadterQ);
    }

    static Dictionary<int, int> _hofstadterQCache = new Dictionary<int, int>();

    static int HofstadterQ(int n)
    {
        int result;
        if (!_hofstadterQCache.TryGetValue(n, out result))
        {
            if (n < 3)
                result = 1;
            else
                result = HofstadterQ(n - HofstadterQ(n - 1)) + HofstadterQ(n - HofstadterQ(n - 2));

            _hofstadterQCache.Add(n, result);
        }
        return result;
    }
}

Explanation
This makes use of lazy evaluation bigtime which makes it prett fast i bellieve. Also i was lazy doing any "bitlogic" by using the frameworks Convert.ToString(number, 2) method. This turns any number into its binray representation as a string.
I had to write my own method to intersect the seuqences as the Linq-Method intersect computes the intersection of the full sequence, and that was literally impossible.

authors: ชิณท์ณภัทร ผลจันทร์


text:
Optimum Letter Cards for Spelling Words
Let's say you have a list of words and you want to be able to use letter cards to spell each word. For example, to spell cat, you would use three cards labelled C, A, T.
Assuming each card is double-sided, submit a program to define a minimum number of cards that can be used to spell the entire list of words.
Input is the word list, it can be file-based, hard-coded, command line, whatever. Output is the list of cards, formatted and ordered as you see fit, provided it is clear how the cards are labelled.
Case is not significant: Golf, golf and GOLF are equivalent.
Some hints:

the number of cards can be no less than the length of the longest word
it makes no sense for a card to have the same letter on both sides
while case is not significant, recommend lower case to take advantage of certain symmetries

Examples, these take advantage of certain symmetries:
Input: ben, bog, bug, den, do, doe, dog, due, dug, Ed, end, gob, God, Ned, ode, pen, Poe, pug
Output: b/d, e/g, o/n
Input: an, and, ape, are, be, bed, bud, bur, Dan, Deb, dub, ear, Ed, era, nap, pan, pea, pub, Rae, ran, rub
Output: a/b, d/r, e/n
Making it a popularity contest, so elegance of code, run-time performance, and cleverness (including rule-bending & loopholes) are important!
Addition: Some have asked about "allowed" symmetries, whether special fonts can be used, and whether the cards can be folded.
Allowed symmetries are any letters which look similar to each other after 0, 90, 180 or 270 degrees rotation. This includes b/q, d/p and n/u. I would also say M/W, Z/N, and of course I/l (capital i, lowercase L). I'm probably scratching the surface, so if there are any others you're unsure about, just ask.
To keep it simple, please restrict to a standard sans-serif font, say that used in SE.
As far as folding, while you can do some amazing substitutions, e.g. B can be D, E, F, I, P, or R, and maybe C or L if you fold really creatively, I think that's bending, literally, too much!
I came up with this problem while playing with some similar cards with my kids. I noted how easy it was to come up with single-sided cards vs. how difficult it was to come up with double-sided cards.
Addition: Have provided a bounty to be awarded to the most popular answer. If there's a tie, will award to the one who submitted first.
Another hint:

solving the single-sided problem will give you an idea of the minimum number of cards needed (e.g. 20 single-sided cards translates to at least 10 double sided-cards needed)

Addition: Oh bother, I was busy and forgot about the bounty expiring. It ended up going to no one because the only answer was submitted before the bounty started! Sorry about that.

Just to clarify, what is allowed? Are the only symmetry pairs n/u, d/p? What about b/q and m/w? And what if I fold a P card in two so the top half becomes D?

Is their a list of approved "symmetries", I would think that it could differ based on font, which is a potential loop hole(use a font where the characters are all the same, ie the cards would always be equal to / or something like that)

"Case is not significant" so "N" could be represented by "u"?

I think you're doing your question an injustice by making it a popularity contest. You don't get creativity by telling people to be creative, you get it by giving them a hard challenge and having them squeeze out everything they can.

@sp3000 - b/q of course. Regarding your other questions, I'll clarify the rules.

@Dave13s - 1 & 2. I will clarify the rules.

@xnor - I don't know, I'm not a fan of code golfing myself, but you're free to do it. If everyone has your opinion, then your answer will be the most popular!

Is it allowed to completly "remove" a letter because there is a symmetrie?

@CSharpie - Yes, for example all "u"s can be converted to "n"s.

Having this as a popularity contest (not to mention the bounty too) is not quite right. What gaurantee is there that the answers are optimal ? What if one answer gives suboptimal result, but for some reasons, has the highest votes..

I’m voting to close this question because explicitly encouraging "rule-bending & loopholes" makes the challenge either unclear or lacking an "objective validity criterion" as required by the [tag:popularity-contest] tag wiki.

C# - CardChooser
Summary
This application uses a brute force method to attempt to solve each list. First I create a list of potential cards to select from, then I determine which is a best fit(removes the most chars + shortens long words most), add this to a result list and continue with this process until I have selected enough potential cards to remove every word in the list, then I  rematch those cards to each word and print the output.
If you would like to see a more limited version of this code without downloading and building the provided windows forms application you can use the link provided to run my program on smaller sets of data, please note that this is the console application version so the resulting cards are NOT rotated:
http://ideone.com/fork/VD1gJF
Revision History
Current - Added better result optimization suggested by @Zgarb
Update 3 - More code cleanup, more bugs fixed, better results
Update 2 - Windows Forms, More verbose output
Update 1 - New/Better support for character symmetries
Original - Console Application
Examples
acr, aft, ain, sll, win, say, said, fast, epic

hes, will, with, wont, would, wouldve, wouldnt, yet, you, youd, youll

aaaa, bbbb, cccc
Code
I still need to combine this into one larger project with the ConsoleApp and WindowsForms code all sharing the same classes and methods, then split out the different regions in the RunButton_Click method so I can write units around them, anyway whenever I find time to do that I will, for now this is what I have:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CardChooserForms
{
    public partial class CardChooser : Form
    {
        private class Solution : IEquatable<Solution>
        {
            public List<string> Cards { get; set; }
            public List<string> Remaining { get; set; }

            public int RemainingScore
            {
                get
                {
                    return this.Remaining.Sum(b => b.ToCharArray().Count());
                }
            }

            public bool Equals(Solution other)
            {
                return new string(Cards.OrderBy(a => a).SelectMany(a => a).ToArray()) == new string(other.Cards.OrderBy(a => a).SelectMany(a => a).ToArray());
            }

            public override int GetHashCode()
            {
                return (new string(Cards.OrderBy(a => a).SelectMany(a => a).ToArray())).GetHashCode();
            }
        }
        private class Symmetry
        {
            public char Value { get; set; }
            public Int16 RotationDifference { get; set; }
        }

        /// <summary>
        /// This is where Symmetries are stored, right now it only has support for pairs(two values per array)
        /// </summary>
        private static Symmetry[][] _rotatableCharacters = new Symmetry[][] {
                new Symmetry[] { new Symmetry {Value = 'Z'}, new Symmetry {Value = 'N', RotationDifference = 90}},
                new Symmetry[] { new Symmetry {Value = 'd'}, new Symmetry {Value = 'p', RotationDifference = 180 }},
                new Symmetry[] { new Symmetry {Value = 'u'}, new Symmetry {Value = 'n', RotationDifference = 180 }},
                new Symmetry[] { new Symmetry {Value = 'm'}, new Symmetry {Value = 'w', RotationDifference = 180 }},
                new Symmetry[] { new Symmetry {Value = 'b'}, new Symmetry {Value = 'q', RotationDifference = 180 }},
                new Symmetry[] { new Symmetry {Value = 'l'}, new Symmetry {Value = 'I', RotationDifference = 0}},
            };

        //These all control the output settings
        private readonly static int _defualtSpacing = 25;
        private readonly static int _defualtFontSize = 8;
        private readonly static Font _defualtFont = new Font("Microsoft Sans Serif", _defualtFontSize);
        private readonly static Brush _defualtBackgroundColor = Brushes.Beige;
        private readonly static Brush _defualtForegroundColor = Brushes.Black;

        public CardChooser()
        {
            InitializeComponent();
        }

        private void RunButton_Click(object sender, EventArgs e)
        {
            #region Input Parsing
            //Get input
            string input = InputRichTextBox.Text;

            if (!input.Contains(","))
                throw new ArgumentException("Input must contain more than one value and must be seprated by commas.");

            //Parse input
            var inputLowercasedTrimedTransformed = input.Split(',').Select(a => a.ToLowerInvariant().Trim()).ToArray();
            var inputSplitTrimIndex = input.Split(',').Select(a => a.Trim()).ToArray().Select((a, index) => new { value = a, index }).ToArray();
            #endregion Input Parsing

            #region Card Formation
            var inputCharParsed = inputLowercasedTrimedTransformed.Select(a => a.ToCharArray()).ToArray();
            var possibleCards = GetAllCasesTwoLengthArrayElements(
                UniqueBiDirection(
                //Get unique characters
                    inputCharParsed
                    .SelectMany(a => a)
                    .Distinct()
                    .Select(a => new
                    {
                        Character = a,
                        PossibleCharacters = inputCharParsed.SelectMany(b => b).Where(b => b != a).ToList()
                    })
                //Now get distinct cards(ie NB == BN, NB != NE)
                    .SelectMany(a => a.PossibleCharacters.Select(b => new string(new char[] { a.Character, b })).ToArray()).ToArray()
                    ).ToArray()
                ).ToArray();

            //Now get every possible character each card can eliminate
            var possibleCharsFromCards = GetAllPossibleCharsFromACards(possibleCards).ToArray();

            //Now set up some possibilities that contain only one card
            var possibleCardCombinations = possibleCards.Select((a, index) => new Solution
            {
                Cards = new List<string> { a },
                //Use the index of each card to reference the possible characters it can remove, then remove them per card to form a initial list of cards
                Remaining = inputLowercasedTrimedTransformed.Select(b => b.RemoveFirstInCharArr(possibleCharsFromCards[index].ToLowerInvariant().ToCharArray())).ToList()
            })
            //Take the best scoring card, discard the rest
            .OrderBy(a => a.RemainingScore)
            .ThenBy(a => a.Remaining.Max(b => b.Length))
            .Take(1).ToList();
            #endregion Card Formation

            #region Card Selection
            //Find best combination by iteratively trying every combination + 1 more card, and choose the lowest scoring one
            while (!possibleCardCombinations.Any(a => a.Remaining.Sum(b => b.ToCharArray().Count()) == 0) && possibleCardCombinations.First().Cards.Count() < possibleCards.Count())
            {
                //Clear the list each iteration(as you can assume the last generations didn't work
                var newPossibilites = new List<Solution>();
                var currentRoundCardCombinations = possibleCardCombinations.ToArray();
                possibleCardCombinations.Clear();

                foreach (var trySolution in currentRoundCardCombinations)
                    foreach (var card in possibleCards.Select((a, index) => new { value = a, index }).Where(a => !trySolution.Cards.Contains(a.value)).ToArray())
                    {
                        var newSolution = new Solution();
                        newSolution.Cards = trySolution.Cards.ToList();
                        newSolution.Cards.Add(card.value);
                        newSolution.Remaining = trySolution.Remaining.ToList().Select(a => a.RemoveFirstInCharArr(possibleCharsFromCards[card.index].ToLowerInvariant().ToCharArray())).ToList();
                        newPossibilites.Add(newSolution);
                    }

                //Choose the highest scoring card
                possibleCardCombinations = newPossibilites
                    .OrderBy(a => a.RemainingScore)
                    .ThenBy(a => a.Remaining.Max(b => b.Length))
                    .Distinct().Take(1).ToList();
            }
            var finalCardSet = possibleCardCombinations.First().Cards.ToArray();
            #endregion Card Selection

            #region Output
            using (var image = new Bitmap(500, inputSplitTrimIndex.Count() * _defualtSpacing + finalCardSet.Count() * (_defualtFontSize / 2) + _defualtSpacing))
            using (Graphics graphic = Graphics.FromImage(image))
            {
                //Background
                graphic.FillRectangle(_defualtBackgroundColor, 0, 0, image.Width, image.Height);

                //Header
                graphic.DrawString("Total Number of Cards Required: " + finalCardSet.Count(), _defualtFont, _defualtForegroundColor, new PointF(0, 0));
                graphic.DrawString(
                    "Cards: " + String.Join(", ", finalCardSet.Select(a => a[0] + "/" + a[1])),
                    _defualtFont,
                    _defualtForegroundColor,
                    new RectangleF(0, _defualtSpacing, image.Width - _defualtSpacing, finalCardSet.Count() * 5));

                //Results
                foreach (var element in inputSplitTrimIndex)
                {
                    //Paint the word
                    graphic.DrawString(element.value + " -> ", _defualtFont, _defualtForegroundColor, new PointF(0, element.index * _defualtSpacing + finalCardSet.Count() * (_defualtFontSize / 2) + _defualtSpacing));

                    //Now go through each character, determining the matching card, and wether that card has to be flipped
                    foreach (var card in GetOrderedCardsRequired(inputLowercasedTrimedTransformed[element.index].ToLowerInvariant(), finalCardSet.ToArray()).ToArray().Select((a, index) => new { value = a, index }))
                        using (var tempGraphic = Graphics.FromImage(image))
                        {
                            //For cards that need to flip
                            if (Char.ToUpperInvariant(element.value[card.index]) != Char.ToUpperInvariant(card.value[0]) &&
                                Char.ToUpperInvariant(element.value[card.index]) != Char.ToUpperInvariant(card.value[1]))
                            {
                                //TODO this is hacky and needs to be rethought
                                var rotateAmount = _rotatableCharacters
                                    .OrderByDescending(a => a.Any(b => b.Value == Char.ToLowerInvariant(element.value[card.index])))
                                    .First(a => a.Any(b => Char.ToUpperInvariant(b.Value) == Char.ToUpperInvariant(element.value[card.index])))
                                    [1].RotationDifference;

                                //Rotate
                                tempGraphic.TranslateTransform(
                                    _defualtSpacing * (_defualtFontSize / 2) + card.index * _defualtSpacing + (rotateAmount == 90 ? 0 : _defualtSpacing / 2) + (rotateAmount == 180 ? -(_defualtSpacing / 4) : 0),
                                    finalCardSet.Count() * (_defualtFontSize / 2) + _defualtSpacing + element.index * _defualtSpacing + (rotateAmount == 180 ? 0 : _defualtSpacing / 2));
                                tempGraphic.RotateTransform(rotateAmount);

                                //Print string
                                tempGraphic.DrawString(
                                String.Join("/", card.value.ToCharArray().Select(a => new string(new char[] { a })).ToArray()),
                                _defualtFont,
                                Brushes.Black,
                                new RectangleF(-(_defualtSpacing / 2), -(_defualtSpacing / 2), _defualtSpacing, _defualtSpacing));
                            }
                            else
                                tempGraphic.DrawString(
                                     String.Join("/", card.value.ToCharArray().Select(a => new string(new char[] { a })).ToArray()),
                                     _defualtFont,
                                     _defualtForegroundColor,
                                     new RectangleF(
                                         _defualtSpacing * (_defualtFontSize / 2) + card.index * _defualtSpacing,
                                         finalCardSet.Count() * (_defualtFontSize / 2) + _defualtSpacing + element.index * _defualtSpacing,
                                         _defualtSpacing, _defualtSpacing));
                        }
                }

                OutputPictureBox.Image = new Bitmap(image);
            }
            #endregion Output
        }

        private IEnumerable<string> GetAllPossibleCharsFromACards(string[] cards)
        {
            return cards.Select(a =>
                new string(a.ToCharArray().Concat(_rotatableCharacters
                                    .Where(b => b.Select(c => c.Value).Intersect(a.ToCharArray()).Count() > 0)
                                    .SelectMany(b => b.Select(c => c.Value))
                                    .Distinct().ToArray()).Distinct().ToArray()));
        }

        private IEnumerable<string> GetOrderedCardsRequired(string word, string[] cards)
        {
            var solution = new List<string>();
            var tempCards = GetAllPossibleCharsFromACards(cards).Select((a, index) => new { value = a, index }).ToList();

            foreach (var letter in word.ToCharArray())
            {
                //TODO this still could theoretically fail I think
                var card = tempCards
                    //Order by the least number of characters match
                    .OrderBy(a => word.ToLowerInvariant().Intersect(a.value.ToLowerInvariant()).Count())
                    .ThenByDescending(a => tempCards.Sum(b => b.value.ToLowerInvariant().Intersect(a.value.ToLowerInvariant()).Count()))
                    //Then take the least useful card for the other parts of the word
                    .First(a => a.value.ToLowerInvariant().Contains(Char.ToLowerInvariant(letter)));
                solution.Add(cards[card.index]);
                tempCards.Remove(card);
            }
            return solution;
        }

        private static IEnumerable<string> UniqueBiDirection(string[] input)
        {
            var results = new List<string>();
            foreach (var element in input)
                if (!results.Any(a => a == new string(element.ToCharArray().Reverse().ToArray()) || a == element))
                    results.Add(element);
            return results;
        }

        private static IEnumerable<string> GetAllCasesTwoLengthArrayElements(string[] input)
        {
            if (input.Any(a => a.Length != 2))
                throw new ArgumentException("This method is only for arrays with two characters");

            List<string> output = input.ToList();
            foreach (var element in input)
            {
                output.Add(new string(new char[] { Char.ToUpperInvariant(element[0]), Char.ToUpperInvariant(element[1]) }));
                output.Add(new string(new char[] { element[0], Char.ToUpperInvariant(element[1]) }));
                output.Add(new string(new char[] { Char.ToUpperInvariant(element[0]), element[1] }));
            }
            return output;
        }

        private void SaveButton_Click(object sender, EventArgs e)
        {
            using (var image = new Bitmap(OutputPictureBox.Image))
                image.Save(Directory.GetCurrentDirectory() + "Output.png", ImageFormat.Png);
        }
    }

    public static class StringExtensions
    {
        public static string RemoveFirstInCharArr(this string source, char[] values)
        {
            var tempSource = source.ToUpperInvariant();
            foreach (var value in values)
            {
                int index = tempSource.IndexOf(Char.ToUpperInvariant(value));
                if (index >= 0) return source.Remove(index, 1);
            }
            return source;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CardChooserForms
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new CardChooser());
        }
    }
}

namespace CardChooserForms
{
    partial class CardChooser
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.InputRichTextBox = new System.Windows.Forms.RichTextBox();
            this.EnterInputLabel = new System.Windows.Forms.Label();
            this.RunButton = new System.Windows.Forms.Button();
            this.OutputPictureBox = new System.Windows.Forms.PictureBox();
            this.OutputPanel = new System.Windows.Forms.Panel();
            this.SaveButton = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.OutputPictureBox)).BeginInit();
            this.OutputPanel.SuspendLayout();
            this.SuspendLayout();
            //
            // InputRichTextBox
            //
            this.InputRichTextBox.Location = new System.Drawing.Point(60, 40);
            this.InputRichTextBox.Name = "InputRichTextBox";
            this.InputRichTextBox.Size = new System.Drawing.Size(400, 100);
            this.InputRichTextBox.TabIndex = 0;
            this.InputRichTextBox.Text = "";
            //
            // EnterInputLabel
            //
            this.EnterInputLabel.AutoSize = true;
            this.EnterInputLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.EnterInputLabel.Location = new System.Drawing.Point(57, 20);
            this.EnterInputLabel.Name = "EnterInputLabel";
            this.EnterInputLabel.Size = new System.Drawing.Size(81, 17);
            this.EnterInputLabel.TabIndex = 1;
            this.EnterInputLabel.Text = "Enter Input:";
            //
            // RunButton
            //
            this.RunButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.RunButton.Location = new System.Drawing.Point(60, 147);
            this.RunButton.Name = "RunButton";
            this.RunButton.Size = new System.Drawing.Size(180, 52);
            this.RunButton.TabIndex = 2;
            this.RunButton.Text = "Run";
            this.RunButton.UseVisualStyleBackColor = true;
            this.RunButton.Click += new System.EventHandler(this.RunButton_Click);
            //
            // OutputPictureBox
            //
            this.OutputPictureBox.Location = new System.Drawing.Point(3, 3);
            this.OutputPictureBox.Name = "OutputPictureBox";
            this.OutputPictureBox.Size = new System.Drawing.Size(500, 500);
            this.OutputPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.OutputPictureBox.TabIndex = 3;
            this.OutputPictureBox.TabStop = false;
            //
            // OutputPanel
            //
            this.OutputPanel.AutoScroll = true;
            this.OutputPanel.Controls.Add(this.OutputPictureBox);
            this.OutputPanel.Location = new System.Drawing.Point(4, 205);
            this.OutputPanel.Name = "OutputPanel";
            this.OutputPanel.Size = new System.Drawing.Size(520, 520);
            this.OutputPanel.TabIndex = 4;
            //
            // SaveButton
            //
            this.SaveButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.SaveButton.Location = new System.Drawing.Point(280, 147);
            this.SaveButton.Name = "SaveButton";
            this.SaveButton.Size = new System.Drawing.Size(180, 52);
            this.SaveButton.TabIndex = 5;
            this.SaveButton.Text = "Save";
            this.SaveButton.UseVisualStyleBackColor = true;
            this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
            //
            // CardChooser
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(534, 737);
            this.Controls.Add(this.SaveButton);
            this.Controls.Add(this.RunButton);
            this.Controls.Add(this.EnterInputLabel);
            this.Controls.Add(this.InputRichTextBox);
            this.Controls.Add(this.OutputPanel);
            this.Name = "CardChooser";
            this.Text = "Card Chooser";
            ((System.ComponentModel.ISupportInitialize)(this.OutputPictureBox)).EndInit();
            this.OutputPanel.ResumeLayout(false);
            this.OutputPanel.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.RichTextBox InputRichTextBox;
        private System.Windows.Forms.Label EnterInputLabel;
        private System.Windows.Forms.Button RunButton;
        private System.Windows.Forms.PictureBox OutputPictureBox;
        private System.Windows.Forms.Panel OutputPanel;
        private System.Windows.Forms.Button SaveButton;
    }
}

How do you spell "might" without an i card?

"of course I/l (capital i, lowercase L)", so the lowercase l should stand for the capital I.

oh it seems you should specify that in the output

@Claudiu yeah I thought about that for awhile, this really comes down to the second question I asked Yimin Rong and I think he clarified it correctly, if I output a "l" in a card it should be inferred just like the examples that it can be used for both a upper cased I and lower l, that would results in a output that doesn't match the case perfectly but I think that's "OK" as it still satisfies the conditions of the question, but again I'm open to clarifying if necessary, maybe in a later version I can output the resulting generated strings with the characters rotated or something like that...

i think there's a mistake. said's last letter isn't W or p

@proud haskeller good catch, it actually can be p if you rotate it 180 degrees but apparently my display algorithm isn't working 100%, It's now on my list though.

For the input aaaa, bbbb, cccc, your program gives 7 cards, but the minimum is 6: a/b, a/b, a/c, a/c, b/c, b/c can express all three words.

@Zgard good overservation, that occurred because of the card selection logic, for instance initially picking cards: A/B, A/B, A/B, A/B would score just as high as some other more optimal selections. I've fixed that, but in terms of future cases I'm not certain my program will always arrive at perfectly optimal results in 100% of cases. A better way to do that would be to compare every combination of cards and for anything but small lists this becomes too slow to ever complete. So I think selection logic will always play a factor and that it will determine the results of any programs output.


text:
Golf Practice: Python
This is a challenge of practicing golf optimization in Python -- reusable tricks and shortcuts to shave off a few characters. Many will be familiar to Python golfers and use common ideas from the Python Tips. Some of these use Python-specific features that you might not know exist unless you've seen them, so do take a look at the tips if you're stuck.
Goal:
 There are ten problems, each a reference snippet of Python code for you to optimize and a description of the code does. Your goal is rewrite it to be shorter but still functionally-equivalent.
Your score, which you're trying to minimize, is the total length of your code all the snippets. The length of the reference snippets is 150. Tiebreaker is earliest post.
Posting answers: For each problem, post your code and its character count. You can post the reference snippet if you didn't find something shorter. It's intended that you don't look at others' answers when you post yours. Please spoiler-tag each individual problem including the individual character counts. You can leave the total count revealed. Feel free now to unspoiler your solution or post new unspoilered solutions.
Details on legality: Functional equivalence means the code can be replaced in a program without affecting its behavior (ignoring things like memory usage and operator precedence as part of an expression). Expressions should produce values that are equivalent by ==. Note that 1.0==1==True. Your code should have no side-effects unless otherwise stated. I don't intend the problems to be version-specific, but just in case, you can specify a Python version for each problem.
Problem 1: Keep iterating as long as the list L has at least 7 elements
# 16 chars
while len(L)>=7:

Problem 2: Check whether two floats x and y are both positive.
# 11 chars
x>0 and y>0

Problem 3: If Boolean b is true, remove the first element of L. Otherwise, leave it unchanged.
# 12 chars
if b:L=L[1:]

Problem 4: Check if all elements of a non-empty list L of numbers are equal. For this problem, it's OK to modify the list.
# 22 chars
all(x==L[0]for x in L)

Problem 5: Append a number n to the end of a list L only if L already contains that number.
# 16 chars
if n in L:L+=[n]

Problem 6: Express the sign of a float x: +1 for positive, 0 for 0, -1 for negative.
# 20 chars
abs(x)/x if x else 0

Problem 7 Continue a loop as long as the first element of L, a list of Booleans, is True. Also stop if L is empty.
# 17 chars
while L and L[0]:

Problem 8: Continue a loop as long as n is greater than 1. The number n is guaranteed to be a positive integer.
# 10 chars
while n>1:

Problem 9: Check if an integer represented as a string s is negative (i.e, starts with '-').
# 9 chars
s[0]=='-'

Problem 10: Convert a Boolean b to "Win"/"Lose", with True->"Win" and False->"Lose".
# 17 chars
["Lose","Win"][b]

Warning: Spoilers below, don't scroll down if you want to solve these yourself.
If you just want to know the optimal score for a problem:
Problem 1:

12

Problem 2:

5

Problem 3:

7

Problem 4:

13

Problem 5:

13

Problem 6:

8

Problem 7:

12

Problem 8:

9

Problem 9:

5

Problem 10:

15

I voted to close, since this challenge provokes duplicate answers and effectively is many questions in one, since there is no interaction between the individual challenges whatsoever. I think that if we have such questions, there should only be one answer, which is a community wiki.

@Wrzlprmft: Somehow it's an interesting challenge. But after having 7 great contributions, now, I'd suggest relaxing the rules and allowing unspoilered solutions to single problems, because otherwise perfect submissions might remain hidden behind overall mediocre total scores.

@Falko I agree, feel free now to post unspoilered individual solutions and unspoiler existing solutions.

I think this is a cool idea and that we should have golf practices for more languages.

@Wrzlprmft there is now a discussion regarding this on meta.  Please voice your opinion there, for easier discussion without polluting this question's comments.

If you learned about a new trick or found an idea useful, please add it to Python tips if it's not there already! That way, everyone can learn from it.

I'm voting to close this question as off-topic because multi-part challenges with no interaction between the parts are disallowed. http://meta.codegolf.stackexchange.com/a/8464/45941

Total: 104 101 99 chars
Problem 1

 12 chars
while L[6:]:

Problem 2

 5 chars
x>0<y

Problem 3

 7 chars
L=L[b:]

Problem 4

 13 chars
len(set(L))<2
L[1:]==L[:-1]

Problem 5

 13 chars
L+=set(L)&{n}

Problem 6

 11 chars
(x>0)-(x<0)

 8 chars (Python 2)
cmp(x,0)

Problem 7

 12 chars
while[.5]<L:

Problem 8

 9 chars
while~-n:

Problem 9

 5 chars
s<'.'

Problem 10

 15 chars
'LWoisne'[b::2]

@FryAmTheEggman Can you explain the side effect? I intended that to be a valid solution.

@xnor Nevermind, I was entirely wrong. I learned something today :)

I believe these solutions to be optimal, given the multiple 99 solutions and the fact that I can't find anything better. I'd be happy to see an improvement though. Since this was the first 99, I'm accepting it.

Total size: 128 122 120 117 116 115 111 107 104
Problem 1
Keep iterating as long as the list L has at least 7 elements.

 15 chars
while len(L)>6:
 (Yes, I could save 3 bytes on this, but I accidentally saw the solution Sp3000's answer, so I won't claim those three bytes.)

Problem 2
Check whether two floats x and y are both positive.

 5 chars
x>0<y

Problem 3
If Boolean b is true, remove the first element of L. Otherwise, leave it unchanged.

 7 chars
L=L[b:]

Problem 4
Check if all elements of a non-empty list L of numbers are equal. For this problem, it's OK to modify the list.

 13 chars
L[1:]==L[:-1]

Problem 5
Append a number n to the end of a list L only if L already contains that number.

 15 chars
L+=[n]*(n in L)
 or
L+=[n][:n in L]

Problem 6
Express the sign of a float x: +1 for positive, 0 for 0, -1 for negative.

 8 chars, Python 2
cmp(x,0)
 According to docs this might return any positive/negative value, but consensus is it always returns -1, 0, 1.

Problem 7
Continue a loop as long as the first element of L, a list of Booleans, is True. Also stop if L is empty.

 12 chars
while[1]<=L:

Problem 8
Continue a loop as long as n is greater than 1. The number n is guaranteed to be a positive integer.

 9 chars
while~-n:

Problem 9
Check if an integer represented as a string s is negative (i.e, starts with '-').

 5 chars
s<'.'

Problem 10
Convert a Boolean b to "Win"/"Lose", with True->"Win" and False->"Lose".

 15 chars
"LWoisne"[b::2]

Could you please spoiler the individual lengths too?

@xnor No problem, done.

Total: 106 104 102 chars
Problem 1

 12 chars
while L[6:]:

Problem 2

 5 chars
x>0<y
 Huzzah for comparison chaining

Problem 3

 7 chars
L=L[b:]
 Good old implicit conversion

Problem 4

 13
len(set(L))<2
 Alternatively:
L[1:]==L[:-1]
 Stupid way to get the negation of what we want in Python 2:
","in`set(L)`
 I'm not sure what the relevance of "it's OK to modify the list" is though, because the best I can think of is 14 chars (and is actually wrong):
L==[L.pop()]+L

Problem 5

 13 chars
L+={n}&set(L)
 Doing funky things with sets

Problem 6

 11 chars
(x>0)-(x<0)

Problem 7

 12 chars
while[1]<=L:
 Uses lexicographical order of lists

Problem 8

 9 chars
while~-n:

Problem 9

 5 chars
s<"."
 Uses lexicographical ordering of strings

Problem 10

 15 chars
"LWoisne"[b::2]
 Alternatively:
b*"Win"or"Lose"

I had not considered your alternative to #10 before. It means that one can get the same character savings as the usual interleaving trick regardless of the length of the strings, barring precedence issues in the bool. I'll add this to the tips.

@xnor Ahaha yeah, I thought it was pretty nice. It's not as good when you have more strings though, which is downside (e.g. b is 0, 1 or 2, and all you can do is (b-1)*"Hello"or b*"Goodbye"or"Good Afternoon")

Tip: http://codegolf.stackexchange.com/a/407/20260

That's actually not bad for three strings. You can remove the parens with ~b*"Hello".

@xnor At that point, ["Good Afternoon","Goodbye","Hello"][b] would win :P

Total: 99 bytes
Problem 1

 12 bytes
while L[6:]:

Problem 2

 5 bytes
x>0<y

Problem 3

 7 bytes
L=L[b:]

Problem 4

 13 bytes
len(set(L))<2

14 byte alternatives
min(L)==max(L)
set(L)=={L[0]}

Problem 5

 13 bytes
L+=set(L)&{n}

Problem 6

 8 bytes
cmp(x,0)

Problem 7

 12 bytes
while[1]<=L:

Problem 8

 9 bytes
while~-n:

Problem 9

 5 bytes
s<'.'

Problem 10

 15 bytes
b*"Win"or"Lose"
 - or -
"LWoisne"[b::2]

  1: 12
while L[6:]:
  2: 5
y>0<x
  3: 7
L=L[b:]
  4: 15
L==L[:1]*len(L)
  5: 15
L+=[n]*(n in L) or L+=[n][:n in L]
  6: 11
  This is the only one for which an idiomatic expression did not immediately leap to my mind, but I think I found the right answer. Edit: Nope, it was horrible.
(x>0)-(x<0)
  7: 12
while[1]<=L:
  Or if the program is completed after that, while L[0] is nice.
  8: 9
while~-n:
  9: 5
  Many strings would work here but the "naive method" is funny.
s<'0'
  10: 15
'LWoisne'[b::2]

Total: 106

Wouldn't your #4 have to use [L[0]]?

@FireFly Whoops. It's not as bad as that, but does cost one byte.

Your #9 is a wonderful golfing pun!

Total size: 123 121 120 116
#1

 (12) while L[6:]:

#2

 (10) min(x,y)>0

#3

 (7) L=L[b:]

#4

 (13) len(set(L))<2 or L[1:]==L[:-1]

#5

 (15) L+=[n]*(n in L)

#6

 (14) x and abs(x)/x or (inspired by Claudiu's solution after giving up) x and(x>0)*2-1

#7

 (15) while[0]<L[:1]:

#8

 (9) while~-n:

#9

 (5) s<'.'

#10

 (15) b*"Win"or"Lose"

Total: 121
First attempts:
Problem 1

 15 chars
while len(L)>6:

Problem 2

 5 chars
x>0<y

Problem 3

 7 chars
L=L[b:]

Problem 4

 13 chars
len(set(L))<2

Problem 5

 16 chars
if n in L:L+=[n]

Problem 6

 16 chars
x and(1,-1)[x<0]

Problem 7

 16 chars
while(L+[0])[0]:

Problem 8

 10 chars
while n>1:

Problem 9

 8 chars
s[0]<'0'

Problem 10

 15 chars
"LWoisne"[b::2]


text:
Throwing uncatchable ExecutionEngineException
The shortest C# code that generates an uncatchable ExecutionEngineException wins. You are not allowed to call FailFast directly or indirectly.

Welcome to programming puzzles and codegolf. There's a couple of reasons why you challenge may be unpopular: 1.If you search, you'll see we've had similar challenges before; 2. Language-specific challenges are frowned upon as they limit participation. I suggest you stick around, answer a few challenges and feel free to post the next one at    http://meta.codegolf.stackexchange.com/questions/2140/sandbox-for-proposed-challenges?answertab=active

C# - 73
ThreadPool.QueueUserWorkItem(_=>{throw new ExecutionEngineException();});

Generates an ExecutionEngineException inside of a thread, so it can't be caught.
User CSharpie helped me shorten delegate to _=>.

You should be able to replace delegate with a lambda _=> to make it even shorter.

@CSharpie First time golfing in C#. Thanks for the tip!

authors: Ян Альбертович Дененберг


text:
Reverse the Polarity
The aim of this challenge is to write a program that satisfies the following conditions:

The program is not palindromic, or essentially palindromic (meaning that it is possible to remove characters to make it a palindrome without changing the effects of the program).
The program is not an involution (meaning that it does not produce its original input when run on its output)
The reversed-polarity program is the inverse of the normal program; so when the reversed program is run on the output of the normal program, it returns the original input.

What does reversed-polarity mean? Well, it differs between languages.

For most non-esolangs, this means reversing the order of sub-operations in a single operation, reversing the order of arguments, and reversing the contents of hard-coded lists/arrays/tuples/dictionaries/stacks/queues/etc, as well as reversing the order of code-blocks and stand-alone lines (but not lines within blocks)

Examples:
Haskell:
x`mod`y -> y`mod`x;zipWith ((*3).(+)) [1,2,3] [4,5,6] -> zipWith ((+).(*3)) [6,5,4] [3,2,1]
Python: 2**3 -> 3**2; for x,y in [(1,2),(3,4),(5,6)] -> for y,x in [(6,5),(4,3),(2,1)]

For languages that have 1-character functions (like Pyth, APL), simply reverse the string of instructions
For 1-dimensional esolangs like BF, reverse the instructions or swap the polarity; polarity swaps are [] -> {}, + -> -, - -> +, > -> <, < -> >, . -> , and , -> . (but not both)
For 2-dimensional esolangs like Befunge, you may either perform a reflection across the x- or y- axes or a diagonal, rotate 180 degrees, or do a combination of a reflection and a rotation

Commutative operations are allowed, but palindromic ones are not: 2*x is fine, but x+x is bad. The definition of a polarity-reversal is pretty loose, but use your judgment as to what makes sense; the object isn't to find the most clever loophole, but to find the most clever solution.
This is a popularity contest, so a very clever loophole may be popular, but try to keep within the spirit of this challenge. The winner will be announced once there are at least 10 solutions with at least 1 upvote, and there is at least one solution with more upvotes than there are submissions with at least 1 upvote; or in 1 month, whichever comes first. This is my first challenge, so try to be fair and give me constructive feedback, but also let me know if this is an unreasonable challenge or it is in any way miscategorized or ambiguous. If you have questions about a language that don't fit into any of the pigeonholes I have set out here, comment, and I will bend to the will of the community if there is a strong outcry for a particular clarification or rule-change.
UPDATE
It has been exactly 1 month since this contest was started (I just happened to check on it by chance, not knowing that I was actually on time). As this is a popularity contest, the winner (by a landslide) is
Pietu1998-Befunge. Even though the bottom components (the text reverser and the backwards-alphabet) are both involutions, the encoder/decoder are not, so there is no problem there. Bonus points (in my mind) for managing to write "BEFUNGE" down the middle. I personally liked the novelty of Zgarb's Theseus solution, because the language looks cool (if restricted). Thanks to everyone for participating, and while the winner has been chosen, I am leaving this contest completely open, and welcome future submissions.

What do you mean by the reversed-polarity program is the inverse of the normal program? Does output differ in some way?

It performs the inverse operation; when the reversed program is run on the output of the normal program, it returns the original input.

Sorry for the error; I hadn't heard of it before, and it seemed a bit grotesque to me, so I must have assumed it was an Esolang; I will change that.

(No, APL is just old.) Seriously, though, if you want constructive feedback, the place to post a challenge is the sandbox. ;)

Feedback really isn't the right word; I really mean issues about the way the challenge is designed (it is inconsistent or unfair to certain languages), scored (it should have a different scoring mechanism), or explained (something is ambiguous or contradictory).

Just something that should probably be specified - is () palindromic? Technically, the reverse is )(.

Parentheses do not count as palindrome; having the same operation on either side of another operation, or the same value on either side of an operation, both do.

@archaephyrryx in your example you do flip parentheses and brackets though.

In the Haskell example why is the function argument not shuffled to the end? Are the reverses chosen in such a way that preserves type safety? Are we allowed to choose some details of the polarity reversal operation?

[] -> {}? Did you mean [] -> ][? Because { and } don't do anything in BF.

I made an editor to help do this with 2D languages. Feel free to try.

Am I the only one constantly reading the tag as "polarity contest" ?

hm... http://tvtropes.org/pmwiki/pmwiki.php/Main/ReversePolarity

@JanDvorak In the Haskell example, I am treating zipWith f as a single function, as it is just vectorization; composition is not a single function, as it is taking multiple functions and running them one after the other. Generally, use your judgement, and as long as you aren't intentionally creating cases that exploit the ambiguity of the rules, it is acceptable.

@tobias here goes another day or few...

@JanDvorak you're welcome :P

What if the function in question is its own inverse?

Befunge
Whoa, that was a job, even with the editor I made for this challenge. Here's what I got, a nice 11x12 block:
v$,g6<6g,$v
v,$ _^_ $,v
1W>v\B\v>L1
~T+:1E1:-O~
+F00-F-02L+
>:|6gUg6|:>
{a@>^N^>@z`
>1+|@G$| +>
:^9< E<  ^1
~>7^@_,#:>:
 xD>65 ^=P~
v,-\+**<  v

It does a couple of things, sadly only for lowercase letters.
What it does
When run normally, it performs a Caesar cipher on the input.
abcxyz      -> bcdyza
exampletext -> fybnqmfufyu

When flipped horizontally, it reverses said cipher. This is the requirement for the challenge, but it doesn't end here.
bcdyza      -> abcxyz
fybnqmfufyu -> exampletext

When flipped vertically, it ciphers input with a reverse alphabet. This can be considered the opposite approach to the Caesar cipher.
abcxyz      -> zyxcba
exampletext -> vcznkovgvcg

Finally, when rotated 180 degrees, it reverses input. I have a feeling it has to be a reverse of something (hint: the input).
abcxyz      -> zyxcba
exampletext -> txetelpmaxe

How it works
The block basically consists of four semi-overlapping algorithms.
Caesar cipher encoder
v$,g6<
v,$ _^
1 >v\
~ +:1
+ 00-
>:|6g
{a@>^

Caesar cipher decoder (flipped horizontally)
v$,g6<
v,$ _^
1 >v\
~ -:1
+ 20-
>:|6g
`z@>^

Reverse alphabet cipher (flipped vertically)
v,-\+**<
   >65 ^
~>7^
:^9<
>1+|@
   >^

Text reverser (rotated 180 degrees)
v  <
~
:>:#,_@
1^  <
>+ |$
   >^

I suppose Befunge is at a slight advantage here, because you can always just use the upper left quadrant and completely ignore what's in the rest of the code. Nice work though!

Wow! I HAVE to upvote this, even though that means I drop down to third place.

Brainfuck, 5
,+.-,

Possibly for the first time ever, Brainfuck produces an answer that is competitive on code length. Shame it's not a code-golf question.
Inputs a byte (character) , increments it, and outputs the result. The comma at the end is waiting for another input, which if given will be ignored. There is nothing in the spec about proper termination :-)*
*(or about doing something useful with all the code in both directions)
Typical results (second character if given is ignored).
Forward: B --> C
Reverse: B --> A or C --> B

Marbelous
Here is a simple one to start us off. It reads one character from STDIN, increments and prints it.
--
]]
00
]]
++

If we rotate this by 180° (without swapping brackets), or mirror it in the x-axis, we get
++
]]
00
]]
--

which reads a byte from STDIN and decrements it.
You can test it here.
I might look into some more complicated Marbelous programs, but I'm sure es1024 will beat me to it. ;)
Explanation
The 00 is a marble with value 0 (which is arbitrary). The ]] devices read a byte from STDIN - that is, if a marble falls through them, the marble's value is changed into the read byte. The ++ and -- devices simply increment or decrement a marble's value (mod 256) and let it fall through. When a marble falls off the board, the byte is written to STDOUT.
Therefore, the two devices at the top are simply ignore because control flow never reaches them.

Alternately, you could replace your three middle rows by a single input device.

@overactor Or do you mean }0 and use it as a subboard?

}0 as a command line input to be precise.

Marbelous
This board takes one argument (x) and returns (101 * x) mod 256.
.. @5 .. }0 }0 @1 .. @0 .. @2 ..
.. /\ Dp << \\ .. &0 >0 &1 .. ..
!! @3 .. << }0 .. \/ -- \/ .. }0
@4 .. .. &0 @1 /\ &0 65 &1 /\ @2
/\ Dp .. @4 .. .. @3 @0 @5 !! \\

Mirroring the cells along the y-axis will result in a board that takes one argument (y) and returns (101 * y + 8 * y) mod 256, which is the inverse of the first board.
.. @2 .. @0 .. @1 }0 }0 .. @5 ..
.. .. &1 >0 &0 .. \\ << Dp /\ ..
}0 .. \/ -- \/ .. }0 << .. @3 !!
@2 /\ &1 65 &0 /\ @1 &0 .. .. @4
\\ !! @5 @0 @3 .. .. @4 .. Dp /\

Test this here. Cylindrical boards and Include libraries should both be checked.
Example input/output:
Original Board:      Mirrored Board:
Input   Output       Input    Output
025     221          221      025
042     146          146      042
226     042          042      226

Please note that Marbelous only allows for passing of positive integers as arguments, and these integers are passed into the program modulo 256 by the interpreter.
101 was chosen for two reasons: it is a prime (and every possible input to this program results in a unique output), and the inverse operation involved 109, which is a convenient distance of 8 away from 101.
Brief Explanation
The column containing the cells (from top to bottom) @0 >0 -- 65 @0 runs the same in both boards, and loops 101 times before heading to the right. On either side of the >0 branch is a different synchroniser; which one is chosen depends on whether the board is mirrored or not.
On each side, in sync with the center loop, the input is repeatedly summed, thus obtaining 101*x mod 256. On the reversed board, two copies of the input are also bit shifted twice to the left (input * 4), then summed and left in a synchroniser.
Once the center loop finishes, the summed up marbles are sent for printing, which is on the side of the board (left for original board, right for mirrored). After printing, a !! cell is reached, terminating the board. Note that the loop that gave 101 * x continues to run by itself until the board is terminated.
Dp simply prints out the result as a decimal number.

Theseus
This may be considered as a loophole, but I like the language, so here goes. This program defines a function f on natural numbers that maps 3n to 3n+1, 3n+1 to 3n+2, and 3n+2 to 3n, for every n.
data Num = Zero | Succ Num

iso f :: Num <-> Num
  | n                          <-> iter $ Zero, n
  | iter $ m, Succ Succ Succ n <-> iter $ Succ m, n
  | iter $ m, Succ Succ Zero   <-> back $ m, Zero
  | iter $ m, Succ Zero        <-> back $ m, Succ Succ Zero
  | iter $ m, Zero             <-> back $ m, Succ Zero
  | back $ Succ m, n           <-> back $ m, Succ Succ Succ n
  | back $ Zero, n             <-> n
  where iter :: Num * Num
        back :: Num * Num

Theseus is a reversible language with a Haskell-like syntax, where every function is invertible (discounting issues with non-termination). It is highly experimental, and designed for research purposes. The above code defines a datatype for natural numbers, and the function f. Given an input number, you pattern-match to it on the left-hand side (it always matches n). Then you look at the pattern on the right. If that pattern has a label (here iter), you proceed to pattern-match it on the left-hand side, and again take the corresponding value on the right-hand side. This repeats until you have an unlabeled value on the right, and that is your output. The patterns on the left, and on the right, must be exhaustive and non-overlapping (separately for each label). Now, to "reverse the polarity" of f, I do the following.

Swap the two values of every label. This does not change the semantics of f.
Swap the right- and left-hand-sides in the function body. This defines the inverse function of f by design.

The result:
iso f :: Num <-> Num
  | iter $ n, Zero             <-> n
  | iter $ n, Succ m           <-> iter $ Succ Succ Succ n, m
  | back $ Zero, m             <-> iter $ Succ Succ Zero, m
  | back $ Succ Succ Zero, m   <-> iter $ Succ Zero, m
  | back $ Succ Zero, m        <-> iter $ Zero, m
  | back $ Succ Succ Succ n, m <-> back $ n, Succ m
  | n                          <-> back $ n, Zero
  where iter :: Num * Num
        back :: Num * Num

tr
a b

Example:
$ echo "apple" | tr a b
bpple
$ echo "bpple" | tr b a
apple

Only a true inverse on the domain of strings that don't include both 'a' and 'b'.

You actually need to restrict the domain a bit more than that. For example, if you start with "bog", your program and its reverse give "bog" -> "bog" -> "aog". So any string containing 'b' is a problem (or containing 'a', if you apply the reverse program first).

You can use tr abc bca with the reversed polarity version tr acb cba.

Another Marbelous answer
The original right shifts the command line input (an 8 bit value), adding a leading one if a 1 gets lost by shifting. (0000 0001 -> 1000 0000)
{0 ..
~~ ..
>> {0
-2 =0
.. ^0
\/ }0
}0 Sb
<< ..
\\ ..
:Sb
// ..
Sb >>
}0 ..
^7 }0
{0 \/

Rotating this board by 180° (but leaving the content of each cell the same) Changes the program so that it left shifts (1000 0000 -> 0000 0001)
\/ {0
}0 ^7
.. }0
>> Sb
.. //
:Sb
.. \\
.. <<
Sb }0
}0 \/
^0 ..
=0 -2
{0 >>
.. ~~
.. {0

You can test it here. (you'll need to turn on 'Display output as decimal numbers')
Explanation
Both program consist of two boards, the main board (which gets the command line input) and Sb. Lets have a look at both versions of the main board, only looking at cells that can be reached in their respective orientation (since marbles typically can't go upwards and the input devices are not at the top):
original:      flipped:
   }0          }0
}0 Sb          .. }0
<< ..          >> Sb
\\ ..          .. //

Those are pretty straightforward boards, both take two copies of the input (which take the place of the }0cells. The original feeds one version into a left shift device << the flipped version puts it in a right shift device >> These perform a bitshift but unfortunately discard any lost bits. Which is where the Sb boards come in, they check if bitshifting the value they're fed will result in a bit being lost and return a value to be added to the result to counteract the lost bit.
Here's the relevant part of the original Sbboard for the original program:
}0
^7
{0

This one is incredibly easy, `^7' checks the value of the most significant bit. If this one is 1, performing a left shift would cause this bit to be lost. So this board outputs the value of this bit as an 8 bit value to be added to the result of the bitshift.
For the flipped version, Sbhas to look at the least significant bit and return 128 or 0, this is a little bit more complicated:
}0
^0 ..
=0 -2
{0 >>
.. ~~
.. {0

If the least significant bit (as tested by ^0) is 0, it just returns 0. If it is one, ^0 will output 1. This will fail the equality test with 0 =0 and thus be push to the right. We then subtract 2 -2to get 255, left shift >> to get 127 and perform a binary not ~~ to get 128 (we could also simply have added one ++ to get 128, but where's the fun in that?)