62
\$\begingroup\$

Introduction

The Nineteenth Byte is CGCC's official chatroom (go check it out!). Its name is a play on the nineteenth hole, and it also refers to golf, which is appropriate for CGCC's chatroom's name. The name is also precisely \$19\$ bytes long, as its name states.

Challenge

Your task is to write a program that outputs Stack Exchange Chat - The Nineteenth Byte exactly. However, if the nineteenth byte and only the nineteenth byte of your source code is removed, it should output only Stack Exchange Chat. Because of this, the best score you can get will be \$19\$ bytes. For example, if your code is abcdefghijklmnopqrstuvwxyz, then abcdefghijklmnopqrstuvwxyz must output Stack Exchange Chat - The Nineteenth Byte and abcdefghijklmnopqrtuvwxyz must output Stack Exchange Chat.

Rules

  • Standard loopholes are forbidden.
  • Trailing whitespace is allowed.
  • If possible, please link to an online interpreter (e.g. TIO) to run your program on.
  • Please explain your answer. This is not necessary, but it makes it easier for others to understand.
  • Languages newer than the question are allowed. This means you could create your own language where it would be trivial to do this, but don't expect any upvotes.
  • You are scored by the length of the program that outputs Stack Exchange Chat - The Nineteenth Byte.
  • This is , so shortest code in bytes wins!
\$\endgroup\$
13
  • 2
    \$\begingroup\$ Brownie points for beating my 40 byte 05AB1E anwer. \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 16:26
  • 1
    \$\begingroup\$ Is this the fastest upvoted challenge in history? 6 upvotes in 17min \$\endgroup\$
    – user100690
    Mar 23, 2021 at 16:44
  • 1
    \$\begingroup\$ I wish I could learn writing good challenges, for members here \$\endgroup\$
    – Wasif
    Mar 23, 2021 at 16:45
  • 1
    \$\begingroup\$ @ophact Maybe. :P also, got my 05AB1E solution down to 38 \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 16:45
  • 2
    \$\begingroup\$ I will give a 100 rep bounty to the first person to find a (non-trivial) 19 byte solution in any language. \$\endgroup\$
    – Makonede
    Mar 25, 2021 at 22:19

55 Answers 55

1
2
3
\$\begingroup\$

JavaScript, 101 bytes

console.log([[,].splice().length?"":" - The Nineteenth Byte","Stack Exchange Chat"].reverse().join``)

Try it Online!, without the 19th byte

It's not the best answer in JavaScript, but I think it's interesting because the 19th byte is p of splice, making slice:

[,].splice.length == 0 //Falsey
[,].slice.length == 2 //Truthy

It might be golfed more, but idk.

\$\endgroup\$
2
  • \$\begingroup\$ Looks like you're missing the x in Exchange. \$\endgroup\$
    – Ginger
    Jan 11 at 13:43
  • \$\begingroup\$ @GingerIndustries oof let me fix that real quick \$\endgroup\$
    – CreaZyp154
    Jan 11 at 13:48
3
\$\begingroup\$

Lost -A, 113 bytes

>%?"Stack Exch2/"+\"nge Chat"@
^/+"/% - tahC egn"<
?>"he Nineteenth Byt6/"+@v
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
^<<"

The 19th byte is the \ on the first line.

Try it online or verify that it's deterministic.
Try it online without 19th byte or verify that that is deterministic.

Explanation:

Explanation of the language in general:

Lost is a 2D path-walking language. Most 2D path-walking languages start at the top-left position and travel towards the right by default. Lost is unique however, in that both the start position AND starting direction it travels in is completely random. So making the program deterministic, meaning it will have the same output regardless of where it starts or travels, can be quite tricky.

A Lost program of 2 rows and 5 characters per row can have 40 possible program flows. It can start on any one of the 10 characters in the program, and it can start traveling up/north, down/south, left/west, or right/east.

In Lost you therefore want to lead everything to a starting position, so it'll follow the designed path you want it to. In addition, you'll usually have to clean the stack when it starts somewhere in the middle.

Explanation of the program:

