text:
Split a Shakespeare Script
Mr. William Shakespeare wrote plays. A lot of plays. In this tarball containing every single one of his works, each one of his plays is one long file.
It needs to be split into Scenes for a stage production. Because actors are impatient, your code needs to be as short as possible.
Task:
Your task is to write a program or function to split the plays contained in this file into separate files, numbered sequentially starting from 1, where each one contains a scene. You should retain all whitespace and titles.
Input:
Input will be a single play via stdin, or the filename as a parameter. You can choose. The play will look something like:
 TITUS ANDRONICUS

    DRAMATIS PERSONAE

SATURNINUS  son to the late Emperor of Rome, and afterwards
    declared Emperor.

BASSIANUS   brother to Saturninus; in love with Lavinia.

TITUS ANDRONICUS    a noble Roman, general against the Goths.

MARCUS ANDRONICUS   tribune of the people, and brother to Titus.

LUCIUS  |
    |
QUINTUS |
    |  sons to Titus Andronicus.
MARTIUS |
    |
MUTIUS  |

Young LUCIUS    a boy,
[...]
ACT I

SCENE I Rome. Before the Capitol.

    [The Tomb of the ANDRONICI appearing; the Tribunes
    and Senators aloft. Enter, below, from one side,
    SATURNINUS and his Followers; and, from the other
    side, BASSIANUS and his Followers; with drum and colours]

SATURNINUS  Noble patricians
[...]
ACT I

SCENE II    A forest near Rome. Horns and cry of hounds heard.

    [Enter TITUS ANDRONICUS, with Hunters, &c., MARCUS,
    LUCIUS, QUINTUS, and MARTIUS]

TITUS ANDRONICUS    The hunt is up, the morn is bright and grey,
    The fields are
[...]
ACT II

SCENE I Rome. Before the Palace.

    [Enter AARON]

AARON   Now climbeth Tamora
[...]
Output:
The output should look something like this:
ACT I

SCENE I Rome. Before the Capitol.

    [The Tomb of the ANDRONICI appearing; the Tribunes
    and Senators aloft. Enter, below, from one side,
    SATURNINUS and his Followers; and, from the other
    side, BASSIANUS and his Followers; with drum and colours]

SATURNINUS  Noble patricians...

ACT I

SCENE II    A forest near Rome. Horns and cry of hounds heard.

    [Enter TITUS ANDRONICUS, with Hunters, &c., MARCUS,
    LUCIUS, QUINTUS, and MARTIUS]

TITUS ANDRONICUS    The hunt is up, the morn is bright and grey,
    The fields are...
ACT II

SCENE I Rome. Before the Palace.

    [Enter AARON]

AARON   Now climbeth Tamora ...
etc.
Output either into numbered files, or to the stdout stream (returning for functions) with a deliminator of your choice.
Bonuses:

10% If you save the bit before Act 1 into file 0. Note: It must not break if the bit before Act 1 is empty.
15% If you can take both stdin and a file path parameter inputs
20% If you can output both into files and to stdout / return.
200 reputation if you can make the smallest SPL program. This bounty has been awarded.

Leaderboards
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

I will give out a +200 bounty to the first valid Shakespeare Programming Language submission.

Come on, everyone knows that CodeGolfs aren't fast. Why not say that "The tarball is already pretty full, so your code should be as short as possible"?

@LegionMammal978 "With a deliminator of your choice".

Could you include some contents of the relevant file in the question instead of just giving a link?

The output was quite clear though, I was primarily asking to include some key parts of the input file

Are functions allowed?

Do the bonuses combine as sums or products? That is, does achieving all 3 bonuses result in 10 + 15 + 20 = 45% reduction or 90% of 85% of 80% = 61.2% (a 38.8% reduction)?

@trichoplax Products. I thought that was how everybody did it! crosses out in notebook

The leaderboard stack snippet is broken, and I can't fix it because it's only 4 characters. Can someone with 2k+ rep change (\d+) to ([\d\.]+) in SCORE_REG please?

@shelvacu I would ask on the Meta page, linked to in the question. That is where the leaderboard is maintained.

@cat Here you go! http://codegolf.stackexchange.com/a/69360/43394

@wizzwizz4 I have to wait 24 hours to award it :(

@cat Could you wait 7 days? The question won't go anywhere, and neither will the answer... (Or maybe Robert deserves it ASAP. d:-D )

@wizzwizz4 sure, I'll wait 7 days and accept the shortest next wednesday.

@cat -- Leave it open; I'm sure there are smaller Shakespeare solutions than mine. Mine is as fat as the sum of a big big big cat and a cat.

@RobertFraser I can't stop giggling at that -- I think you've invented William Suess ;)

Shakespeare Programming Language 1.2.1, 930 895 887 - 10% = 798.3 bytes
G.Ajax,a.Puck,a.Page,a.Ford,a.Act I:a.Scene I:a.[Enter Ajax and Puck]Puck:Open thy mind.Ajax:Open thy mind.[Exit Puck][Enter Page]Ajax:Open thy mind.SCENE II:b.[Exeunt][Enter Puck and Ajax]Ajax:Am I as fat as the sum of the cube of a big big cat and a cat?Puck:If not,let us return to scene III.Am I as fat as the sum of you and a big cat?[Exit Puck][Enter Page]Page:If not,let us return to scene III.Am I as fat as the sum of the sum of the cube of a big big cat and a big big big big cat and a big big cat?[Exit Page][Enter Ford]Ajax:If not,let us return to scene III.You is a big big big big big big cat.Speak thy mind.Scene III:c.[Exeunt][Enter Ajax and Puck]Puck:Speak thy mind.You is as fat as I.[Exit Ajax][Enter Page]Page:You is as fat as I.Puck:Open thy mind.Is you as fat as a hog?[Exit Page][Enter Ajax]Puck:If not,let us return to Scene II.Speak thy mind.Ajax:Speak thy mind.

Ungolfed and rewritten in Sharkspearean language:
Four Gentlemen of Verona.

Ajax, a master code-golfer with years of experience.
Puck, a young Java programmer and a strong believer in object-oriented design patterns.
Page, a rapscallion of ill repute.
Ford, a car manufacturer.

Act I: A one-act masterpiece.

Scene I: In which many minds are opened, possibly via the consumption of psychadelic drugs.
[Enter Ajax and Puck]
Puck: Open thy mind.
Ajax: Open thy mind.
[Exit Puck]
[Enter Page]
Ajax: Open thy mind.

SCENE II: In which things are compared.
[Exeunt]
[Enter Puck and Ajax]
Ajax: Am I as hairy as the sum of the cube of a furry purple chihuahua and a summer's day?
Puck: If not, let us proceed to scene III. Am I as half-witted as the sum of you and a cunning squirrel?
[Exit Puck]
[Enter Page]
Page: If not,let us proceed to scene III. Am I as delicious as the sum of the sum of the cube of a warm healthy hamster and a proud handsome charming noble nose and a big old aunt?
[Exit Page]
[Enter Ford]
Ajax: If not, let us proceed to scene III. You are the cube of a tiny small pony. Speak thy mind.

Scene III: In which minds are spoken.
[Exeunt]
[Enter Ajax and Puck]
Puck: Speak thy mind. You are as smelly as I.
[Exit Ajax]
[Enter Page]
Page: You are as oozing as I.
Puck: Open thy mind. Are you as disgusting as a Microsoft?
[Exit Page]
[Enter Ajax]
Puck: If not,let us return to Scene II. Speak thy mind.
Ajax:Speak thy mind.

In C-like psuedocode:
Scene_I:
    Ajax = getchar()
    Puck = getchar()
    Page = getchar()
Scene_II:
    if(Ajax != 'A')
        goto Scene_III
    if(Puck != 'C')
        goto Scene_III
    if(Page != 'T')
        goto Scene_III
    Ford = '@'
    putchar(Ford)
Scene_III:
    putchar(Ajax)
    Ajax = Puck
    Puck = Page
    Page = getchar()
    if(Page != -1)
        goto Scene_II
    putchar(Ajax)
    putchar(Puck)

Requires the input file contains at least 3 characters. Uses "@" as a delimiter and reports results to stdout. I'm taking the 10% bonus since the part before the first scene will be before the first "@", much like Martin Büttner's solution above.
The way it works is to put a "@" if it sees three characters "ACT" in a row. Note this means it would transform "ENACTED" into "EN@ACTED". This can be fixed at the cost of a few hundred bytes, but luckily it seems every "ACT" in the given plays (at least the few I checked) was the beginning of a scene.
Tested with the 1.2.1 SPL linked above. I'm not sure if it will work on the web interpreter. The script used for testing was:
#!/bin/bash
set -e
SCRIPT_DIR=`dirname "$0"`
cd "$SCRIPT_DIR"
spl/bin/spl2c <splits.spl >splits.c
gcc -O2 -Wall -Wno-unused -I./spl/include -L./spl/lib -lm -lspl -o splits splits.c
./splits <measureforemeasure >measure.split.txt

The "esoteric" parts of the SPL once you get past the syntax are the shuffling of variables on "stage" (generally, you only want to have two characters on stage at a time) and the representation of constant numbers. There are 6 word lists of import that come with the distribution: positive adjectives, neutral adjectives, negative adjectives, positive nouns, neutral nouns, and negative nouns. A positive/neutral noun (ie plum or stone wall) is 1, and a negative noun (ie flirt-gill or Microsoft) is -1. Positive/neutral adjectives (ie embroidered or bottomless) multiply the number by 2, and negative adjectives (ie fat-kidneyed or fatherless) multiply by -2. The word lists are sadly rather limited, with only 10-20 entries each.
At my next meeting, I'll be suggesting we move all our production code to Shakespeare because it's far more expressive than Scala.

Golf this as much as you can. Please!

Holy cats, I didn't think anyone actually would! I'll award this in 24 hours, which is as soon as I can :)

@wizzwizz4 - definitely; i'll give it a shot when i don't have real work to do :-). it'll will be as succinct as if it were were written by the bard himself

The bounty now counts as a bonus. Add a +200 reputation to the title if you want! :-)

Now, who can I hire to perform this on stage?

This might help you golf: http://codegolf.stackexchange.com/questions/48855/tips-for-golfing-in-the-shakespeare-programming-language

I reckon you've probably got the bounty by now. Somebody else could take it, but I doubt it. :-)

@cat - Just get three people who are insecure about their weight and show them a picture of a cat.

You can now add a try it online link. There's also a tip on the tips thread for SPL you didn't use.

Some quick golfing can get this down to 717 bytes

706 bytes

Retina, 9 - 10% = 8.1 bytes
Byte count assumes ISO 8859-1 encoding.
¶ACT
=$0

