42
3
This question is part of a series Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday. You can find more information about Brain-Flak's Birthday here.
Today is Brain-Flak's first Birthday! So I thought we would throw it a surprise birthday party. So in your favorite language print
Surprise!
Happy Birthday, Brain-Flak!
(Trailing whitespace is permitted)
As always programs should be golfed. However since Brain-Flak programs are made of brackets, it wont count any brackets in your source against you. (The characters ()[]<>{}
don't count towards your byte total), but they must be balanced as to not upset Brain-Flak.
Rules
Here is a breakdown of the rules
The brackets in your source must be balanced. That is the parentheses of your program must be spanned by the following grammar:
S -> SS | (S) | [S] | <S> | {S} | E
where
E
is the empty string.That is to say that a balanced string is either the concatenation of two balanced strings, braces around a balanced string, or the empty string.
The score of a program is the number of non-bracket bytes.
Your goal should be to minimize your score in whatever language you choose.
Standard rules apply so you may write either a complete program or a function.
in the event of a tie raw byte count acts as a tie breaker
There are certainly going to be zero byte solutions in certain languages (Parenthesis Hell, Parenthetic, Glypho, Lenguage). Try to find ways to golf well in languages where this is not a trivial task.
8Surprise! Happy Birthday, Brain-Flak! – Comrade SparklePony – 2017-04-30T13:24:41.620
Does it have to be a full program, or can it be a function returning the string? – LegionMammal978 – 2017-04-30T13:41:06.337
I didn't get the "grammar" thing (is this some standard notation?) until told "all brackets must be balanced". – Jonathan Allan – 2017-04-30T14:37:02.767
@johnathanallen It is a context free grammar. I don't know if it is standard but it's the notation I learned in uni. – Post Rock Garf Hunter – 2017-04-30T14:39:10.793
1Sorry for the dumb questions. Is
><
considered balanced, or do the braces need to be in the correct order (<>
)? – Carcigenicate – 2017-04-30T15:46:57.210@Carcigenicate
><
or([)]
are not balanced.<>
or()[]
are. – Post Rock Garf Hunter – 2017-04-30T15:49:03.610@Christopher I have removed the language restriction due to the tie breaker. However I cannot recommend using any language that can only score zero on this challenge. – Post Rock Garf Hunter – 2017-04-30T19:19:02.503
I cannot recommend using any language that can only score zero on this challenge. Why? Trying to win a competition is pretty much the point of having a competition in the first place. In the future, I'd recommend preventing trivial answers with a perfect score by using a better scoring mechanism. For example, brackets could count as 1 point, other bytes as 10. – Dennis – 2017-04-30T20:53:12.547
@Dennis Its a competition between answers of the same language. You are not trying to beat all the other languages by choosing the language that solves the challenge trivially. Its the same for questions that ask to add two numbers, a bunch of languages are capable of doing so in one byte but that doesn't make the answers interesting. I also think the current scoring mechanism encourages more interesting answers in languages where the task is not trivial in zero bytes. – Post Rock Garf Hunter – 2017-04-30T21:24:56.343
If you're not concerned with comparing scores across languages, why discourage answers with a score of zero? The challenge is basically plain code golf for these languages. – Dennis – 2017-04-30T23:46:53.097
@Dennis Fair enough, with the tie breaker it becomes just code golf. But this challenge is super boring as just a code-golf challenge. – Post Rock Garf Hunter – 2017-05-01T00:09:32.790
2+1 for the CFG. That's a great way to define "balanced." – Brian McCutchon – 2017-05-01T03:28:34.387
Brain-flak was too surprised to participate in the party :( – Matthew Roh – 2017-05-02T16:53:23.367