All arrows, including the reflects / in the strings, will lead the path towards the leading > on the first line. From there the program flow is as follows:

  • >: Travel towards the right
  • %: Put the safety 'off'. In a Lost program, an @ will terminate the program, but only when the safety is 'off'. When the program starts, the safety is always 'on' by default, otherwise a program flow starting at the exit character @ would immediately terminate without doing anything. The % will turn this safety 'off', so when we now encounter an @ the program will terminate (if the safety is still 'on', the @ will be a no-op instead).
  • ?: Clean the top value on the stack. In some program flows it's highly likely we have a partial string on the stack, so we use this to wipe the stack clean of that potential string. (Minor note: if the stack was not empty when ? is encountered, the next operation will be skipped.)
  • ": Start a string, which means it will push the integer code-points of the characters used.
  • Stack Exch2/: Push the code-points for these characters, being 83 116 97 99 107 32 69 120 99 104 50 47 respectively
  • ": We're done pushing code-points of this string
  • +: Add the top two values together: (50+47=) 97
  • With 19th byte:
    • \: Reflect the direction downwards
    • <: Change the direction towards the left
    • " : Start a string again
    • nge Chat - %/: Push the code-points 110 103 101 32 67 104 97 116 32 45 32 37 47
    • ": We're done pushing code-points again
    • +: Add the top two values together: (37+47=) 84
    • /: Reflect the direction downwards
    • >: Change the direction towards the right
    • "he Nineteenth Byt6/"+: The same yet again
    • @: Terminate the program if the safety is 'off' (which it is at this point). After which all the values on the stack will be output implicitly. Using the -A program argument flag, these code-points will be output as characters instead.
  • Without the 19th byte:
    • "nge Chat": Push the code-points 110 103 101 32 67 104 97 116
    • @: Similar again: terminate the program if the safety is 'off' (which it is at this point), and output the values on the stack implicitly (as characters because of the -A flag).

Some things to note:

  • The leading ? on the third line instead of a ^ is to clean a second unwanted value from the stack, which happens (among others) for the flow {first row, third character, traveling downwards}.
  • The bottom row ^<<", and primarily the ", is for the flow {first row, fourth character, traveling upwards}, which would otherwise keep pushing strings without changing directions.
  • The trailing v on the third line is for the flow {first row, third character, traveling right}, which skipped the % to put the safety off, and would end up in an infinite loop traveling left on the third line.
  • The / in the strings are to prevent infinite loops as well. The one in "Stack Exch2/"+ for flow {first row, second character, traveling downward}; the one in "/% - tahC egn" for flow {second row, fourth character, traveling left}; and the one in "he Nineteenth Byt6/" for flow {third row, third character, traveling left}.
\$\endgroup\$
2
\$\begingroup\$

Japt, 36 bytes

The nineteenth byte is the i, if it's removed the two strings are essentially separated by the comma operator instead. The first compressed string is manually unrolled a bit to control the position of the i command to be the nineteenth byte.

` - T” Ná2çh By’`i`Stack ExÖˆge C•t
` - T” Ná2çh By’`                   // Compressed string " - The Nineteenth Byte", slightly manually decompressed to control the position of the next command.
                 i                  // This is the nineteenth byte, prepend to the above string, if removed, effectively becomes the comma operator instead.
                  `Stack ExÖˆge C•t // Compressed string "Stack Exchange Chat"

Try it here.

\$\endgroup\$
2
\$\begingroup\$

Python, 73 bytes

x,t="hange Chat"," ";print("Stack Exc"+x,bool(t)*"- The Nineteenth Byte")

Sure it could be golfed a bit more... first looking for an alternative to bool

\$\endgroup\$
2
\$\begingroup\$

Husk, 31 bytes

↓0000+¨ḟKȦΞ×ėCȦt¨↑30¨ -ξḞẊNτβ/y

Try it online!

↓0000                           Drop 0 (does nothing)
     +                          Concatenate these strings:
      ¨ḟKȦΞ×ėCȦt¨               Compressed "Stack Exchange Chat"
                 ↑30            Take 30 characters from...
                    ¨ -ξḞẊNτβ/y Compressed " - The Nineteenth Byte"

The 3 is the 19th byte, so removing it makes ↑0¨ -ξḞẊNτβ/y which is the empty string.

\$\endgroup\$
2
\$\begingroup\$

Charcoal, 43 bytes

”↶/➙→G,″ⅉ∕ι↑ι&}yσ”→¿›ⅈ¹⁹«¹”↶0δ⁶b↔Πξ[9⊕|c#ξ“

Try it online! Without the 19th byte (the ): Try it online! Explanation:

”↶/➙→G,″ⅉ∕ι↑ι&}yσ”