Inserts a = (as a delimiter) in front of every ACT that is preceded by a linefeed and followed by a space.
Try it online! (But you'll have to copy in the input yourself due to its size.)

Congratulations to answer 69000 (according to the share-link).

@J_F_B_M Post 69000. That's questions and answers.

awk, 51 * .9 * .85 * .8 = 31.2
Splits into multiple files. Outputs on stdout separated by a =.
/^ACT/{f++;$0="="$0}{system("echo \""$0"\">>"f*1)}1

+1 All you need to do now is to output all of the files to stdout separated by a specific character, and you're done!

Done. With the bonus it's almost the same length.

+2... +2........ +2............ No. The system doesn't allow it :-( I would however recommend separating them with a character that is even less common, such as ¬ or ¦.

JavaScript ES6, 28 - 10% = 25.2 bytes
s=>s.replace(/\nACT/g,"=$&")

Not even the JS shell has file I/O so this can't qualify for the -20% bonus
Try it online here (you'll have to paste the input in yourself)

I think that you can take out the T for one byte saved.

Doesn't replace remove the ACT line?

@wizzwizz4 because I have the $& it won't

@Doᴡɴɢᴏᴀᴛ You learn something new every day!

Perl, 66 - 10% - 20% = 47.52 bytes
BEGIN{open(S,">0");}++$?,open(S,">$?"),print"=\n"if/^ACT/;print S

Added one for the -p option.

Ruby, 30 - 10% - 15% = 23.715 22.95 bytes
Splits input on $. 15% bonus applies because Ruby redirects $< to point at the file passed into ARGV by default if it's supplied, or STDIN if not.
-1 byte by leveraging gsub similar to @Downgoat ES6 solution but I'm still leveraging the hope that ACT only ever appears at the ACT labels and not inside any other word, just because
$><<$<.read.gsub("ACT","$ACT")

Also, my 41.004 (originally 67) byte solution that also does file output. Starring probably the only time the each command saves bytes over map in Ruby, because each returns the array passed in unadulterated after running its block, unlike map.
i=-1;$><<$<.read.split(/(?=ACT)/).each{|s|open("#{i+=1}",?w)<<s}*?$

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


text:
Add and multiply perplexing numbers
The split-complex numbers, also known as "perplex numbers" are similar to the complex numbers.  Instead of i^2 = -1, however, we have j^2 = 1; j != +/-1.  Each number takes the form of z = x + j*y.
In one attempt to limit the complexity of this challenge, I will use the symbol - to represent negation, as there will not be any subtraction.
Here are some examples for your viewing pleasure:
6 * 9 = 54            // real numbers still act normally
5 + -7 = -2
j*1 + j*1 = j*2           // two `j`s added together make a j*2
7 * j*1 = j*7           // multiplication is commutative & associative
j*1 + 2 = 2+j*1           // like oil and water, "combine" to form a split-complex number
j*1 + j*-3 = j*-2          // seems okay so far
j*j*1 = j*-1*j*-1 = 1     // kinda sketchy, but such is its inherent nature
j*j*-1 = j*-1*j*1 = -1
(2+j*3)+(4+j*7) = 6+j*10  // combine like terms
7 * (2+j*3) = 14+j*21 // distributive property
j * (2+j*3) = (j*2) + (j*j*3) = 3+j*2   // since j^2 = 1, multiplying my j "swaps" the coefficients
(2+j*3)*(4+j*7) = (2*4)+(2*j*7)+(j*3*4)+(j*3*j*7) = 8+j*14+j*12+21 = 29+j*26 // a complete multiplication

Challenge
The goal of this challenge is to evaluate an expression with split-complex numbers.
This is code-golf, the fewest bytes wins.
Input
Input will be a single line containing only the symbols +*()-, the digits 0123456789, and the letter j, with an optional newline.  This string represents an expression, using infix notation and operator precedence (multiplication before addition, with parenthesis grouping).

The symbol - will always represent negation, never subtraction.  If you so desire, you can replace - with either _ or ~ for ease of I/O.
Parenthesis can be nested up to three times to denote grouping: (1+(1+(1)))
The letter j will never be directly prefixed with negation, and will always be followed by *.
Parentheses will not be preceded by negation -(7), but instead like -1*(j*5+2)
There will never be implicit operations. All multiplication will be expressed as (7)*7 instead of (7)7, and as j*5 instead of j5.
No leading zeros.

Output
Output will be in the form of X+j*Y, where X and Y can be any integer.  If an integer is negative, it should be prefixed with the negation sign.
Additional Restrictions
Although I am not aware of any language with native support, built-ins that deal with split-complex numbers are forbidden.  Regular complex numbers are fair game.
Test Cases
Similar to the above examples, but tidied up.  Input on one line and output the line beneath.
(2+j*3)+(4+j*7)
6+j*10

(2+j*3)*(4+j*7)
29+j*26

(-5+j*1+j*2+2)*(4+j*7)
9+j*-9

(1+j*-1)*(1+j*1)
0+j*0 // this is why division does not exist.

j*((j*-1)+2)
-1+j*2

(2+(5+-1*(j*1))+2)
9+j*-1

Python 2, 62 bytes
def f(s):b,a=[eval(s)/2.for j in-1,1];print'%d+j*%d'%(a+b,a-b)

We simply evaluate the expression s with  j=1 and j=-1, and output half their sum and half their difference as the coefficients of 1 and j.
This works because both j=1 and j=-1 satisfy the defining equation defining equation j*j==1. So, the original and simplified expressions must be equal for both these values. The simplified expression is linear, so this gives two linear equations in two unknowns:
x + 1*y  = s(1)  = 2*a
x - 1*y  = s(-1) = 2*b

which is solved by x=a+b, y=a-b.

A language with matrix operations could also evaluate the expression with j=[0 1; 1 0] and read off coefficients from the top row.

Python 2, 258
class c(complex):__mul__=lambda s,o:c(s.real*o.real+s.imag*o.imag,s.real*o.imag+s.imag*o.real);__add__=lambda s,o:c(sum(map(complex,[s,o])))
import re
r=eval(re.sub("j","c(0,1)",re.sub(r"(-?\d+)",r"c(\1)",raw_input())))
print`int(r.real)`+"+j*"+`int(r.imag)`

This is probably not the best approach, but it was the first time that OOP looked like a passable idea in Python for code golf, so why not?
Creates a class c that inherits from complex but has a different mul operation. The add operation is also changed so that it returns an object of type c and not complex, this behaviour is necessary to prevent the case of (a + b) * (c + d) doing complex multiplication instead of this special kind.
The input string is then converted into a string that can be evaluated naturally by python. It does this by changing every number into c(number) and then every j into c(0,1).
Try it online or run a Test Suite

GAP, 38 bytes
j:=X(Integers,"j");f:=t->t mod(j^2-1);

First j is defined to be an indeterminate, so we can create polynomials in j. To get the corresponding perplexing number, we reduce (i.e. take the remainder of polynomial division) by j^2-1. This gives a linear (or constant) term, and we can rely on GAP's ability to output polynomials.
Examples:
gap> f((2+j*3)+(4+j*7));
10*j+6
gap> f((1+j*-1)*(1+j*1));
0

Caveat: 1. This does not take a string as input, but a real term in GAP's language. To fix, I could use EvalString. 2. The output is nice and clear, but not exactly as specified: Order is changed, and unnecessary zeroes are suppressed. I think and hope this is still in the spirit of the challenge, otherwise I guess I'd be better off using @xnor's matrix approach.

Mathematica's PolynomialMod[#,j^2-1]& has similar properties. Indeed, if we never multipled more than two perplex numbers together (like the test cases don't), then Expand@#/.j^2->1 suffices.

Similarly, t->t%(j^2-1) in Pari/GP.

Axiom, 20 42 bytes
f(x,n)==x^(n rem 2);m:=rule('j^n==f('j,n))

the preceding solution have a problem if n<0 in j^n
but this it seems more solid, and advise well where there is something wrong, even if the perfection would be return example j^1.2 or j^sqrt(-1) the same expression not evaluate
(9) -> f(x,n)==x^(n rem 2);m:=rule('j^n==f('j,n))
         n
   (9)  j  == 'f(j,n)
                    Type: RewriteRule(Integer,Integer,Expression Integer)
(10) -> [m((2+j*3)+(4+j*7)), m((2+j*3)*(4+j*7)), m((-5+j*1+j*2+2)*(4+j*7))]
   (10)  [10j + 6,26j + 29,- 9j + 9]
                                            Type: List Expression Integer
(11) -> [m((1+j*-1)*(1+j*1)), m(j*((j*-1)+2)), m(2+(5+-1*(j*1))+2)]
   (11)  [0,2j - 1,- j + 9]
                                            Type: List Expression Integer
(12) -> [m(j*j*j*j),m(j*j*j),m(j^200)]
   (12)  [1,j,1]
                                            Type: List Expression Integer
(13) -> [m(j^0),m(j^-1),m(j^-2), m(j^-3)]
            1   1
   (13)  [1,-,1,-]
            j   j
                                            Type: List Expression Integer
(14) -> m(j^(3.4))
   There are no library operations named m
      Use HyperDoc Browse or issue

if i not follow some law of the question: say me that and i add "not competitive". I mean it as one axiom for simplify formula

Batch, 52 bytes
@set/aj=1,a=%1,j=-1,a-=b=(a-(%1))/2
@echo %a%+j*%b%

After seeing @xnor's excellent answer nomination I felt compelled to port it.

source: Stack Exchange

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

sort: votes


text:
"You must construct additional pylons!"
Introduction
In the strategy game Starcraft 2, there are three "races" to choose from: Terran, Zerg, and Protoss. In this challenge we will be focusing on the Protoss and the iconic phrase "You must construct additional pylons!" This message is stated when you run out of supply to build your army. So, to help out the Starcraft community, you must write a program or function that tells players exactly how many pylons they need.
The Challenge
You will be given an input of a string consisting of a single integer N and space-separated list of units. N will always be zero or positive, and the list of units will always have one or more valid units. N represents the amount of pylons the player currently has. Your job is to calculate if the amount of pylons that the player has is enough to build the units. Your program or function must output/return a truthy value if there is enough supply, or if there is not enough supply you must output You must construct ZZZ additional pylons where ZZZ is the amount of pylons needed to build the units. Note that pylon(s) must be plural when needed and unplural when not (...1 additional pylon!, ...2 additional pylons!).
Protoss Units and Supply Cost
Here is a list of all units and their corresponding supply cost. Pylons provide an additional 8 supply.
Unit            Supply Cost

Probe           1
Zealot          2
Sentry          2
Stalker         2
HighTemplar     2
DarkTemplar     2
Immortal        4
Colossus        6
Archon          4
Observer        1
WarpPrism       2
Phoenix         2
MothershipCore  2
VoidRay         4
Oracle          3
Tempest         4
Carrier         6
Mothership      8

Examples WITHOUT Bonuses
Input:
   2 Probe Probe Probe Probe Stalker Zealot Carrier Probe Zealot
Output:
   You must construct 1 additional pylon!
Why?
   Adding up the supply costs for all of the units gives 17. The current 2 pylons provide 16 supply, so one more is needed to provide enough for 17.

Input:
   5 Mothership Carrier Probe Tempest HighTemplar
Output:
   true
Why?
   Adding up the units gets 21. The current 5 pylons provide 40 supply, which is plenty enough.

Input:
  0 Mothership Colossus Zealot
Output:
  You must construct 2 additional pylons!
Why?
  Adding the units gets 16. There is no pylons so 2 need to be built to provide enough supply.

Bonuses

Any experienced Starcraft 2 player would know that you need a mothership core before to transform it into a mothership. Also, you can only have one mothership at a time (whether it is an actual mothership or a mothership core). If neither of these conditions are true, output any falsy value. If your program can check to see that only one mothership is active at a time, and that a mothership core is built before the actual mothership, take 20% off your byte count.
Little may you know, but nexuses (protoss command centers) actually provide supply too! If your program can add 11 to the maximum supply every time it encounters a nexus in the unit list, take 10% off your byte count. Note that it does not matter where the Nexus is in the build order, so 0 Probe Nexus would still return true.

Examples WITH Bonuses
Input (Bonus 1):
  3 Mothership Zealot
Output:
  false
Why?
  According to the first bonus, a mothership core has to be built before a mothership.

Input (Bonus 1):
  3 MothershipCore Mothership MothershipCore
Output:
  false
Why?
  According to the first bonus, only one mothership can be built and here there is two (MothershipCore -> Mothership and a second MothershipCore).

Input (Bonus 2):
  0 Probe Nexus Probe
Output:
  true
Why?
  According to the second bonus, nexuses add 11 to the maximum supply, allowing both probes to be built.

Input (Both Bonuses):
  0 Nexus MothershipCore Mothership Carrier
Output:
  You must construct 1 additional pylon.
Why?
  There are no pylons, but the nexus provides 11 supply. The motherships take up 2 and 8, respectively and the carrier takes up 6. You need one more pylon to have enough to provide for all 16 supply.