Print compressed(!) string "Stack Exchange Chat".

Move to the 20th column.

¿›ⅈ¹⁹«

If we are no longer in the 19th column, then:

¹

Print a -.

”↶0δ⁶b↔Πξ[9⊕|c#ξ“

Print compressed string " The Nineteenth Byte".

\$\endgroup\$
2
  • \$\begingroup\$ Both programs output Stack Exchange Chat. \$\endgroup\$
    – Makonede
    Mar 23, 2021 at 20:21
  • 1
    \$\begingroup\$ @Makonede Whoops, I accidentally pasted in the wrong arrow. Sorry about that. \$\endgroup\$
    – Neil
    Mar 23, 2021 at 21:29
2
\$\begingroup\$

33, 53 bytes

"Stack Exchange "1cp"Chat"p" - The Nineteenth Byte"Np

Try it online! and Try it without the c

The nineteenth byte is the c, which affects the conditional Np at the end of the program.

\$\endgroup\$
2
\$\begingroup\$

PHP, 64 bytes

<?="Stack Excha".(!($a="nge Chat")?:"$a - The Nineteenth Byte");

Try it online!

A kinda trivial answer: the 19th byte is the !. Note that in PHP's ternary conditions a?b:c, if b is missing, a's value is used instead.

\$\endgroup\$
2
\$\begingroup\$

Python 3, 78 bytes

exit(('%s %s %s '+10//10*'- The Nineteenth Byte')%('Stack','Exchange','Chat'))

Try It Online!

Poor attempt but different. removing the 19th character will make it 0//10 and therefore the second string won't be printed.

\$\endgroup\$
2
\$\begingroup\$

Python 3, 101 bytes

def f(gh):
	gh()
	"#";print(" - The Nineteenth Byte")
f(lambda:print(end="Stack Exchange Chat"))

Try it online! Minus the 19th byte:

def f(gh):
	gh()
	#";print(" - The Nineteenth Byte")
f(lambda:print(end="Stack Exchange Chat"))

Try it online! Explanation: Removing a " allows the # symbol to be used as a comment. Yes, I know this isn't very golfed.

-3 and fixed thanks to Makonede.

\$\endgroup\$
4
  • \$\begingroup\$ Welcome to Code Golf! However, this is invalid as the ninteenth byte is the tab on the second line, and the output is incorrect (has two dashes, not one). \$\endgroup\$
    – Makonede
    Jun 7, 2021 at 21:58
  • \$\begingroup\$ @Makonede Ah, thanks for the clarification! I'll fix it right away. \$\endgroup\$ Jun 7, 2021 at 22:21
  • \$\begingroup\$ -3 bytes: print(end="Stack Exchange Chat") \$\endgroup\$
    – Makonede
    Jun 7, 2021 at 22:36
  • \$\begingroup\$ @Makonede Ooh, nice catch! I'll add that. \$\endgroup\$ Jun 7, 2021 at 22:39
2
\$\begingroup\$

Knight (c/golf), 50 bytes

O+"Stack Exchange"+" Chat"" - The Nineteenth Byte"

Try it online!

Every Knight program is actually one expression. It has to manually chain each statement, typically using ;.

So for example:

OUTPUT "Hello"
OUTPUT "World!"

will only output Hello because output only has one argument. Everything else is undefined behavior, but almost all interpreters ignore it.

So therefore, we can easily truncate a program by breaking the "link".

So in my program, the nineteenth byte is this +.

O+"Stack Exchange"+" Chat"" - The Nineteenth Byte"
~~~~~~~~~~~~~~~~~~^

When the + is there, it is parsed as this:

# Concatenate " Chat" and " - The...", append to "Stack Exchange" and output
OUTPUT +("Stack Exchange" +(" Chat" " - The Nineteenth Byte"))

When we remove it, it is parsed as so:

# Concatenate "Stack Exchange" and " Chat", then output
OUTPUT +("Stack Exchange" " Chat")
# ignored because we no longer are concatenating
# " - The Nineteenth Byte"
\$\endgroup\$
2
\$\begingroup\$

AsciiDots, 63 bytes

/' kcatS'_$-..----\
\$_'Exchange Chat'~$' - The Nineteenth Byte

Try it online!

I feel like I can still save a byte or two but I am unsure.

\$\endgroup\$
2
\$\begingroup\$

Pip, 51 bytes

O"Stack Exchange "Y" - The Nineteenth Byte""Chat".y

Attempt This Online!

Explanation

; Output "Stack Exchange " without a trailing newline
O"Stack Exchange "
; 19th character is Y; with it, yank " - The Nineteenth Byte" into the y variable
; Without Y, the string by itself is a no-op and y keeps its initial value of ""
Y" - The Nineteenth Byte"
; Concatenate "Chat" with y and autoprint the result
"Chat".y
\$\endgroup\$
2
\$\begingroup\$

Google Sheets, 64 bytes

="Stack Excha"&if(1,"nge Chat - The Nineteenth Byte","nge Chat")
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to Code Golf! Nice answer! \$\endgroup\$
    – Makonede
    Feb 25 at 18:59
2
\$\begingroup\$

Turing Machine Code, 428 447 bytes

0 _ _ * 3
1 _ _ * 32
2 _ _ l halt
3 _ S r 4
4 _ t r 5
5 _ a r 6
6 _ c r 7
7 _ k r 8
8 _ _ r 9
9 _ E r a
a _ x r b
b _ c r c
c _ h r d
d _ a r e
e _ n r f
f _ g r g
g _ e r h
h _ _ r i
i _ C r j
j _ h r k
k _ a r l
l _ t r 1
32 _ _ r H
H _ - r I
I _ _ r m
m _ T r o
o _ h r p
p _ e r q
q _ _ r r
r _ N r s
s _ i r t
t _ n r u
u _ e r v
v _ t r w
w _ e r x
x _ e r y
y _ n r z
z _ t r A
A _ h r B
B _ _ r C
C _ B r D
D _ y r E
E _ t r G
G _ e * halt

Try it online!

Without 19th:

0 _ _ * 3
1 _ _ * 2
2 _ _ l halt
3 _ S r 4
4 _ t r 5
5 _ a r 6
6 _ c r 7
7 _ k r 8
8 _ _ r 9
9 _ E r a
a _ x r b
b _ c r c
c _ h r d
d _ a r e
e _ n r f
f _ g r g
g _ e r h
h _ _ r i
i _ C r j
j _ h r k
k _ a r l
l _ t r 1
32 _ _ r H
H _ - r I
I _ _ r m
m _ T r o
o _ h r p
p _ e r q
q _ _ r r
r _ N r s
s _ i r t
t _ n r u
u _ e r v
v _ t r w
w _ e r x
x _ e r y
y _ n r z
z _ t r A
A _ h r B
B _ _ r C
C _ B r D
D _ y r E
E _ t r G
G _ e * halt

Thanks to @Makonede for spotting the hyphen gaff.

Try it without the 19th Byte!

\$\endgroup\$
2
  • \$\begingroup\$ This is invalid. There is no dash in the output. \$\endgroup\$
    – Makonede
    Jan 9 at 16:22
  • \$\begingroup\$ @Makonede, Thanks, nice spot. \$\endgroup\$
    – ouflak
    Jan 9 at 18:19
2
\$\begingroup\$

TI-Basic, 83 bytes

"nge Chat
If 01
Ans+" - The Nineteenth Byte
"Stack Excha"+Ans

-1 byte by replacing i with the imaginary number i

TI-Basic is tokenized, so the nineteenth byte is 1. Despite being 83 bytes, this is not compatible with the TI-83.

\$\endgroup\$
2
\$\begingroup\$

Batch, 70 bytes

set as=e Chat
set as=%as% - The Nineteenth Byte
echo Stack Exchang%as%
\$\endgroup\$
1
\$\begingroup\$

Stax, 35 bytes

`/yT)6bX$`p      01D`|<<T,/-Gk5gD8/

Run and debug it

Remove the nineteenth byte(booooo)

The compressed literal for the whole string is > 19 bytes, so it has to be split for a working solution (unless wastl finds some insane compression exploit)

\$\endgroup\$
1
\$\begingroup\$

Groovy, 66 bytes

m='change Chat'+(01?' - The Nineteenth Byte':'')
print'Stack Ex'+m

Try it online!

Without 19th byte

m='change Chat'+(0?' - The Nineteenth Byte':'')
print'Stack Ex'+m

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Exploring some other answers, I can go down to 65 bytes if I instead multiply like codegolf.stackexchange.com/a/221146/58776: m='hange Chat';z=01;print'Stack Exc'+m+' - The Nineteenth Byte'*z \$\endgroup\$
    – M. Justin
    Mar 24, 2021 at 8:33
1
\$\begingroup\$

Befunge-93, 78 bytes

v>"xe kcatS" >:#,_#@"etyB htnee"v
v^"chang"<>:#,_@#"  - The Ninet"<
>"tahC e"^

Try it online!

The 19th byte is the '#' right before '@' on the first line. If it is removed, execution will stop at '@'.

Explanation

v>"xe kcatS"          Pushes the first section of the string
v^"chang"<
>"tahC e"^

>:#,_                 Prints it

#@                    '#' is the 19th byte, it will skip the '@'. If it's removed
                      the execution will stop at '@'

   "etyB htnee"v      Push the second section of the string (there is an extra space
"  - The Ninet"<      because one char is lost when printing)

>:#,_@#               Prints it
\$\endgroup\$
1
\$\begingroup\$

JavaScript (V8), 60 bytes

e="Exchange Chat "+
"- The Nineteenth Byte"
print("Stack",e)

Try it online!

Similar to

\$\endgroup\$
0
1
\$\begingroup\$

Julia, 61 bytes

s=" Exchange Chat"*
" - The Nineteenth Byte";print("Stack"*s)

Try it online!

port of xnor's answer

* is the 19th byte.

with the *, the expression is incomplete so it continues an the next line. Without it, the expression ends and the next string is useless

Try it without the 19th character!

\$\endgroup\$
1
\$\begingroup\$

AWK, 68 bytes

BEGIN{a="Stack ";b=" - The Nineteenth Byte";print a"Exchange Chat"b}

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Hexagony, 125 bytes

S;t;a;\;c;h;a\ch;a$].\\;aC;$@h;\;n;"T;h;e\a;tt;e;e;n\;{;";.t;e;@\t;h;..;k;{32;"E;x.n;g;e;{;C;.;g;e;{;"C;{;'45;}.N;i;n;e;{;B;y

Try it online!
Try it without 19th Byte!

Expanded versions:

Original:

       S ; t ; a ; \
      ; c ; h ; a \ c
     h ; a $ ] . \ \ ;
    a C ; $ @ h ; \ ; n
   ; " T ; h ; e \ a ; t
  t ; e ; e ; n \ ; { ; "
 ; . t ; e ; @ \ t ; h ; .
  . ; k ; { 3 2 ; " E ; x
   . n ; g ; e ; { ; C ;
    . ; g ; e ; { ; " C
     ; { ; ' 4 5 ; } .
      N ; i ; n ; e ;
       { ; B ; y . .

Without 19th:

       S ; t ; a ; \
      ; c ; h ; a \ c
     h ; a ] . \ \ ; a
    C ; $ @ h ; \ ; n ;
   " T ; h ; e \ a ; t t
  ; e ; e ; n \ ; { ; " ;
 . t ; e ; @ \ t ; h ; . .
  ; k ; { 3 2 ; " E ; x .
   n ; g ; e ; { ; C ; .
    ; g ; e ; { ; " C ;
     { ; ' 4 5 ; } . N
      ; i ; n ; e ; {
       ; B ; y . . .
\$\endgroup\$
1
\$\begingroup\$

Ly, 59 bytes

"Stack Exchange "0`sp"Chat"&o"etyB htneeteniN ehT - "l*[o];

Try it online!

This code stashes a 0 or 1 depending on whether or not the 19th character is deleted. Then that value is pull back to conditionally print the extra characters after the string both outputs have in common is printed.

1. Handles the string both outputs have in common

"Stack Exchange "              - push the start of the common string
                 0`sp          - full code, push 0, increment, save "1"
               -- or --
                 0sp           - w/ 19th char dropped, saves "0"
                     "Chat"    - push the rest of the common string
                           &o  - print stack as string, reverse order 

2. Deal with the optional string

"etyB htneeteniN ehT - "        - push remaining string, in reverse
                        l*      - load saved value multiply top of stack
                          [o]   - while top of stack!=0, print as char
                             ;  - exit to avoid printing the stack
\$\endgroup\$
1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.