TL;DR
Input a string consisting of an integer and space-separated unit names (from the table above). Output a truthy value if you can build all of the units with the supply provided by the N pylons (the integer in input). Output You must construct ZZZ additional pylon(s) if more pylons are needed, where ZZZ is the amount of pylons needed. Make sure to make pylons plural if necessary.
This is code-golf, so shortest code in bytes (or your language's counting method) wins!
Leaderboard
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=69011,OVERRIDE_USER=36670;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?([\d\.]+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Does it have to be space-separated or can it be 'convenient'?

@muddyfish If I understand you correctly, yes the input has to be space separated in the form N unit1 unit2 unit3....

Will there ever be more than 9 pylons? Do I have to output exactly true or is a truthy value acceptable?

@DomHastings there can be more than 9. Any truthy value is acceptable.

I edited the leaderboard to handle floats, let me know if I broke something.

I saw pylons and I thought fallout 4. I swear preston gravey is haunting me.

Related: https://www.youtube.com/watch?v=HzccCLaLMmw

Oh, come on! Does anyone remember Starcraft: Broodwar or the original Starcraft? They have that phrase, too!

Ruby, 263 - 30% = 184 bytes
v=c=k=0
l,a={PeOr:1,ZtSySrHrDrWmPxMe:2,Oe:3,VyIlAnTt:4,CsCr:6,Mp:8,Ns:-11},ARGV.shift
ARGV.map{|u|k+=l[l.keys.grep(/#{q=u[0]+u[-1]}/)[0]];c+=1if q=="Me";v=!0if c!=1&&q=~/M/}
n=k/8.0-a.to_i
p v ?n<0||"You must construct #{n.ceil} additional pylon#{'s'if n>1}!":nil

Usage
ruby sc.rb 0 Probe Nexus

Python 3, 207*.9 == 186.3 bytes.
Implements the nexus bonus.
Saved 26 bytes thanks to DSM.
Saved 2 bytes thanks to Tim Pederick
x,*l=input().split()
d=-((int(x)*8-sum((('vexuobcl'+2*'clsuie'+4*'Ratahoiesuhihi').count(q[-3:-1])*(1-12*(q[0]>'w'))or 2)for q in l))//8)
print((1,"You must construct %s additional pylon"%d+'s!'[d<2:])[d>0])

Nice work! Since you need only output a truthy value, not necessarily True, you can save two bytes by replacing 1>0 with just 1.

@TimPederick I wasn't sure if that counted as truthy enough.

It satisfies the most popular definition of "truthy" from meta.

You must construct additional pythons...

JavaScript, 274 265 bytes (no bonuses) 281 - 10% = 252.9 bytes
s=>(c=eval(s[a="replace"](" ","-(")[a](/ /g,"+")[a](/\w+/g,m=>m[b="match"](/^(Pr|Ob)/g)?1:m[b](/^([ZSHDWP]|M\w+C)/g)?2:m[b](/^O/g)?3:m[b](/^[IAVT]/g)?4:m[b](/^N/g)?-11:m[b](/^C/g)?6:+m!=m?8:m*8)+")"))>0?true:`You must construct ${Math.ceil(-c/8)} additional pylon${c/8<-1?"s":""}!`

This appears to be pretty lengthy...
Demo + explanation:

p = s => (c = eval(
  s[a = "replace"](" ", "-(")         //replace the first space (after the number of pylons) with "-" and open the bracket
   [a](/ /g, "+")                       //replace all the remaining spaces with "+"
   [a](/\w+/g, m =>                     //replace any sequence of characters with...
    m[b = "match"](/^(Pr|Ob)/g) ? 1 :   //with 1, if matches "Probe" or "Observer"
    m[b](/^([ZSHDWP]|M\w+C)/g) ? 2 :    //with 2, if it matches bunch of the units with cost 2. "Probe" didn't match already, so it's safe to catch "Phoenix" by only the first letter.
    m[b](/^O/g) ? 3 :                   //with 3, if match is "Oracle"
    m[b](/^[IAVT]/g) ? 4 :              //with 4, if matches "Immortal", "Archon", "VoidRay" or "Tempest"
    m[b](/^C/g) ? 6 :                   //with 6, if it's "Carrier" or "Colossus"
    m[b](/^N/g) ? -11 :                 //don't forget nexuses!
    +m != m ? 8 : m * 8                 //and if's not a number, then it's "Mothership", so with 8. If it's number, it can only be the number of pylons, replace it with itself multiplied by 8.
  ) + ")"                             //close the opened bracket
)) > 0 ? true : `You must construct ${Math.ceil(-c/8)} additional pylon${c/8<-1?"s":""}!`

document.write(
  p("2 Probe Probe Probe Probe Stalker Zealot Carrier Probe Zealot") + "
" +
  p("5 Mothership Carrier Probe Tempest HighTemplar") + "
" +
  p("0 Mothership Colossus Zealot") + "
" +
  p("0 Probe Nexus Probe")
)

I have no idea why I didn't look at bonuses, should do it.

Save 8 bytes by using -(c>>3) instead of Math.ceil(-c/8). Save another 2 bytes by using c<-8 instead of c/8<-1.

Your inner matches don't need /g do they? That would save another 6 bytes. Also /ob/i looks like it would work for another 5 byte saving.

Your test seems to be wrong - you're using >0 but if you have an exact match then that's still true. Obviously for golfing purposes you would switch it to <0 and reverse the ?: arms.

I think you can save a further 17 bytes by using subtraction throughout. This is what I have so far: s=>(c=eval(s.replace(/ /g,"-").replace(/\w+/g,m=>m[b="match"](/ob/i)?1:m[b](/^([ZSHDWP]|M\w+C)/)?2:m[b](/^O/)?3:m[b](/^[IAVT]/)?4:m[b](/^N/)?-11:m[b](/^C/)?6:+m!=m?8:m*8)))<0?\You must construct ${-(c>>3)} additional pylon${c<-8?"s":""}!`:true`

Python 3, 293 − 30% = 205.1 bytes
Implements both bonuses. Prints 1 as its truthy value, and either 0 or an empty string as its falsey value.
s='5N 8O5P bDbHeM7P6S7S9W6Z 6O 6A8I7T7V . 7C8C . aM'.split()
m=M=n=o=0
p,*u=input().split()
for v in u:
 S=0
 while'%x'%len(v)+v[0]not in s[S]:S+=1
 n+=S or-11;M+=S>7;m+='pC'in v;o+=m>1or M>1or m<1<=M
q=int(p)+n//-8
print([1,'You must construct %d additional pylon'%-q+'s!'[q>-2:]][q<0]*(o<1))

Credit to Dom Hastings' solution for helping me shave off a good few bytes with a "poor man's ceil" of my own, and Morgan Thrapp's for the idea underlying 's!'[q>-2:], which saved me six bytes—not to mention pointing out, in the comments, how to save another byte on that bit.

Explanations
The string in line 1 encodes all of the units and their supply requirements. Each unit is represented as two characters: a hexadecimal digit giving the length of the unit's name, and the first character of the name (e.g. 8O is the Observer; aM is the Mothership). The supply requirement is the index of the encoded unit within the sequence s, formed by splitting the string on the spaces. Full stops mark unused amounts of supply (no unit needs 5 or 7 supply), and as a special case, the Nexus (5N) is at index 0.
Line 2 initialises values: m is the number of mothership cores, M is the number of motherships, n is the total supply cost, and o indicates whether or not the mothership build conditions have been violated. Line 3 takes the input, putting the number of pylons into p and the list of units into u.
Within the loop that starts at line 4, S is an index into s and, thus, also the amount of supply needed for the current unit, v. In line 6, the while statement steps through s until the unit is found. ('%x'%len(v) turns the length of the unit's name into a hex digit.)
Line 7 updates the total supply cost n (note the special case, -11, if S is zero). It then increments the counts of motherships M (identified by the supply cost being over 7) and mothership cores m (identified by the substring pC in the unit's name). Then, if either of these is greater than 1, or if M is at least one while m is still zero, the flag o is set. (Actually, it's incremented, but later on we only care if it's zero or non-zero.)
The pylon deficit q is calculated, a little oddly, in line 8. Naively, it should be n // 8 - int(p) (i.e. one eighth of the supply cost, minus any pylons we already have). But that would round down, when we need to round up. Integer division (//) rounds towards negative infinity, though, so we just work everything in negatives: int(p) - -(n // -8), which simplifies to the form actually used.
Lastly, the output. If we're just one pylon short, q will be -1, hence the test q>-2 (which slices the s out of the string s! if true, and keeps it otherwise). If there's no pylon deficit, q will be zero or positive, hence q<0 to select between the truthy value 1 or the output string. Lastly, if the flag o isn't zero, multiplying either result (1 or a string) by Boolean False (handled as numeric 0) will give a falsey value (0 or the empty string).

C++11, 732-30% = 512.4 bytes
Uses Dom Hastings's poor man's ceil and Martin Büttner suggestions of shorting the dictionary.
#include <iostream>
#include <map>
#include <string>
#include <cctype>
using namespace std;
map<int,int>a ={{536,1},{655,2},{677,2},{758,2},{1173,2},{1175,2},{869,4},{891,6},{635,4},{872,1},{997,2},{763,2},{1516,2},{766,4},{630,3},{770,4},{744,6},{1091,8},{563,-11}};
int main(){string b,c;int d,e,l,j,k=0,m=0,n=0,v=0;cin>>d;getline(cin,b);
while(b.size()){e=0;auto z=b.find(" ");c=b.substr(0,z);b.erase(0,((z==string::npos)?z:z+1));
for(int i=0;i<c.size();i++){e+=tolower(c[i]);}
if(e==1516){m++;}else if(e==1091){((m>1)?v=1:v=0);}
if((l=k-(d*8)>0)&&(m==n==1)){j=(int)(((float)l/8)+0.99);cout<<"You must construct "<<j<<" additional pylon"<<((j==1)?"!":"s!")<<endl;}
else{cout<<((m==n==1&&!v)?"True":"False")<<endl;}}

+1 Welcome to Programming Puzzles and Code Golf, and to all of Stack Exchange. This is a very good first answer. If you would like any help, just ask by typing @username at the beginning of a comment, e.g. @wizzwizz4.

Python 2, 442 359 464 332 314 306 - 10% = 275.4
a,*l=input().split(' ');p=int(a)*8;for i in l:p-={"Ne":-11,"Pr":1,"Ze":2,"Se":2,"St":2,"Hi":2,"Da":2,"Im":4,"Co":6,"Ar":4,"Ob":1,"Wa":2,"Ph":2,"MoC":2,"Vo":4,"Or":3,"Te":4,"Ca":6,"Mo":8}[i[:2]+("C"if i[-4:]=="Core")]
e=int(.9+p/8)+1;print[1,"You must construct "+`e`+" additional pylon"+"s!"[e>1:]][p>=0]

How could I shorten my dictionary?

There are tons of ways to do that. E.g. the JavaScript answer uses regular expressions instead of checking against individual strings. Maybe you could try finding a hash that maps each string to a unique number (maybe sum of the character codes). Those numbers might be shorter than the strings.

I'm not sure, but maybe it's long enough get savings with something like dict(x[:2],int(x[2:]) for x in "Ne-11 Pr1 Ze2".split())

Lua, 418 - 10% = 376,2 bytes
function p(i)i=i:gsub("(%w+)",function(w)q=tonumber(w)*8;return""end,1);n=0;i:gsub("(%w+)",function(w)m=w.match;n=n+(m(w,"^Pr.*")and 1 or m(w,"^Ob.*")and 1 or m(w,"^[ZSHDWP]")and 2 or m(w,"^M.*C")and 2 or m(w,"^O")and 3 or m(w,"^[IAVT]")and 4 or m(w,"^C")and 6 or m(w,"^N")and -11 or 8)end)if n>q then a=math.ceil((n-q)/8);print("You must construct "..a.." additional pylon"..(a>1 and"s"or"")..".")else print(1)end end

Implements the Nexus bonus.
First time I've posted something here. Was writing Lua scripts for a game, stumbled across this and felt like contributing, hah.
Note: This Lua function assumes that the base library has been loaded, and that the host application defines an appropriate print function that accepts any non-nil value.
I'm exploiting Lua's string.gsub to the best of my ability, as well as its and and or operators.
Here's the pretty version:
function pylons(i)
    -- Replace the first word, the number, with a space, while also storing it as a number * 8
    i = i:gsub("(%w+)", function(w)
        q = tonumber(w) * 8
        return ""
    end, 1)
    n = 0
    -- the function passed to gsub gets every word in the string,  and then I misuse Lua's and/or
    -- operator order to assign supply values to string.match calls that do not return nil
    i:gsub("(%w+)", function(w)
        m = w.match
        n = n + (m(w,"^Pr.*") and 1 or
        m(w,"^Ob.*") and 1 or
        m(w,"^[ZSHDWP]") and 2 or
        m(w,"^M.*C") and 2 or
        m(w,"^O") and 3 or
        m(w,"^[IAVT]") and 4 or
        m(w,"^C") and 6 or
        m(w,"^N") and -11 or 8)
    end)
    if n>q then
        a = math.ceil((n-q)/8)
        print("You must construct "..a.." additional pylon"..(a>1 and"s"or"")..".")
    else
        print(1)
    end
end

pylons("5 Nexus Probe Observer Zealot Sentry Stalker HighTemplar DarkTemplar WarpPrism Phoenix MothershipCore Oracle Immortal Archon VoidRay Tempest Colossus Carrier Mothership")
pylons("2 Probe Probe Probe Probe Stalker Zealot Carrier Probe Zealot")
pylons("5 Mothership Carrier Probe Tempest HighTemplar")
pylons("0 Mothership Colossus Zealot")

Perl, 212 bytes code + 3 for -p - 10% = 193.5 bytes
I'm sure I can reduce this some more, not happy about the full for$s(...){...} block but I'm done for now!
$x=$_*8;s/^\d+ //;map{for$s(Pr,Ob,Or,C,V,I,A,T,Z,S,H,D,W,Ph,'.+C',N,'.+p$'){$x-=(1,1,3,6,(4)x4,(2)x7,-11,8)[$i++%17]*/^$s/}}/\w+/g;$x=int$x/-8+.9;$s=1<$x&&'s';$_=$x>0?"You must construct $x additional pylon$s!":1

Interesting snippets

Poor mans ceil: int$n+.9 - I tried to use 0| but got what looks like overflow!
List duplication: (9)x9 yields (9,9,9,9,9,9,9,9,9,9)

Usage:
perl -p pylons.pl <<< '3 Mothership Zealot'
1

Thanks to Tim Pederick for helping to save an extra byte!

I believe your "poor man's ceil" only needs to add .9, because the lowest decimal you'll get is 0.125 (1/8).

@TimPederick A good point, I need to save a lot more to be competitive! Might be worth looking into the other bonus for me...

JavaScript (ES6), 228-10% = 206
s=>(s.replace(/\w+/g,x=>t+=~~{Ns:-11,Pe:1,Zt:2,Sy:2,Sr:2,Hr:2,Dr:2,Il:4,Cs:6,An:4,Or:1,Wm:2,Px:2,Me:2,Vy:4,Oe:3,Tt:4,Cr:6,Mp:8}[x[0]+x.slice(-1)]-8*~~x,t=7),t=t/8|0,t<=0||`You must construct ${t} additional pylon${t>1?'s':''}!`)

Test

F=s=>(
  t=7,
  s.replace(/\w+/g,
   x=>t+=~~{Ns:-11,Pe:1,Zt:2,Sy:2,Sr:2,Hr:2,Dr:2,Il:4,Cs:6,An:4,Or:1,Wm:2,Px:2,Me:2,Vy:4,Oe:3,Tt:4,Cr:6,Mp:8}[x[0]+x.slice(-1)]-8*~~x),
  t=t/8|0,
  t<=0||`You must construct ${t} additional pylon${t>1?'s':''}!`
)

console.log=x=>O.textContent+=x+'\n';

;['2 Probe Probe Probe Probe Stalker Zealot Carrier Probe Zealot',
'5 Mothership Carrier Probe Tempest HighTemplar',
'0 Mothership Colossus Zealot','0 Probe Nexus Probe'
].forEach(t=>console.log(t+'\n'+F(t)))

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


text:
Fairy chess "leaper" movement patterns
A leaper is a category of fairy chess piece which moves by "jumping."  A normal knight is a (1,2)-leaper, meaning each move involves moving a distance of 1 square in an orthogonal direction and 2 squares in the perpendicular direction.
.o.o.
o...o
..N..
o...o
.o.o.

There are many different leapers. The (1,3)-leaper is called the Long Knight, or Camel.  Its move pattern looks like this:
..o.o..
.......
o.....o
...L...
o.....o
.......
..o.o..

There's also the (2,2) Alfil...
o...o
.....
..A..
.....
o...o

...and even the (0,1) Wazir.
.o.
oWo
.o.

Challenge
Given a pair of numbers as input, output the corresponding movement diagram.  You may write a program or function, with input provided via STDIN/command-line or as an argument, and output provide by STDOUT or the return value. This is code-golf.
Input
Input will be a comma-separated list of two integers and an uppercase letter.  The two integers will be in the range 0-7 (inclusive) and in non-decreasing order. Trailing newline optional for input and output.
Here are the inputs for the above four examples:
1,2,N
1,3,L
2,2,A
0,1,W

Output
Output will be a square-shaped multiline string.  The capital letter will be placed in the center to represent the current location of the piece.  The movement locations will be represented by either 4 or 8 lowercase os.  All other spaces in the square will be filled with periods.
If the movement pattern is 0,0, output just the capital letter.
As a hint, if the second integer (the larger one) has value N, then the square will always have side length 2N+1.  The os will always be on the perimeter of the square.
Additional Testcases
1,1,F

o.o
.F.
o.o

5,7,Q

..o.........o..
...............
o.............o
...............
...............
...............
...............
.......Q.......
...............
...............
...............
...............
o.............o
...............
..o.........o..

0,0,J

J

Why is the camel testcase letter a 'L'? I know out doesn't matter but it might be helpful to change out to a 'C'.

@RikerW My choice wasn't completely arbitrary, that's its "standardized" letter.

Okay. That makes sense.

For a function, are 3 arguments ok or do you want a single string argument comma separated?

@PhiNotPi where do you get the “standard” code. L is more commonly Bishop in German - and two letter codes are used for the fairy pieces

Ruby,107
->a,b,n{(-b..b).map{|i|s='..'*b+?.
i%b==0&&(i==0?s[b]=n :s[b+a]=s[b-a]=?o)
i.abs==a&&s[0]=s[-1]=?o
puts s}}

Ungolfed in test program
f=->a,b,n{
  (-b..b).map{|i|                           #iterate from -i to i (lines of grit)
    s='..'*b+?.                             #make a string of 2n+1 .'s
    i%b==0&&(i==0?s[b]=n :s[b+a]=s[b-a]=?o) #if i%b=0 plot the centre character (if i=0) or the o's on the top and bottom rows
    i.abs==a&&s[0]=s[-1]=?o                 #if i.abs=a plot the o's in left and right columns
    puts s                                  #having substituted the .'s with o and centre as necessary, output the current line
  }
}

a=gets.to_i
b=gets.to_i
n=gets.chop
f[a,b,n]

Pyth, 40 bytes
JASv<2zFZK+rH_1SHFY,LZKp?qJSY\o?sY\.ez)k

I'm learning Pyth! Try it out.
Explanation
J             J =
 A                (G, H) =
  S                        sorted(
   v<2z                           eval(input[:-2]))

FZK+rH_1SH    for Z in K = [H, H-1, ..., 0] + [1, 2, ..., H]:
  FY,LZK          for Y in [(Z, k) for k in K]:
    p                 print the following value without newline:
     ?qJSY\o              if J = sorted(Y): 'o'
       ?sY\.              if sum(Y) != 0:   '.'
         ez               else:             input[-1]
  )               end for
k                 print newline

JavaScript (ES6), 163 161 145 bytes
(x,y,c,m=a=>`\n`+a.slice(1).reverse().join``+a.join``,a=Array(y+1).fill`.`,q=a.map(_=>[...a]))=>m(q.map(m,q[x][y]=q[y][x]='o',q[0][0]=c)).slice(2)

Where \n is the literal new line character. Works by generating the bottom right quadrant and mirroring it along both axes.
Edit: Saved 2 bytes thanks to @edc65.
(I got here via a duplicate question which allowed an array result which would have been 19 bytes shorter, but didn't guarantee nondecreasing order, which wasted 8 bytes.)

You can save 3 bytes using a template string with no brackets for fill and a literal newline

@edc65 I'd already tried to adjust for the literal newline (I always write "Where \n is the literal new line character" when I do that) but thanks for the other tip.

JavaScript (ES6) 144 150
(a,b,c,g=Array(b-~b).fill`.`)=>(g=g.map(x=>[...g])).map(x=>x.join``,[b-a,b+a].map(t=>g[t][0]=g[0][t]=g[t][2*b]=g[2*b][t]='o'),g[b][b]=c).join`
`

Less golfed
(a,b,c)=> {
  var g=Array(b*2+1).fill('.');
  g=g.map(x=>[...g]);
  var q=(t)=>
    g[t][0] =
    g[0][t] =
    g[t][2*b] =
    g[2*b][t] = 'o';
  q(b+a);
  q(b-a);
  g[b][b] = c;
  return g.map(x=> x.join('')).join('\n')
}

Test

f=(a,b,c,g=Array(b-~b).fill`.`)=>(g=g.map(x=>[...g])).map(x=>x.join``,[b-a,b+a].map(t=>g[t][0]=g[0][t]=g[t][2*b]=g[2*b][t]='o'),g[b][b]=c).join`
`

console.log=x=>O.textContent+=x+'\n'

t=`1,2,N
1,3,L
2,2,A
0,1,W
1,1,F
5,7,Q`.split`\n`
.forEach(t=>([x,y,z]=t.split`,`, console.log(t+'\n'+f(+x,+y,z)+'\n')))


text:
How many ways are there to achieve a winning score in American Football?
[I decided to salvage Ben Reich's question How many unique ways are there to achieve a score in Football? but it ended up being so different that it's only suitable as its own question not spliced into his.]
Challenge: Given a number, calculate how many order-independent ways there are to score that number as a winning football score.
The following ways are possible to score:

Touchdown + kick failure: 6 points
Touchdown + extra point or safety: 7 points
Touchdown + conversion: 8 points
Field goal: 3 points
Safety: two points
Safety during opponent's conversion play: 1 point

Careful how you set this up. You can score ones by the safety play on the end of the list, but arbitrary numbers of ones because each one means your opponent scored six points. This means there is no way to win with a score of 1.
9 as input should return 7

1 touchdown + extra point and 1 safety
1 touchdown + conversion and 1 safety
1 touchdown and 1 field goal
3 field goals
1 field goal and 3 safeties
2 field goals and one safety and one conversion safety
4 safeties and 1 conversion safety

Because the score is less than 13, only 1 1 can be used here. 13-18 allows 2 1s, etc.

Why do you propose this isn't a duplicate of the earlier questions?

@xnor: Changing the constants doesn't work because this time there's a maximum number of something.

I am failing to parse "You can score ones by the safety play on the end of the list, but arbitrary numbers of ones because each one means your opponent scored six points." Can you explain for the benefit of someone who knows nothing about American football?

In order to score a 1, your opponent must have just scored a 6. If they get too many sixes, you don't have a winning score.


text:
Inject Textual Rickrolls
Because rickrolling is the greatest meme on Earth, you [know the rules and so do I] are to write the shortest code that can textually rickroll the unsuspecting reader.  Let [you down] there be an input text which contains letters, punctuation, and spaces.  Anytime a [lie and hurt you] phrase from the first two stanzas appears in the text...
We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

...insert the rest of the line in brackets afterwards.
Input
Input is a single line string containing only printable ASCII with optional trailing newline.
Output
Output is a single-line string.  Any time that a group of words (defined as the input string split on spaces) matches a group of words in lines of the lyrics above, insert the remaining words of the line into the string, grouped in square brackets.
Additional Description:
This is code-golf, fewest bytes wins.  You may write a program or function.

matching should be case insensitive: we're is converted to we're [no strangers to love] even though We're is capitalized in the lyrics.
matching should be greedy.  Does he know the answer? should be converted to Does he know the [rules and so do I] answer? instead of Does he know [the rules and so do I] the [rules and so do I] answer?
If a word appears more than once in the provided lyrics, choose any of the occurrences to complete the line.
If a word is the last word in the lyric line, don't insert anything after it.
Punctuation is included as part of a "word."  I'm is a single word and cannot match with I.  Similarly, you. doesn't match with any lyrics because of the period.

Some words like I appear multiple times throughout the lyrics as well as at the end of a line.  Since the rule is that any occurrence in the above lyrics can be used, and one of those occurrences is at the end of a line, no matching of I is necessary.  The other option for I is [just wanna tell you how I'm feeling].
If two matches overlap, you may choose either one. This means that how I'm thinking could become how I'm [feeling] thinking [of] OR how [I'm feeling] I'm thinking [of] since the I'm could be part of either how I'm or I'm thinking.  If, however the input text was simply I'm thinking, then the output should be I'm thinking [of].
Additional test cases:
I don't know what I'm doing with my life.
is converted to
I [just wanna tell you how I'm feeling] don't know [the rules and so do I] what I'm [thinking of] doing with my life.
Many additional solutions are possible, since words like `I` appear multiple times.

Will someone please save me from these memes?
is converted to
Will someone please save me from [any other guy] these memes?

Two strangers walked into a bar.  One said "hello."  The other said "goodbye."
is converted to
Two strangers [to love] walked into a [lie and hurt you] bar.  One said "hello."  The [rules and so do I] other [guy] said "goodbye."

Challenge inspired by this dude.

ಠ_ಠ

Second test case appears to be wrong (from should become from [any other guy]).

gawk, 316+377 = 693
First command line parameter is the lyrics' filename (375 bytes + 2 for invocation = 377). Rickrolls all other files. Prints to stdout.
BEGIN{FPAT="[^ ]+ *";OFS=""}func d(a){b=tolower(a);sub(/ *$/,"",b);return b}FNR==NR{for(s=$0;NF;$0=s=$0){for(i=1;i<NF;i++){k=k $i;$i="";v[d(k)]="["$0"] "}$0=s;k=$1=""}next}{for(s=$0;NF;$0=s=$0){for(j=NF;(--j)>0&&!(d($0) in v);$(j+1)="");k=v[d($0)];if($0!~/ $/)k=" "k;printf($0 k);for($0=s;j-->=0;$(j+2)="");}print""}

Ungolfed
BEGIN{FPAT="[^ ]+ *";OFS=""}
func d(a){b=tolower(a);sub(/ *$/,"",b);return b}
FNR==NR{
  for(s=$0;NF;$0=s=$0){
    for(i=1;i<NF;i++)
    {
      k=k $i;
      $i="";
      v[d(k)]="["$0"] "
    }
    $0=s;
    k=$1=""
  }
  next
}
{
  for(s=$0;NF;$0=s=$0){
    for(j=NF;(--j)>0&&!(d($0) in v);$(j+1)="");
    k=v[d($0)];
    if($0!~/ $/)k=" "k;
    printf($0 k);
    for($0=s;j-->=0;$(j+2)="");
  }
  print""
}

Test results
Input:
we're
We're
Does he know the answer?
I
how I'm thinking
I'm thinking
I don't know what I'm doing with my life.
Will someone please save me from these memes?
Two strangers walked into a bar.  One said "hello."  The other said "goodbye."
gonna run

Output:
we're [no strangers to love]
We're [no strangers to love]
Does he know the [rules and so do I] answer?
I [just wanna tell you how I'm feeling]
how I'm [feeling] thinking [of]
I'm thinking [of]
I [just wanna tell you how I'm feeling] don't know [the rules and so do I] what I'm [thinking of] doing with my life.
Will someone please save me from [any other guy] these memes?
Two strangers [to love] walked into a [lie and hurt you] bar.  One said "hello."  The [rules and so do I] other [guy] said "goodbye."
gonna run [around and desert you]

This fails the first test case (it puts things between what and I'm, which is "non-greedy" matching). 2. This fails the third test case (it turns the two spaces into one). 3. If you store the lyrics in a separate file, you need to count that file (as well as +2 for including it in the awk command) in your byte count.

@Doorknob Thanks. The greed is fixed. The lyrics file does not add to my character count since it is unaltered and was publicly available before the challenge started.  I don't count awk's source code either.

Now this fails for the input gonna run (expected output gonna run [around and desert you], actual output gonna [tell a lie and hurt you] run [around and desert you]). It also still chomps multiple spaces in a row. You need to count the lyrics file in your byte count, as it's a non-standard invocation of the awk program.

@Doorknob Ok. I reimplemented most of the program and require gawk now for space-preserving field separation. Passes all test cases now.

Impressive. It was very difficult to cover all the edge cases in this challenge.


text:
Format a list of words
Your challenge is to format a list of words across multiple lines that are no longer than a given number of characters, so that each line contains as many words as possible and no words are unnecessarily cut off.
Input
The input will be a space-separated list of words and then a number that is at least 4.
Output
The output should be the input words grouped into lines so that none of the lines contains more characters than the input number. The words should be output in the order they were input. The words should be separated by a comma and then a space, except at the end of each line, where the space isn't needed. If a word is too long to fit on a line, it should be cut off as little as possible while following the other rules, and "..." should be added to the end.
Test cases
Input:
foo bar baz qux 12

Output:
foo, bar,
baz, qux

Input:
foo bar baz qux 5

Output:
foo,
bar,
baz,
qux

Input:
strength dexterity constitution intelligence wisdom charisma 10

Output:
strength,
dexterity,
consti...,
intell...,
wisdom,
charisma

Input:
quas wex exort 4

Output:
...,
wex,
e...

Glorious Invocation!

Related

Unreadable, 2559 bytes
This challenge is eerily suited for Unreadable.
The first version of this was 3379 bytes, just to give you an idea of how much I golfed this.
The program accepts the input exactly as described in the challenge: a space-separated list of words (which may contain digits and punctuation marks, too), followed by a space and an integer that is at least 4 (lower numbers generate infinite loops).

'""""""'""""""""'"""'""'""'""'""'""'""'"""'"""""'""'""""""'""'"""'""""""""""'""""""'""""""'""""""""'"""'""'"""""""'""""""""'"""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'"""""""'""'"""'"""""'"""""""'""""""'""""""""'"""'""""""""'"""""""'""""""""'"""'"""'"""""'"""""""'""""""'""""""""'"""'""'"""""""'""""""""'"""'""""'""""'""""""'""'"""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'""""""""'"""'"""""'""'""""""'""'""'"""'""""""""'"""""""'""'""'"""'""""""'""'"""'""'""'""'""'""'""'""'""'""'""'"""""""'""'"""'""""""'""'""'"""'"""""'""""""'"""""""'""""""""'"""'""""""""'"""""""'"""""""'""""""""'"""'""""""'""'"""'""'"""""""'""'"""'"""""'""""""'""'"""'""""""""'"""""""'""'"""'""""""'""""""'"""'""""""""'"""""""'"""'"""'""""""'""'""'""'""'"""'""'""'""'""'""'""'""'""'""'""'""'""'""""""'""'""'""'""'""'"""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""""""'""'""'"""'""'""'""'""""""'""""""""'"""'""'""'""'""'""'""'""""""'"""'"""'"""""'"""""""'""'"""""""'""""""""'"""'""""'""""'""""'"""""'"""""""'""""""'""""""""'"""'""'"""""""'""""""""'"""'""""""'"""'""""""""'"""""""'"""'"""""""""'""""""'""'"""'"""""""'""'"""""""'""""""""'"""'""""""'"""'""""""""'"""""""'"""'"""'"""""'"""""""'""""""'""""""""'"""'""""""""'"""""""'""""""""'"""'"""'""""""'""'""'""'"""'"""""""""'"""""""'"""""""""'"""""""'""'""'""'"""'""""""'"""'""""""""'"""""""'"""'"""""""'"""'""""'""""'"""""""""'"""""""'""'""'""'"""'"'"""""""'""'""'""'""'""'"""'"""'"""""'"""""""'""""""'""""""""'"""'""'"""""""'""""""""'"""'"'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'"""""""'"""""""'""""""""'"""'"""""""""'"""""""'""'"""'"'"""""""'""'""'""'""'"""'"""'""""'""""'"""""""""'"""""""'""'""'""'"""'"""'""""'""""'""""'""""'"""""'""""""""'"""""""'""""""'"""'""'"""""""'"""'"""'"""""""""'"""""""'""'"""'""""""'"""'""'"""""""'"""'"""'"""""'""'""""""'"""'""'"""""""'"""'"'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'""'"""""""'""""""'""""""""'"""'""'"""""""'""""""""'"""'"'"'"'"""""'"""""""'""""""'""""""""'"""'""'"""""""'""""""""'"""'""'""'"""""""'""'""'""'""'"""'"""""""""'"""""""'""'"""'"'"""""""'""'""'""'""'"""'"""'"'"""""""'""'""'"""'""""""""'""""""'"""'"""

Explanation
I’m going to walk you through how the program processes the input thyme horseradish peppermint 10. The expected output is thyme,\nhorser...,\npeppermint.
First we start at cell #7 and read the entire input, but subtract 32 from every character so that spaces become zeros.

For obvious reasons, this leaves the running pointer (named p here, stored in cell #0) at the end. We use one while loop to find the last gap, which is the beginning of the number that defines the width of the output (cell #36 in this example).
We now want to decode the number (i.e. convert from decimal). The final result will be in both cells t and r. We rely on the fact that they start out at zero.
For every digit in the number, do the following:

Set t to −15.
In a while loop, decrement r (which contains the result so far) to −1 (because we need exactly r iterations, but since the decrement happens before it is checked as the while loop’s condition, decrementing to 0 would give one fewer iterations) and for each iteration, add 10 to t. Now t contains 10 times the previous result minus 15.
Again in a while loop, decrement *p to 0 and for each iteration, add 1 to t. After this t contains the correct intermediate result so far: the characters '0' to '9' have ASCII codes 48–57, so after the earlier subtraction of 32 they are 16–25, so we actually add 15–24 to t, which cancels with the −15 we set it to earlier. It is also important that this zeroes the cells that used to contain the digit characters so that the subsequent code can recognize the end of the list of words.
Set r to the new intermediate result so that the next iteration finds it in r. (Note we do not need to read from t again, we can just use the last value from the previous while loop because we know that *p can’t be zero, so it has run at least once.)

Finally, we use another simple while loop (decrementing t as the counter) to convert the number we just calculated into unary. We store a string of 1s going leftwards from cell #0. This relies on the fact that cell #1, our running pointer for this (q), starts out at 0. We get one fewer 1s because while loops in Unreadable are like that:

After this, we no longer need the value in r, so we re-use that cell for something else. We reset the pointers p and q and initialize some cells with ASCII codes of characters we need later. I’ve also labeled c and s which we will use later, and we will rely on the fact that s starts out at zero:

Hey, wait a minute. Why is cell #0 colored red?... Well, this is to highlight a sneaky trick. Remember we output one 1 too few? The trick is that we use the cell #0 as an “extension” to correct for that. This works because we know that p will never be 0. This way, the red block is now 10 cells wide, exactly the number we want. It also saves 9 characters to be able to initialize q to 1 instead of 0.
Now we enter the while loop that goes through the words and outputs them all.
Step 1: Find out whether the next word will fit into the current line. We do this by simply moving p to the right and q left with a while loop until p hits the next gap:

Now that p is on the right of the word, we can check whether this is the last word in the list by checking if *(p+1) is zero. We also store that value (which in our example is 72 because it’s the “h” from “horseradish” minus 32) in c because we’ll need it again later. In this case, it isn’t zero, so we will need to output a comma along with the word, so the word is one character longer. Take account of this by decrementing q one more time. Finally, use another while loop to move p back to the beginning of the word.

We now know that the word will fit into the current line because q is pointing at a non-zero value, so all we have to do is:

Move p forward through the word again, printing each character (plus 32, because all the ASCII codes are off by 32).
If c is non-zero, print a comma (using the value in cell #5).
Set s to a non-zero value to indicate to the next iteration that we are no longer at the beginning of a line and therefore need to output a space character before the next word. (We re-use the return value of the above print statement for this, which is 44 for the comma.)

Output so far: thyme,
Then the next iteration of the big loop starts. As before, we check whether the next word fits into the rest of the line by decrementing q as we go through the word from left to right. Note that q is still −5 from the previous iteration, keeping track of how many characters we’ve already printed in the current line. After counting the characters in “horseradish”, plus one for the comma, plus one because s is non-zero indicating that we need to output a space as well, q will have overshot the end of the block of 1s:

Now q points at a zero cell, which means that “horseradish” will not fit into the current line. What we do now depends on whether s is non-zero. In our case it is, which means we need to wrap to the next line. All we have to do for that is:

Print a newline (using cell #3)
Set q back to 1
Set s to 0

Output so far: thyme,\n

For the next iteration, p is in the same place as before, so we will be looking at the same word again. As before, we count the characters in “horseradish”, set c to 80 again when we notice there’s another word after this one, decrement q for the comma, and rewind p back to the beginning of the word:

As in the previous iteration, we find that “horseradish” still doesn’t fit because q ends up on a cell that is zero. However, this time s is zero, which means we do something different than last time. We need to output some of the word, three dots and a comma. Our width is 10, so we need to output 6 characters of the word. Let’s see where we end up if we:

Find the beginning of the red block of 1s. We can do this by going right because we know that q must be left of it.
Increment q once more if we also need to output a comma (c ≠ 0).

The tape now looks like this:

I’ve marked a span of 6 cells here. As you can see, we need to output characters until q = −1. This is very code-efficient to check (basically, while ((++q)+1) { ... }). So:

Print those characters (plus 32, because all the ASCII codes are off by 32) until q reaches −1. p will then be at cell 19, in the middle of the word “horseradish”.
Print three dots. Since the print command returns its own argument, we can code-efficiently nest it (essentially, print(print(print('.')))). We take the ASCII value from cell #5 and add 2 to it to get the ASCII code of the dot.
Move p to the end of the word. Since we know we can’t have already reached the end of the word (because the word was too long, and we had to remove at least 3 characters from it to fit the dots), this loop definitely has at least one iteration, so it’s shorter in code to have the body of the while loop calculate the ASCII value for the dot and then pass the return value of the while loop to the print functions.
Print a comma if c is non-zero.

After all of this, we also print a newline (using cell #3) and set q back to 1. We can also set s to 0 even though it’s already 0, which makes this the same that we did previously when we wrapped to the next line (when s was non-zero), so to avoid repeating the code, we do it after the conditional that checks s.
Output so far: thyme,\nhorser...,\n
There is only one iteration left. This time, after counting the letters of the word, we get this:

This time, there is nothing after p, so we set c to 0 to indicate “no comma”, and accordingly we do not decrement q a further time. Since q now points at a non-zero cell, we know the word will fit, so the same code is executed as in the first iteration, except that this time c is zero, so it will simply not print the comma.
Output: thyme,\nhorser...,\npeppermint
In this walkthrough I did not include a case where the code would actually print a space, but I think it should be fairly clear now. If the code finds that the word fits (*q ≠ 0) and s is non-zero, it will simply output a space before the word.

JavaScript (ES6), 171
As an anonymous function returning the output as an array
(as this is generally allowed unless explicitly forbidden: meta meta)
s=>(s=s.split` `,n=s.pop()-1,t='',o=[],s.map((w,i)=>(w=w[n+=!s[i+1]]?w.slice(0,n-3)+'...':w,(t+w)[n-2]&&(t&&o.push(t.slice(1)),t=''),t+=` ${w},`)),o.push(t.slice(1,-1)),o)

f=s=>(s=s.split` `,n=s.pop()-1,t='',o=[],s.map((w,i)=>(w=w[n+=!s[i+1]]?w.slice(0,n-3)+'...':w,(t+w)[n-2]&&(t&&o.push(t.slice(1)),t=''),t+=` ${w},`)),o.push(t.slice(1,-1)),o)

// Less golfed
U=s=>(
  s=s.split` `,
  n=s.pop()-1,
  t='', // current line
  o=[], // output
  s.map( (w,i)=>(
    w=w[
      n+=!s[i+1] // space for 1 more char on the last line
    ]?w.slice(0,n-3)+'...':w, // change w if it is too long
    (t+w)[n-2]&& ( // if current line + w is too long, ouput t and reset current line
      t&&o.push(t.slice(1)),t=''
    ),
    t+=` ${w},`
  )),
  o.push(t.slice(1,-1)), // remove tailing comma on last line
  o
)

console.log=x=>O.textContent+=x+'\n\n';

console.log(f("foo bar baz qux 12").join`\n`)
console.log(f("foo bar baz qux 5").join`\n`)
console.log(f("strength dexterity constitution intelligence wisdom charisma 10").join`\n`)
console.log(f("quas wex exort 4").join`\n`)

Python 2, 206 bytes
i=input().split()
l=int(i.pop())
i=[[w[:l-4]+'...',w][len(w)<l]+','for w in i][:-1]+[[w,w[:l-3]+'...'][len(w)>l]]
r=[i.pop(0)]
for w in i:
 if len(r[-1])+len(w)<l:r[-1]+=' '+w
 else:r+=[w]
print'\n'.join(r)


text:
Triangular Grids: Simply Connected Polyiamonds
While we're on a triangular grids kick, I'd like to point out that there is an equivalent to polyominoes on a triangular grid. They are called polyiamonds, and they are shapes formed by gluing equilateral triangles together along their edges. In this challenge you are going to be deciding which subsets of a triangular grid are polyiamonds, and whether they have holes in them. Because it only takes 9 triangles to make a polyiamond with a hole in it, your code needs to be as short as possible.
The grid
We'll use Martin's triangular grid layout for the input:

Pay attention to the fact that the centers of the triangles form a roughly rectangular grid and that the top left triangle "points" upward. We can describe a subset of this grid, then, by giving a rectangular "star map" indicating which triangles are included and which are not included. For instance, this map:
** **
*****

corresponds to the smallest polyiamond which contains a hole:

Holes
A polyiamond which contains a hole like the example above (a region not a part of the polyiamond, which is surrounded on all sides by regions which are) is not, topologically speaking, simply connected.
The Challenge
Write a function or program which takes as input a "star map" as described above and output a truthy if and only if the indicated subset of the triangular grid is a simply connected polyiamond.
More Examples
*** ***
*******

corresponds to the polyiamond

which is simply connected.

*   *
** **
 ***

corresponds to the polyiamond

which is simply connected.

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

corresponds to the non-polyiamond

which would not be simply connected even if it were a polyiamond.
Input Spec

The input will consist only of asterisks, spaces, and line feeds.
The first character of input will always be a space or asterisk (corresponding to the upward pointing triangle in the top left corner of the grid).
There will always be at least one asterisk on the first and last lines.
There is NO guarantee that lines after the first line won't be empty. Two linefeeds in a row may appear in a legitimate input.
Line lengths need not all be the same.

Winning Condition
This is code-golf, so shortest answer in bytes wins.
Test Cases
Truthy maps:
1) *

2) *
   *

3) **

4) *** ***
   *******

5) *   *
   ** **
    ***

6) *
   **
    *

7)    **
     ***
   ****

8) ****
   **   *
    *****

9) ***********
   **    **  **
    ****  **  **
              **
   ************

Falsy maps:
1) *
   *
   *

2) * *

3) *
    *

4)  **
   **

5) ***

   ***

6) ** **
   *****

7) **  **
   *** **
    ****

8)  *
    *

9) *****
   **   *
    *****

nice question. If triangular grids are going to become a thing, may I suggest that they be represented as for example AV VA\nVAVAV instead of ** **\n*****as it makes it easier for a human to visualize. I already made an edit to one of Martin's ASCII diagrams.

I wasnt particularly concerned with human readability, no. I wanted to do whatever would be easier for a program to read while remaining small.

So basically, false iff there is a section only "connected" by corners?

Or if there are parts which are not connected at all.  Martin put it this way: True iff the figure and ground are both connected along edges, so that 2 flood-fills are sufficient to recolor the plane.

Snails, 95 bytes
F&
lr|=((ul.)2 ,l~a~)d|!((ul.)2 ,l~a~)u}\*}+l\ ,~a~|{\ (lr|=((ul.)2 ,l~a~)d|!((ul.)2 ,l~a~)u}+~

This really suffered from duplication, as I haven't implemented macros or any kind of back-reference. What it does is to check that for each star, there exists a path to the leftmost star on the top line; and for each space, there is a path to an edge of the grid.
F&                         ,, option F: pad lines with spaces to the length of the longest
                           ,, option &: print 1 iff match succeeds from every cell
lr                         ,, direction left or right, or
      | =((ul.)2 ,l~a~) d  ,, direction down, if we are an even number of orthogonal moves from the top left
      | !((ul.)2 ,l~a~) u  ,, or, direction up if we are odd number of moves from the top left
    }  \*                  ,, literal '*'
}+                         ,, 1 or more times
l\ ,~a~                    ,, check that we are on the leftmost * in the top line

|                          ,, the part before this is for starting on '*'; part after for starting on ' '

{ \                        ,, literal ' '
    (   lr                 ,, direction left or right, or
      | =((ul.)2 ,l~a~) d  ,, same drill as before...
      | !((ul.)2 ,l~a~) u
}+                         ,, 1 or more times
~                          ,, end on an out of bounds cell

I don't understand how it works, but it totally works.

CJam, 101 98 bytes
qN/_z,f{' e]}{S2*f+W%z}4*:eeee::f+:~{_(aL{+_{_2,.+1$2,.-@_:+1&!2*(a.+}%2${a1$&},\;@1$-@@}h;\;-}2*!

Try it online.
I finally overcame my fear of implementing a flood fill in CJam. It's about as ugly as I expected, and it can most definitely be golfed.
The general idea is to perform two flood-fills (which are actually implemented as removals from the list of unvisited cells). The first pass will remove all spaces that are reachable from the edge. The second pass will then pick the first * in reading order and remove all the triangles reachable from that. If and only if the resulting list is empty, the polyiamond was simply connected:

If the polyiamond had a hole, the first flood fill is unable to reach and remove that hole.
If the input consists of several disconnected polyiamonds, the second flood fill is unable to reach and remove all of them.


text:
Tokenize a Stack-Based language
I've been working on another stack-based golfing language called Stackgoat. In this challenge you'll  be writing a Tokenizer for Stackgoat (or really any general stack-based languages).
Examples
"PPCG"23+
["PPCG", '23', '+']

'a "bc" +
['"a"', '"bc"', '+']

12 34+-"abc\"de'fg\\"
['12', '34', '+', '-', '"abc\"de'fg\\"']

"foo
['"foo"']

(empty input)
[]

' ""
['" "', '""']

Specification
The three types you'll need to handle are:

Strings, anything within ""
Numbers, any sequence of digits
Operators, any other single character besides whitespace

Whitespace is essentially ignored unless it is within a string or separates two numbers.
String / char spec:

Strings are delimited by a ", and when  a \ is encountered, the next character should be escaped.
Chars are prepended by a ' and the character after the ' should be converted into a string literal. 'a -> "a"
' will always have a character after it
Closing quotes should be auto-inserted

Rules:

No form of eval is allowed

Input / Output:

Input can be taken through STDIN, function parameters, or your language's equivalent.
Output should be an array or your language's closest equivalent.

@Doorknob, seriously?

@LegionMammal978 Yes, seriously.

Can output be to STDOUT?

@Doorknob yes, of course

Is -15 a) ['-', '15'] or b) ['-15']?

@MartinBüttner for the simplicity of this challenge. -15 is ['-', '15']

Can the input contain linefeeds? If so, what other whitespace can it contain?

Any empty string in the test cases would also be good.

@MartinBüttner yes, the input may contain linefeeds. It may also include carriage returns, line feeds, tabs, and form feeds

@Doᴡɴɢᴏᴀᴛ I meant an empty string in the code, but an empty input is good too. Also an empty, unclosed string at the end would be a good test case.

Also ' followed by whitespace.

What is 1.5? ['1', '.', '5']?

Could you fix the syntax of example 3? Something is mismatched or not escaped correctly.

@ZachGates Everything is escaped properly :) It might be the \ or the " that's throwing off your program

Entering '"abc\"de'fg\\"' directly, fails for me. The single quote between de and fg should be escaped. @Doᴡɴɢᴏᴀᴛ

@ZachGates Well yes, most languages do handle \ as an escape character too, so yes, you will need to escape that if your language needs it obviously.

Here's my submission

Are hexadecimal digits allowed in the numbers?

Also, in the first example, should the first element of the result be '"PPCG"' instead of just "PPCG"?

Lastly, can the output use double-quotes, and escape any double-quotes inside, or does it have to be wrapped in single-quotes?

what can be escaped? just "? or do we have to support \n etc.

Retina, 68 64 63 bytes
M!s`"(\\.|[^"])*"?|'.|\d+|\S
ms`^'(.)|^"(([^\\"]|\\.)*$)
"$1$2"

or
s`\s*((")(\\.|[^"])*(?<-2>")?|'.|\d+|.)\s*
$1$2¶
\ms`^'(.)
"$1"

I think this covers all the funky edge cases, even those not covered by the test cases in the challenge.
Try it online!

Dang, this is short. Nicely done!

I was able to translate this into a 95 byte ES6 function. It would have been 80 except that the regexps don't work the other way around (too many edge cases).

Ruby, 234 bytes
puts"[#{$stdin.read.scan(/("(?:(?<!\\)\\"|[^"])+(?:"|$))|'(.)|(\d+)|(.)/).map{|m|(m[0]?(m[0].end_with?('"')?m[0]: m[0]+'"'): m[1]?"\"#{m[1]}\"": m.compact[0]).strip}.reject(&:empty?).map{|i|"'#{/\d+|./=~i ?i: i.inspect}'"}.join', '}]"

I tried using the find(&:itself) trick that I saw... somewhere, but apparently .itself isn't actually a method. Also, I'm working on golfing the regex down, but it's already unreadable.
If we don't have to output in any fancy way (i.e. strings don't have to be quoted in the array) I can save a whole lotta bytes:
Still Ruby, 194 bytes:
p$stdin.read.scan(/("(?:(?<!\\)\\"|[^"])+(?:"|$))|'(.)|(\d+)|(.)/).map{|m|(m[0]?(m[0].end_with?('"')?m[0]: m[0]+'"').gsub(/\\(.)/,'\1'): m[1]?"\"#{m[1]}\"": m.compact[0]).strip}.reject(&:empty?)

I'm sure I can golf it more, but I'm not quite sure how.

Ungolfed coming soon. I started fiddling with the golfed directly at some point and I'll have to tease it out.

Python 3, 228 bytes
import re;L=list
print(L(map(lambda i:i+'"'if i[0]=='"'and not i[-1]=='"'else i,map(lambda i:'"%s"'%i[1]if i[0]=="'"else i,filter(None,sum([L(i)for i in re.findall('(\'.)|(".*")|(\d+)|([^\w\"\'\s\\\])|(".*"?)',input())],[]))))))

Here's a nice, long, two-liner.

Test it out in Python 3. Here's some examples:
$ python3 test.py
"PPCG"23+
['"PPCG"', '23', '+']

$ python3 test.py
'a "bc" +
['"a"', '"bc"', '+']

$ python3 test.py
12 34+-"abc"de'fg\"
['12', '34', '+', '-', '"abc"de\'fg\\"']

$ python3 test.py
"foo
['"foo"']

$ python3 test.py

[]

$ python3 test.py
' ""
['" "', '""']


text:
Flip It, Flop It, Mean It
Overview
Given an image in plain PPM (P3) format as input, for each pixel p in the image, replace each of the following 4 pixels' red, green, and blue with the floored average value of the respective channels of all 4 pixels:

p itself
The pixel located at p's location when the image is flipped vertically
The pixel located at p's location when the image is flipped horizontally
The pixel located at p's location when the image is flipped both vertically and horizontally

Output the resulting image in plain PPM (P3) format.
For further explanation, consider this 8x8 image, magnified to 128x128:

Let p be the red pixel. To calculate the new value for p (and the 3 blue pixels), the values of p and the 3 blue pixels will be averaged together:
p1 = (255, 0, 0)
p2 = (0, 0, 255)
p3 = (0, 0, 255)
p4 = (0, 0, 255)
p_result = (63, 0, 191)

Examples

PPM:
input,
output

PPM:
input,
output

PPM:
input,
output

PPM:
input,
output

Reference Implementation
#!/usr/bin/python

import sys
from itertools import *

def grouper(iterable, n, fillvalue=None):
    args = [iter(iterable)] * n
    return list(izip_longest(*args, fillvalue=fillvalue))

def flatten(lst):
    return sum(([x] if not isinstance(x, list) else flatten(x) for x in lst), [])

def pnm_to_bin(p):
    w,h = map(int,p[1].split(' '))
    data = map(int, ' '.join(p[3:]).replace('\n', ' ').split())
    bin = []
    lines = grouper(data, w*3)
    for line in lines:
        data = []
        for rgb in grouper(line, 3):
            data.append(list(rgb))
        bin.append(data)
    return bin

def bin_to_pnm(b):
    pnm = 'P3 {} {} 255 '.format(len(b[0]), len(b))
    b = flatten(b)
    pnm += ' '.join(map(str, b))
    return pnm

def imageblender(img):
    h = len(img)
    w = len(img[0])
    for y in range(w):
        for x in range(h):
            for i in range(3):
                val = (img[x][y][i] + img[x][~y][i] + img[~x][y][i] + img[~x][~y][i])//4
                img[x][y][i],img[x][~y][i],img[~x][y][i],img[~x][~y][i] = (val,)*4
    return img

def main(fname):
    bin = pnm_to_bin(open(fname).read().split('\n'))
    bin = imageblender(bin)
    return bin_to_pnm(bin)

if __name__ == '__main__':
    print main(sys.argv[1])

This program takes a single filename as input, formatted like the output of pngtopnm <pngfile> -plain, and outputs a single line of PPM data separated by spaces.

A Brief Description of the P3 Format
A PPM plaintext file generated from pngtopnm <pngfile> -plain will look like this:
P3
<width in pixels> <height in pixels>
<maximum value as defined by the bit depth, always 255 for our purposes>
<leftmost 24 pixels of row 1, in RGB triples, space-separated; like (0 0 0 1 1 1 ...)>
<next 24 pixels of row 1>
<...>
<rightmost (up to) 24 pixels of row 1>

<leftmost 24 pixels of row 2>
<next 24 pixels of row 2>
<...>
<rightmost (up to) 24 pixels of row 2>

<...>

This is the format that the example input and output files use. However, PNM is very loose about its formatting - any whitespace may separate values. You could replace all newlines in the above file with a single space each, and still have a valid file. For example, this file and this file are both valid, and represent the same image. The only other requirements are that the file must end with a trailing newline, and there must be width*height RGB triplets following the 255.

Rules

This is code-golf, so the shortest valid solution wins.
You may input and output PPM data formatted in any convenient and consistent manner, so long as it is valid according to the PPM format described above. The only exception is that you must use the plain (P3) format, and not the binary (P6) format.
You must provide verification that your solution outputs the correct images for the above test images.
All images will have a bit-depth of 8 bits.

Extra reading: Netpbm format wikipedia page

Testing Snippet (thanks to Calvin's Hobbies for this)

function loadImage(t){if(t.files&&t.files[0]){var i=new FileReader;i.onload=function(t){function i(t){t.attr("width",img.width),t.width=img.width,t.attr("height",img.height),t.height=img.height;var i=t[0].getContext("2d");return i}img=$("").attr("src",t.target.result)[0],ctxIn=i($("#input")),ctxIn.drawImage(img,0,0),ctxOut=i($("#output")),go()},i.readAsDataURL(t.files[0])}}function getPixel(t,i){return ctxIn.getImageData(t,i,1,1).data}function setPixel(t,i,e){ctxOut.fillStyle="rgb("+e[0]+","+e[1]+","+e[2]+")",ctxOut.fillRect(t,i,1,1)}function go(){if(void 0!==ctxOut)for(var t=0;t<img.width;t++)for(var i=0;i<img.height;i++){for(var e=new Array(3),g=getPixel(t,i),a=getPixel(img.width-t-1,i),r=getPixel(t,img.height-i-1),n=getPixel(img.width-t-1,img.height-i-1),h=0;h<e.length;h++)e[h]=Math.floor((g[h]+a[h]+r[h]+n[h])/4);setPixel(t,i,e)}}var img,ctxIn,ctxOut;
* {
    font-size: 100%;
    font-family: Arial, sans-serif;
}

Warning - runs very slowly on large images! 300x300 pixel maximum advised.

<canvas id='input'>Your browser doesn't support the HTML5 canvas tag.</canvas>

Load an image: <input type='file' onchange='loadImage(this)'>

<canvas id='output'>Your browser doesn't support the HTML5 canvas tag.</canvas>

Are image libraries that open/save ppm files allowed?

@Calvin'sHobbies Yes

"Flip it, flop it, average it" https://www.youtube.com/watch?v=D8K90hX4PrE

Maybe "Flip it, flop it, mean it"?

Some more fun: http://imgur.com/a/Um68Z

@CᴏɴᴏʀO'Bʀɪᴇɴ That sounds like some party anth- oh, wait, what Luis posted.

@Mego http://i.imgur.com/Zc4787o.png I always knew the glider and the hive are related.

Twist it, bop it?

Pyth, 30 29 bytes
zjms.OdC.nM[JrR7.zKm_cd3J_J_K

My program expects all metadata on the first line, and the image data row by row on the lines after on stdin. To help, this is a small Python program to convert any valid PPM file into a PPM file my program can understand:
import sys
p3, w, h, d, *data = sys.stdin.read().split()
print(p3, w, h, d)
for i in range(0, int(w) * int(h), int(w)):
    print(" ".join(data[i:i+int(w)]))

Once you have the image data row by row the operations are really simple. First I read the image data into a list of lists of integers (JrR7.z), then I create the horizontally mirrored version by grouping every 3 integers and reversing them for every row (Km_cd3J). Then the vertically mirrored versions are simply _J_K, since we can just reverse rows.
I take all those matrices, flatten each of them into an 1d array with .nM, transpose with C to get a list of lists of each of the pixel components, average and truncate to int each of those lists (ms.Od), and finally print joined by newlines j.
Note that my program generates output in a different format (but still valid PPM). The demo images can be viewed in this imgur album.

Bash (+ImageMagick), 64+1 = 65 bytes
C=convert;$C a -flip b;$C a -flop c;$C c -flip d;$C * -average e

Right tool for the job.
Must be run in a directory containing a single file a that contains the PPM data to transform. Since this filename is significant, I've added one byte to the byte count.
PNG thumbnail outputs (not sure why this is necessary because they're all the same anyway, but the question says so, so...):

Thanks to nneonneo for saving 2 bytes!

I require the outputs because people have a bad habit of posting solutions without testing them. +1 for -flop, I really want to be surprised that it is a flag.

Shave off 2 bytes by using C=convert and $C instead of alias.

Matlab, 106 82 80 bytes
i=imread(input(''))/4;for k=1:2;i=i+flipdim(i,k);end;imwrite(i,'p3.pnm','e','A')

The image is loaded as n*m*3 matrix. Then we flip the matrix  and added to itself for both axis, and write it again to a file.

I couldn't find a place to upload text files so big, so here are the PNG versions:

Omg, I didn't even know you could use <img tags!

In MATLAB R2013b and newer it is possible to use flip instead of flipdim. That should save you 3 more bytes. flipdim's help actually says: "flipdim will be removed in a future release. Use FLIP instead."

Mathematica, 86 84 bytes
Thanks to DavidC for the advice. (saves 2 bytes)
Export[#2,⌊Mean@Join[#,(r=Reverse)/@#]&@{#,r/@#}&@Import[#,"Data"]⌋~Image~"Byte"]&

The first and second parameters are the paths to the input and output images, respectively.

Test cases
f=%; (assign the function to symbol f)
f["penguin.pnm","penguin2.pnm"]
f["quintopia.pnm","quintopia2.pnm"]
f["peter.pnm","peter2.pnm"]

Result
(PNG versions of the images are uploaded below)
Import["penguin2.pnm"]

Import["quintopia2.pnm"]

Import["peter2.pnm"]

Join[#,(r=Reverse)/@#]

Julia, 157 bytes
using FileIO
s->(a=load(s);b=deepcopy(a);d=a.data;(n,m)=size(d);for i=1:n,j=1:m b.data[i,j]=mean([d[i,j];d[n-i+1,j];d[i,m-j+1];d[n-i+1,m-j+1]])end;save(s,b))

This is a lambda function that accepts a string containing the full path to a PPM file and overwrites it with the transformed image. To call it, assign it to a variable.
Ungolfed:
using FileIO

function f(s::AbstractString)
    # Load the input image
    a = load(s)

    # Create a copy (overwriting does bad things)
    b = deepcopy(a)

    # Extract the matrix of RGB triples from the input
    d = a.data

    # Store the size of the matrix
    n, m = size(d)

    # Apply the transformation
    # Note that we don't floor the mean; this is because the RGB values
    # aren't stored as integers, they're fixed point values in [0,1].
    # Simply taking the mean produces the desired output.
    for i = 1:n, j = 1:m
        b.data[i,j] = mean([d[i,j]; d[n-i+1,j]; d[i,m-j+1]; d[n-i+1,m-j+1]])
    end

    # Overwrite the input
    save(s, b)
end

Example outputs:

python 2+PIL, 268
Now I massively use PIL, using image flipping and alpha blending
from PIL import Image
I=Image
B,T=I.blend,I.FLIP_TOP_BOTTOM
a=I.open(raw_input()).convert('RGB')
exec'b=a@I.FLIP_LEFT_RIGHT);c=a@T);d=b@T)'.replace('@','.transpose(')
x,y=a.size
print'P3',x,y,255
for r,g,b in list(B(B(B(a,b,0.5),c,0.25),d,0.25).getdata()):print r,g,b

Resulting images are available here

Please include the outputs for the test cases, as required by the rules.


text:
Partitioning reciprocals
Given a number n > 77, write a program or function that finds a set of distinct positive integers such that the sum of the set equals n, and the sum of the reciprocals of the set equals 1.
Example for 80:

80 = 2 + 4 + 10 + 15 + 21 + 28    ⟶
  1/2 + 1/4 + 1/10 + 1/15 + 1/21 + 1/28 = 1

Your program or function must (theoretically) work for any n < 232, and is not excused for floating point rounding errors. Note that solutions exist for all n > 77.

Shortest code in bytes wins.
There is a bonus incentive: I will award a bounty to the smallest solution that works for any n and runs log(n). For small n it must be fast (determined at my discretion). Yes, this is possible.

Is such decomposition always guaranteed to exist? Any number-theoretic theorem that assures that?

It seems that there is for all n>77. (I did not check every detail.) That should have been in the description of your challenge...

@flawr, I presume that he didn't include that reference because it gives away the O(log n) algorithm.

Still he should have mentioned that this set exists for the given n. (And I found that paper on the first page when googling the title.)

@flawr, it took me about 10 minutes to find it. I got to it via a page on Egyptian fractions, and you ninja'd me by 10 seconds.

Do the numbers have to be whole numbers?

@proudhaskeller Yes.

@flawr http://chat.stackexchange.com/transcript/message/26728918#26728918

If there are multiple solutions for a given n, can we return all of them?

@nimi Please just return only one solution. If you can generate all its fun to note that in your answer, but your answer must contain one program/function that generates just one solution.

So, it's been more than a year and my solution is the only log(n) one, so does that mean I get the bounty? haha

@CameronAavik I'm sorry, I forgot.

Mathematica, 54 bytes
Select[IntegerPartitions@#,Unequal@@#&&Tr[1/#]==1&,1]&

About as inefficient as it gets, but it does solve n = 78 in about 9 seconds.
The result is returned as a list wrapped in a singleton list, e.g.:
{{45, 12, 9, 5, 4, 3}}

I wonder if it works for very large n.

@njpipeorgan Given enough memory and time, yes.

I found an estimation of the length of IntegerPartition[n], which is at the order of exp(sqrt(n)), ~10^10^4.5 for n=2^30. I really don't believe that mathematica (or even any architecture) is able to hold the array.

@njpipeorgan The challenge explicitly states that the algorithm must work up to 2^32 theoretically, not practically (as is usually assumed for code golf, unless the challenge explicitly requires that the program actually finishes for all inputs in a reasonable amount of time and memory).

Python 3, 7306 1995 Bytes
This solution runs in log(n) complexity (as far as I can tell).
def i(s,t):
 for n in s[::-1]:t=t.replace(*n)
 return [[]]*78+[list(bytearray.fromhex(a))for a in t.split(",")]
def f(n):
 g,h=lambda c,n:c+[[[2],[3,7,78,91]][n[len(c)]%2]+[i*2for i in c[-1]]],lambda n:[]if n<78 else h((n-[2,179][n%2])//2)+[n]
 v=h(n);c=[i([['g',',03040'],['h',',,0306080'],['i',',020'],['j','b0c1'],['k','21'],['l','60'],['m','30'],['n','141'],['o','k24'],['p',',g'],['q','618'],['r','0c0'],['s','1e'],['t',',0ml'],['u','283c'],['v','e0f1'],['w','2a38'],['x','80'],['y','a0'],['z','01'],['A','50'],['B','24'],['C','i40'],['D','plb1'],['E','gl'],['F','48'],['G','bre1'],['H','28'],['I','6k'],['J','416s'],['K',',040Al'],['L','90'],['M','2a'],['N','54'],['O','k6o'],['P','3c'],['Q','il'],['R','18'],['S','px'],['T','im'],['U','70'],['V','b1'],['W','23'],['X','pj'],['Y','hj'],['Z','0n']],'020lxycHTaRHCyf1517CyfneC91k51cCLdneQU912MCyf0dBiALyf2dClfPEyfneT9s2dELdneEjIgmLydHg5rd14BKLardsE3n8sQ9rd1517Q9rdneplmdRBgUmcRMC5sPEyf102bgA6sPE91z2miAj41IQmc0dRBQUen7spl31z82bT9RFT3wE7neMgmyf0dRBgUmaHMELc1b36EUdBMQLyfs2d,C710M2bgLardRHT3BFQ9rf0dPQ7rdBMQm9Rs2d,0mAl9100d142bE710M2bQmc0fRPtxarfn8sEc1k4sBTfnePExcwtxarf1k8BExcuT3kkT91663C51964,0mAl71k4BMELe12NTcRwQjOT820ltmarf1z8mExeRNCqBFtmyjIHKLa100ds2bQU91bM36garf1k4sBTcRBFgxarfwE91keB2dtUxcn8sME9nbs36gm9rduC5R78,0mAUyf0d14BME91kbB36QLc12AB2dgyjqkHEUeMNT9157eQU9RMFT8s78C8neuixLc1zk4AtUxc1z8Mmt8re0fn8sWhLyc1bH36pl8neu,Kxycsw,iAxc1420l,K8ren8NS9n81bs36hc0vz8WmYzqkmhyv2WBHhyVOHXkJoSjIwSjIuSvz4WASVZIAXZ6skmSj6oFXzOmplvcsW46D61csk46plv8WBFDqoF,tarvk8WBH,tyjkqoHhGqkN,tmvZ8sWmhVZqskmpc0vZ8WAXZqkAplbnImASbn6skwSbn6skuSVOwSVOupGONSbn6soFpyVkJk5aSj6sk78YJkuDkIP5aYOuhvzk4WBAhVzk416oA,tyjkJ265a,,0mxyjk41q53sYzIHmPXkqowXkqouhyVqoHFYz6omFhb0e1zqkmNSyVIP78YJ20klpyVOHwYk620olpc0vz8WBmFXzqomFpG61ckH38PhyjIP78Yz620kmlDkImLDzINUhGIuNDzIA78hb0e1ZIANYkqk366chG6oFNXkJkP5ahVZ6somFSb0e1620kNlhVk41qomADzIFLXkqso78pGqoFNXzkImP5a,tyjk620oHlhG620kNlXzqskm78,tjZqskHmPYqouFD6sku78YzqkNU,tjZqsomF')[v[0]]]
 for o in range(len(v)-1):c=g(c,v)
 return c[-1]

You can test that f(2**32 - 1) runs almost instantly
I used this paper on a method for computing it. With this method there is a massive chunk of data for the pre-determined values for n from 78 to 334 without the even numbers after 168. I wanted to turn this data into something small and I didn't know any good compression algorithms so I made my own.
The way I compressed it was by having a list of string replace rules. I created a method which found the string replace rule which would cut down the most content over all taking into account defining the rule. I then recursively applied this until I could create no more rules (I used characters g-z and A-Z). The string I made to replace with was a comma separated list of the hex values for each of the numbers. In retrospect, converting them to their hex values may not have been the wisest choice, it would probably be shorter to leave them in decimal, since having hex would only save for the 3 digit numbers but would add a 0 for single digit numbers.
The line where I set c you can see the list of replace rules and the text which it runs it on. The rules need to be applied in reverse as well because some rules include characters created from other rules.
There are also numerous places in this code where I could probably cut down on syntax, such as turning the list of lists into a single list and then using a different method to access the rules to replace the text with

n=218 outputs [2] is that expected??

No, I'll see why that's happening a bit later. My apologies. Might be an error in the data I compressed initially.

Haskell, 93 bytes
import Data.List
import Data.Ratio
p n=[x|x<-subsequences[2..n],sum x==n,1==sum(map(1%)x)]!!0

Horribly slow1 but it runs in constant memory. Trivial solution: check all subsequences of [2..n] for sum and sum of reciprocals.
Returning all solutions instead of one is 3 bytes shorter: just remove the !!0 (beware: the running time will always be off the charts).

1 The running time depends on how early the result appears in the list of subsequences. Haskell's laziness stops the search if the first match is found. When compiled, p 89 (result: [3,4,6,9,18,21,28]) runs on my (4 year old) laptop in 35s. Other values, even smaller ones, can take hours.

Julia, 77 bytes
n->collect(filter(i->i==∪(i)&&sum(j->Rational(1,j),i)==1,partitions(n)))[1]

This is an inefficient lambda function that accepts an integer and returns an integer array. To call it, assign it to a variable.
We get the partitions of the integer using partitions. We then filter the set of partitions to only those with unique elements whose reciprocals sum to 1. To ensure no roundoff error occurs, we use Julia's Rational type to construct the reciprocals. filter returns an iterator, so we have to collect it into an array. This gives us an array of arrays (with only a single element), so we can get the first using [1].
Now, when I say inefficient, I mean it. Running this for n = 80 takes 39.113 seconds on my computer and allocates 13.759 GB of memory.

Jelly, 19 bytes
œcL’$P€S=P
ŒṗQƑƇÇƇḢ

Try it online!
Very inefficient. This times out for all valid inputs, but takes less than a minute for all \$n < 62\$
If we were able to ignore failures due to floating point issues, then this could be reduced to 12 bytes:
ŒṗQƑƇİS=1ƲƇḢ

Try it online!
Instead, to avoid division, we use the fact that a set of numbers \$a_1, a_2, ..., a_n\$ such that \$\sum^n_{i=1}a_i = n\$ for an input \$n\$ has their reciprocals sum equal to \$1\$ iff:
$$
(a_2a_3\cdots a_n)+(a_1a_3\cdots a_n)+\cdots+(a_1a_2\cdots a_{n-1}) = \prod^n_{i=1}a_i \tag{1}
$$
i.e. the sum of the products of each sublist of length \$n-1\$ equals the product of the set.
How they work
œcL’$P€S=P - Helper link. Takes a list l on the left
    $      - Group the previous two links together:
  L        -   Take the length of l
   ’       -   Decrement
œc         - Combinations of length n
             This returns all versions of l with a single element removed
     P€    - Take the product of each
       S   - Take the sum
         P - Product of l
        =  - Are the two equal?
             This checks whether or not (1) is true for a given partition

ŒṗQƑƇÇƇḢ - Main link. Takes n on the left
Œṗ       - Yield all partitions of n
  QƑƇ    - Remove those which contain duplicated elements
     ÇƇ  - Keep those for which the helper link is true
       Ḣ - Return the first such list

The second one uses the basic
$$\sum^n_{i=1}\frac1a_i = 1$$
formula, which utterly fails for pretty much every input due to floating point issues. I think that, if it were up to date with Jelly, this code would work in M, due to it's symbolic math functions. Unfortunately, however, M hasn't been updated in ~5 years, so it doesn't appear to have to have the integer partitions builtin.
ŒṗQƑƇİS=1ƲƇḢ - Main link. Takes n on the left
Œṗ           - All partitions of n
  QƑƇ        - Remove those which contain duplicated elements
         ƲƇ  - Keep those for which the following is true:
     İ       -   Yield 1/a for each element
      S      -   Take the sum
       =1    -   Is equal to 1?
           Ḣ - Return the first list found

Husk, 14 bytes
ḟ§&o=1ṁ\o=¹ΣṖḣ

Try it online!
Husk's usage of fractions is really beneficial for this challenge.
Just like all the answers except Cameron's, is very slow for larger test cases.

Vyxal, 12 bytes
ṄλĖ∑1=nÞu∧;c

Try it Online!
No need to worry about floating point error, because everything is fractions under the hood.
Explained
ṄλĖ∑1=nÞu∧;c
Ṅλ        ;c  # From all integer partitions of the input, get the first where
  Ė∑          #  the sum of reciprocals
    1=        #  equals 1
         ∧    #  and
      nÞu     #  the partition has unique integers

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