49
\$\begingroup\$

This challenge is in tribute to the winner of Best Picture at the Oscars 2017, La La Land Moonlight!


Your challenge is to print the text

La La Land
pause one second, then change the text to show

La La Land Moonlight
The original text (La La Land) must have a strikethrough. This can be achieved either by clearing the screen, drawing on top of the original text, or by any other clever solutions.

This is a so lowest bytes wins. Standard code-golf rules apply.

\$\endgroup\$
  • \$\begingroup\$ Oh wow! My challenge was so well received it was posted on Twitter \$\endgroup\$ – vikarjramun Feb 28 '17 at 2:48
  • \$\begingroup\$ I wonder if any languages can use the fact the La La La(nd) pattern \$\endgroup\$ – 12Me21 Feb 28 '17 at 13:52

32 Answers 32

13
\$\begingroup\$

Jelly, 31 bytes

“XSøjĠḌ⁻Ça»Œts⁵µṀȮ⁸œS“Æɓ9m“ɓm”ż

Tested with xterm and LANG=en_US. Doesn't work on TIO for several reasons.

Hexdump

00000000: 58 53 1d 6a c4 ad 8b 0e 61 fb 13 74 73 85 09 c8  XS.j....a..ts...
00000010: ca 88 1e 53 fe 0d 9b 39 6d fe 9b 6d ff f9        ...S...9m..m..

Verification

screen capture

Background

This answer makes use of control characters and ANSI escape sequences.

  • 0d (<CR>) is used to return to the beginning of the liner after printing La La Land.

  • 9b 39 6d (<CSI> 9 m) is used to activate strike-through text before printing La La Land for the second time.

  • 9b 6d (<CSI> m) is used to reset foreground and background to default mode, thus deactivating strike-through, before printing Moonlight.

How it works

“XSøjĠḌ⁻Ça»Œts⁵µṀȮ⁸œS“Æɓ9m“ɓm”ż Main link. No arguments.

“XSøjĠḌ⁻Ça»                     Index into Jelly's inbuilt dictionary to yield
                                "LA LA Land moonlight".
           Œt                   Convert to title case, yielding the string
                                "La La Land Moonlight".
             s⁵                 Split into chunks of length 10, yielding
                                A =: ["La La Land", " Moonlight"].
               µ                Begin a new chain with argument A.
                Ṁ               Take the maximum, yielding "La La Land".
                 Ȯ              Output; print "La La Land".
                  ⁸œS           Sleep for bool("La La Land") seconds and yield A.
                     “Æɓ9m“ɓm”ż Zip ["\r\x9b9m", "\x9bm"] with A, yielding
                                [["\r\x9b9m","La La Land"],["\x9bm"," Moonlight"]].
                                (implicit) Flatten and print.
\$\endgroup\$
26
\$\begingroup\$

Vim, 37 bytes

3iLa <esc>snd<esc>gs:s/./&<C-v>u336/g
A Moonlight

A fairly straightforward solution.

Here is an animation of it running:

enter image description here

\$\endgroup\$
  • \$\begingroup\$ But there's no sleep :( \$\endgroup\$ – Cruncher Feb 27 '17 at 20:15
  • 1
    \$\begingroup\$ @Cruncher Yes there is! gs sleeps for one second. \$\endgroup\$ – DJMcMayhem Feb 27 '17 at 20:16
  • \$\begingroup\$ Interesting, how do you typically run this? Because I typed this into vim and it works, but it loses the luster of the second delay (in my slow typing I didn't even notice the delay as I was copying from here) \$\endgroup\$ – Cruncher Feb 27 '17 at 20:17
  • \$\begingroup\$ Nevermind, I figured it out with macros. Very cool! \$\endgroup\$ – Cruncher Feb 27 '17 at 20:35
25
\$\begingroup\$

HTML, 153 148 bytes

Using CSS animation. Tested on Firefox and Chrome only.

<s>La La Land</s> <b>Moonlight<style>@keyframes l{0%{text-decoration:none}}@keyframes m{0%{opacity:0}}b,s{animation:m 0s 1s both}s{animation-name:l}

<s>La La Land</s> <b>Moonlight</b>

\$\endgroup\$
  • \$\begingroup\$ You can put one of the @keyframes declarations last and remove the two closing curly braces. \$\endgroup\$ – darrylyeo Mar 2 '17 at 1:14
  • \$\begingroup\$ @darrylyeo: Firefox refuses to apply a rule if any of the } is missing, so unfortunately this cannot be done. \$\endgroup\$ – kennytm Mar 2 '17 at 4:27
19
\$\begingroup\$

HTML + JavaScript, 18 + 59 = 77 bytes

setTimeout('O.innerHTML="<s>La La Land</s> Moonlight"',1e3)
<p id=O>La La Land

Sadly, there doesn't seem to be an efficient way to reuse O.innerHTML...

\$\endgroup\$
  • \$\begingroup\$ Would setTimeout('a=O.innerHTML;a=a.strike()+" Moonlight"',1e3) work? \$\endgroup\$ – Kritixi Lithos Feb 27 '17 at 18:54
  • 1
    \$\begingroup\$ @KritixiLithos I don't think so; modifying a there wouldn't modify O.innerHTML. \$\endgroup\$ – ETHproductions Feb 27 '17 at 19:06
18
\$\begingroup\$

Octave, 81 66 bytes

15 bytes saved thanks to @Stewie

text(0,.5,'La La Land');pause(1);text(0,.5,'---------- Moonlight')

Online Demo Here.

While the demo shows two separate plots, when run in the desktop version of MATLAB, it shows the first plot, waits 1 second, and then adds the second string to the same plot.

Since Octave doesn't have support for strike through text, I have instead opted to display the text within an axes object in a figure and display a "strikethrough" by displaying '--------' on top of the initial text (initial idea by @Stewie). Previously, I had actually plotted a line object to strike through 'La La Land'

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ Nice approach... :) You can save 15 bytes like this: text(0,.5,'La La Land');pause(1);text(0,.5,'---------- Moonlight'). \$\endgroup\$ – Stewie Griffin Feb 27 '17 at 21:26
  • \$\begingroup\$ @StewieGriffin Thanks! Updated \$\endgroup\$ – Suever Feb 27 '17 at 21:48
  • \$\begingroup\$ Does Octave not let you do '-'*8+ in place of the dashes? \$\endgroup\$ – Fund Monica's Lawsuit Feb 28 '17 at 3:27
  • \$\begingroup\$ @QPaysTaxes Unfortunately it doesn't. \$\endgroup\$ – Suever Feb 28 '17 at 3:29
  • 1
    \$\begingroup\$ Darn. One more question: Why not draw it at (0, 0) or (1, 0)? Seems like either of those would save you a byte (no .) \$\endgroup\$ – Fund Monica's Lawsuit Feb 28 '17 at 3:31
10
\$\begingroup\$

Bash, 70, 69 66 bytes

-4 pts thanks to Riley

echo La La Land;sleep 1;echo -e "\r\e[9mLa La Land\e[0m Moonlight"

Credits to Sylvain Pineau's answer on AskUbuntu for the strikethrough

\$\endgroup\$
  • 1
    \$\begingroup\$ I think you can save a few bytes by using \r in the second echo instead of clear. Also, you don't need the space before the second echo. \$\endgroup\$ – Riley Feb 27 '17 at 18:33
  • \$\begingroup\$ This doesn't print the space after the striked out text. \$\endgroup\$ – Loovjo Feb 27 '17 at 18:40
  • \$\begingroup\$ Also, I think clear; should go first. And you have an unnecessary space in ; echo. \$\endgroup\$ – Erik the Outgolfer Feb 27 '17 at 18:42
  • 2
    \$\begingroup\$ Shorter solution that adds the space after the striked text and does in-line modification of the printed text using ANSI code \e[A, so no clear is needed. For more info on that see me. s="La La Land";echo $s;sleep 1;echo -e "\e[A\e[9m$s\e[0m Moonlight" \$\endgroup\$ – seshoumara Feb 27 '17 at 21:02
  • 1
    \$\begingroup\$ Or echo -n La La Land;sleep 1;echo -e "\r\e[9mLa La Land\e[0mMoonlight" \$\endgroup\$ – Digital Trauma Feb 27 '17 at 21:05
9
\$\begingroup\$

QBasic, 61 bytes

SCREEN 9
?"La La Land";
SLEEP 1
LINE(0,7)-(80,7)
?" Moonlight

Using graphics mode, draw an actual line through the text. Here's what it looks like in QB64:

Moonlight

The code should be pretty self-explanatory, but here's an ungolfed version:

SCREEN 9             ' One of several graphics modes
PRINT "La La Land";  ' The semicolon suppresses the trailing newline
SLEEP 1
LINE (0,7)-(80,7)
PRINT " Moonlight"
\$\endgroup\$
8
\$\begingroup\$

MATL, 46 bytes

'La La Land'tDlY.ttv45HY(`t@Y)' Moonlight'hXxDT

Since MATL doesn't have support for control codes or text formatting, this solution simply alternates between 'La La Land' and '-----------' as fast as possible to simulate strikethrough text.

enter image description here

Explanation

'La La Land'   % Push the string literal to the stack
tD             % Duplicate this string and display
tv             % Stack a version of this string on top of another
45HY(          % Replace the second one with '----------'
`              % Do...while loop
  t            % Duplicate the 2D character array
  @Y)          % Grab the row corresponding to the loop index (modular indexing)
  ' Moonlight' % Push the string literal to the stack
  h            % Horizontally concatenate the two
  Xx           % Clear the display
  D            % Display the string
  T            % Push a literal TRUE to the stack to make it an infinite loop
\$\endgroup\$
  • 1
    \$\begingroup\$ Creative! I like it \$\endgroup\$ – vikarjramun Feb 27 '17 at 20:34
  • 3
    \$\begingroup\$ +1 for creativity, but not sure if it meets the rules. \$\endgroup\$ – DBX12 Feb 28 '17 at 10:13
5
\$\begingroup\$

Bash + pv, 50 bytes

printf ♪La\ La\ Land›%b 9m\\0 m\ Moonlight|pv -0L1

This builds on @DigitalTrauma's Bash answer.

represents a carriage return (0x0d), a CSI byte (0x9b).

Hexdump

0000000: 70 72 69 6e 74 66 20 0d 4c 61 5c 20 4c 61 5c 20  printf .La\ La\
0000010: 4c 61 6e 64 9b 25 62 20 39 6d 5c 5c 30 20 6d 5c  Land.%b 9m\\0 m\
0000020: 20 4d 6f 6f 6e 6c 69 67 68 74 7c 70 76 20 2d 30   Moonlight|pv -0
0000030: 4c 31                                            L1

Verification

screen capture

How it works

printf repeats its format string as many times as needed to exhaust its other arguments. Since there is one occurrence of %b and two arguments (9m\\0 and m\ Moonlight), it will produce the following byte stream.

\rLa La Land\x9b9m\0\rLa La Land\x9bm Moonlight

This does the following.

  • \r brings the cursor to the start of the line.

  • La La Land is printed verbatim.

  • \x9b9m activates strike-through text.

  • \0 sets an end-of-line marker for pv -0.

  • \rLa La Land does the same as before.

  • \x9bm reset foreground and background to default mode, deactivating strike-through.

  • Moonlight is printed verbatim.

Finally, pv -0L1 prints one null-terminated line per second, introducing the desired delay.

\$\endgroup\$
  • 3
    \$\begingroup\$ Is it a coincidence that helped your golfing, or did you specifically want to use it with La La Land? I like it! \$\endgroup\$ – BruceWayne Feb 28 '17 at 6:47
  • \$\begingroup\$ A carriage return is the shortest way to go back to the start of the line. The fact that it is stylized as sometimes is just a happy coincidence. \$\endgroup\$ – Dennis Mar 1 '17 at 13:32
  • \$\begingroup\$ The use of pv instead of sleep like everyone else is beautiful. \$\endgroup\$ – IQAndreas Mar 2 '17 at 11:42
  • 1
    \$\begingroup\$ @IQAndreas The idea to use pv is what I took from the linked Bash answer, so I can't really take credit for that. \$\endgroup\$ – Dennis Mar 2 '17 at 12:38
3
\$\begingroup\$

HTML + JavaScript, 10 + 63 = 73 bytes

setTimeout("document.write('<s>La La Land</s> Moonlight')",1e3)
La La Land

\$\endgroup\$
  • \$\begingroup\$ In what browser does this work? \$\endgroup\$ – Titus Feb 28 '17 at 17:41
  • 2
    \$\begingroup\$ @Titus I think all of them, but I've confirmed it working in Chrome + Firefox so far \$\endgroup\$ – nderscore Feb 28 '17 at 17:50
3
\$\begingroup\$

PHP (86 75 69 Bytes)

La La Land<?=sleep(1)?:"\rL̶a̶ ̶L̶a̶ ̶L̶a̶n̶d̶ Moonlight";

Uses UTF-8 character U+0336 for the strikethrough.

Edit: Saved 17 bytes with the suggestions @Titus commented

\$\endgroup\$
  • 1
    \$\begingroup\$ sleep always returns 0; so you can just do sleep(1)?:" ̶L̶a̶ ̶L̶a̶ ̶L̶a̶n̶d̶ Moonlight" (-3 bytes). \r instead of \033[10D saves 6 bytes and including it in the final string saves another 4. \$\endgroup\$ – Titus Feb 28 '17 at 14:13
  • \$\begingroup\$ Oh, wow, each of those I should've been able to see, I guess it comes with practice. Thanks a lot! if you wanna make your own answer to get the rep, as its 11 bytes of improvement, I can delete my answer and upvote yours :) \$\endgroup\$ – madshvero Feb 28 '17 at 14:19
  • \$\begingroup\$ No need to delete a valid answer. I don´t post my own when golfing others´ answers - unless the OP doesn´t react. Here are three more bytes: The leading blank is not required, neither is the strikethrough on the last blank. Using UTF-8 as charset is not cheating; but you could mention "uses UTF-8 character U+0336 for the strikethrough". \$\endgroup\$ – Titus Feb 28 '17 at 14:35
  • \$\begingroup\$ Oh and La La Land<?= instead of <?="La La Land", saves another 3 bytes. \$\endgroup\$ – Titus Feb 28 '17 at 14:37
3
\$\begingroup\$

Pyth - 47 bytes

Does the strikethrough thing now.


K"La La Land".d_1"\033c"+j"\u0336"K" Moonlight
\$\endgroup\$
  • \$\begingroup\$ It doesn't work; you need a " in front for +1. \$\endgroup\$ – Erik the Outgolfer Feb 27 '17 at 18:34
  • \$\begingroup\$ @EriktheOutgolfer >_< don't know how that happened. \$\endgroup\$ – Maltysen Feb 27 '17 at 18:35
  • \$\begingroup\$ What's an <exmpty line>? I would suggest <pre> tags. \$\endgroup\$ – CalculatorFeline Feb 28 '17 at 0:55
3
\$\begingroup\$

C 87 86 bytes

f(){char*s="La La Land";puts(s);printf("\e[9m%s\e[0m",s);sleep(1);puts(" Moonlight");}

Ungolfed version:

void f()
{
  char *s="La La Land";
  puts(s);
  printf("\e[9m%s\e[0m",s);
  sleep(1);
  puts(" Moonlight");

}
\$\endgroup\$
  • 2
    \$\begingroup\$ You don't need the space between char and *. \$\endgroup\$ – kennytm Feb 28 '17 at 8:23
  • \$\begingroup\$ You also need to call f() in the ungolfed version, no? \$\endgroup\$ – Rodrigo Hahn Mar 1 '17 at 21:25
  • \$\begingroup\$ @kennytm Thnaks for saving 1 byte.Updated. \$\endgroup\$ – Abel Tom Mar 2 '17 at 4:58
  • 1
    \$\begingroup\$ @RodrigoHahn By default a code-golf answer can be a function or program, so no we don't need to call f(). \$\endgroup\$ – kennytm Mar 2 '17 at 5:36
3
\$\begingroup\$

HTML + JavaScript, 100 bytes

La La Land<script>setTimeout(function(){document.write("<s>La La Land</s> Moonlight")},1e3)</script>

setTimeout(function(){document.write("<s>La La Land</s> Moonlight")},1e3);
La La Land

\$\endgroup\$
  • \$\begingroup\$ How come document.write overwrites the existing text? \$\endgroup\$ – vikarjramun Mar 2 '17 at 13:37
  • \$\begingroup\$ if your document is fully loaded then you are using document.write(like attaching with a event or with timeout) will delete all existing HTML. refer = w3schools.com/jsref/met_doc_write.asp \$\endgroup\$ – Sourav Mar 8 '17 at 6:18
3
\$\begingroup\$

GNU sed + sleep, 63 58 bytes

Edit: saved 5 bytes, based on Digital Trauma's comments

Waiting between two print statements can't be done using sed alone, and as such I call sleep 1. It is possible to do a system call from sed, using the e command, which is a GNU extension.

s:$:La La Land:p
esleep 1
s:.:&̶:g
s:.*:\c[[A& Moonlight:

To create strike-through text (line 3), a "combining long stroke overlay", U+0336, is appended to each character. After that, I move the cursor up 1 line, effectively replacing the old text when printing something new, using the so called ANSI Escape Sequences. These are interpreted by the terminal as special formatting commands. You can find more information about them here.

gif image

Explanation:

s:$:La La Land:p         # add "La La Land" to pattern space and print it
esleep 1                 # run system command 'sleep 1'
s:.:&̶:g                  # append U+0336 after each character (strike-through)
s:.*:\c[[A& Moonlight:   # '\c[[A' is '(escape)[A', ANSI code to move the cursor
                         #up 1 line. Then append ' Moonlight' and print on exit.
\$\endgroup\$
  • 1
    \$\begingroup\$ @DigitalTrauma Completely forgot about the \c, nice find! As for that special unicode, it's first time I hear about it, but it works indeed. When it is printed by this page, it is combined with the command s separator :, so a bit strange to see that at first. \$\endgroup\$ – seshoumara Feb 28 '17 at 0:30
3
\$\begingroup\$

Java 7, 207 206 171 139 bytes

void c()throws Exception{System.out.print("La La Land");Thread.sleep(1000);System.out.print("\rL̶a̶ ̶L̶a̶ ̶L̶a̶n̶d̶ Moonlight");}

I'm kinda cheating with this first answer, because I use strike-through unicode.

Explanation:

void c() throws Exception{         // Method (throws is necessary due to Thread.sleep)
  System.out.print("La La Land");  //  Show initial text
  Thread.sleep(1000);              //  Wait 1 second
  System.out.print("\r             //  Move 'cursor' to the start of the line so we can overwrite the current text
    L̶a̶ ̶L̶a̶ ̶L̶a̶n̶d̶ Moonlight");        //  and print new text
}                                  // End of method

Java 7 (with AWT), 444 429 341 bytes

Crossed out 444 is still regular 444 ;(

import java.awt.*;import java.text.*;void m(){new Frame(){public void paint(Graphics g){g.drawString("La La Land",9,50);try{Thread.sleep(1000);}catch(Exception e){}AttributedString s=new AttributedString("La La Land Moonlight");s.addAttribute(java.awt.font.TextAttribute.STRIKETHROUGH,1>0,0,10);g.drawString(s.getIterator(),9,50);}}.show();}

Since Java console doesn't have any markup like strike-through, you'll have to use Java AWT. And well, if you thought Java Console was already verbose, then this is even worse (I know, I know, most of you couldn't even imagined Java 7 being any worse..)

Explanation:

import java.awt.*;                                         // import used for Frame and Graphics
import java.text.*;                                        // Import used for all AttributedStrings
void m(){                                                  // method
  new Frame(){                                             //  Frame
    public void paint(Graphics g){                         //   Overridden paint method
      g.drawString("La La Land", 9, 50);                   //    Show the initial text
      try{
        Thread.sleep(1000);                                //    Wait 1 second
      }catch(Exception e){}                                //    Thread.sleep requires a try-catch..
      AttributedString s
          = new AttributedString("La La Land Moonlight");  //    Object to add markup to text
      s.addAttribute(
        java.awt.font.TextAttribute.STRIKETHROUGH,         //    Strike-through attribute
        1>0,//true                                         //    Mandatory parameter before we can specify the length
        0, 10);                                            //    From length 0 to 10 (length of "La La Land")
      g.drawString(s.getIterator(), 9, 50);                //    Show this new text with strike-through part
    }                                                      //   End of paint method
  }.show();                                                //  Show Frame
}                                                          // End of method

Output gif:

enter image description here

\$\endgroup\$
  • \$\begingroup\$ I think you can remove the space in String[] a and use 1e3 instead of 1000 \$\endgroup\$ – Kritixi Lithos Feb 28 '17 at 16:46
  • \$\begingroup\$ @KritixiLithos That space should indeed have been gone.. probably slipped by during golfing. As for 1e3, that's a double, and Thread.sleep expects a long. 1000 is shorter than (long)1e3. :) \$\endgroup\$ – Kevin Cruijssen Feb 28 '17 at 19:04
  • 2
    \$\begingroup\$ You mean Swing, not Spring, don't you? I nearly had a heart-attack! Spring in a codegolf... Also, to save bytes, you can use AWT instead of Swing. \$\endgroup\$ – Olivier Grégoire Mar 1 '17 at 0:12
  • \$\begingroup\$ @OlivierGrégoire Ah, typo, I indeed meant Swing.. And thanks, AWT is shorter, no need for Swing (or Spring :P) at all. \$\endgroup\$ – Kevin Cruijssen Mar 1 '17 at 8:31
  • 1
    \$\begingroup\$ I made the AWT version a (Java 7) function with anonymous inner class. I removed the first AttributedString nonsense and golfed more for a total of 306 bytes. If you go Java 8, it's still 302 bytes. void m(){new Frame(){public void paint(Graphics g){g.drawString("La La Land",99,99);try{Thread.sleep(1000);}catch(Exception e){}AttributedString s=new AttributedString("La La Land Moonlight");s.addAttribute(java.awt.font.TextAttribute.STRIKETHROUGH,1>0,0,10);g.drawString(s.getIterator(),99,99);}}.show();} \$\endgroup\$ – Olivier Grégoire Mar 2 '17 at 15:37
2
\$\begingroup\$

Python 3, 90 bytes

Use Unicode (U+0336) to strike-through, because the macOS terminal doesn't support that \e[9m command.

import time
s='La La Land '
print(s,end='\r')
time.sleep(1)
print('̶'.join(s),'Moonlight')

L̶a̶ ̶L̶a̶ ̶L̶a̶n̶d̶  Moonlight

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

Arduino, 332 331 bytes

Not competing, just for the fun.

#include<LiquidCrystal.h>
LiquidCrystal lcd(7,8,9,10,11,12);String a="La La Land";String b="-- -- ----";void setup(){lcd.begin(16,2);}void loop(){lcd.home();lcd.print(a);delay(1000);lcd.clear();lcd.print(b);lcd.setCursor(0,2);lcd.print("Moonlight");while(1){delay(150);lcd.home();lcd.print(a);delay(150);lcd.home();lcd.print(b);}}

Bill of Materials:

  • 1 x Arduino Uno
  • 1 x LCD 16 x 2
  • 1 x 10K Potentiometer
  • 1 x 180 ohm Resistor

L̶a̶ ̶L̶a̶ ̶L̶a̶n̶d̶  Moonlight

\$\endgroup\$
  • 1
    \$\begingroup\$ Welcome to the site. I don't know how similar Arduino is to C but I am pretty sure you can remove the space in your #include \$\endgroup\$ – Wheat Wizard Mar 2 '17 at 20:49
  • \$\begingroup\$ By my calculations, the hardware costs 30 bytes (2 for the resistor, 3 for the potentiometer, 1 for its setting, 10 (up for change) for the LCD, and 14 for the wires (1 byte per wire)). However, this is only a suggestion. Also, TIO says the code is only 331 bytes. Is there a trailing newline? \$\endgroup\$ – CalculatorFeline Mar 2 '17 at 21:13
  • \$\begingroup\$ @WheatWizard that's correct. fixed it! \$\endgroup\$ – fluxa Mar 3 '17 at 7:10
  • 1
    \$\begingroup\$ Good point @CalculatorFeline, but in that case, we should also count the hardware costs of all the other answers. Possibly my setup is the cheapest one. :D \$\endgroup\$ – fluxa Mar 3 '17 at 8:58
  • \$\begingroup\$ ... D8 It's all over D8 \$\endgroup\$ – CalculatorFeline Mar 3 '17 at 16:17
2
\$\begingroup\$

Python3, 99 bytes

import time
l='La La Land'
s='\u0336'
print(l,end="\r")
time.sleep(1)
print(s.join(l)+' Moonlight')
\$\endgroup\$
  • \$\begingroup\$ If you set l = 'La La Land couldn't you avoid the +s for -2 chars? . \$\endgroup\$ – walpen Mar 2 '17 at 6:47
  • \$\begingroup\$ @walpen I have to use it twice, that's why I stored it in s \$\endgroup\$ – Miguel Mar 2 '17 at 8:27
1
\$\begingroup\$

Bash + pv, 62

l="La La Land"
printf "$l\0\r\e[9m$l\e[0m Moonlight"|pv -0qlL1
\$\endgroup\$
1
\$\begingroup\$

SmileBASIC, 45 bytes

One less byte thanks to 12Me21's magic period trick.

As far as I'm aware SB doesn't have strikethrough characters, so I used GLINE instead. Obviously assumes a clear display, use ACLS if you need to.

?"La La Land
WAIT 60GLINE.,4,79,4?" Moonlight
\$\endgroup\$
1
\$\begingroup\$

AHK, 102 bytes

s=La La Land
Send,%s%
Sleep,1000
Send,^a{Del}
Loop,Parse,s
Send,%A_LoopField%{U+0336}
Send,` Moonlight

I cheated a bit to get strikethrough text by using the combining long stroke overlay unicode character. This may create an odd appearance depending on your setup. Notepad gives a good appearance.

The code in action


AutoHotkey is clearly not the most efficient language for this but it was a fun challenge. Be careful where you run it because it doesn't create it's own display and wipes all the text of whatever window is active.

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

Swift, 392 bytes

Swift+UIKit is really not ideal for golfing! Run this in a XCode playground and the result will be shown in the preview pane.

import UIKit
import PlaygroundSupport
let l=UILabel(frame:CGRect(x:0,y:0,width:200,height:20))
l.textColor=UIColor.red
let m="La La Land"
let n=" Moonlight"
l.text=m
DispatchQueue.main.asyncAfter(deadline:.now()+1){
let a=NSMutableAttributedString(string:m+n)
a.addAttribute("NSStrikethrough",value:1,range:NSRange(location:0,length:10))
l.attributedText=a
}
PlaygroundPage.current.liveView=l

preview

\$\endgroup\$
  • \$\begingroup\$ Is the l.textColor=UIColor.red necessary? \$\endgroup\$ – Albert Renshaw Apr 15 '17 at 8:12
  • \$\begingroup\$ seems to default to black text on black background otherwise \$\endgroup\$ – Matt Apr 15 '17 at 13:23
0
\$\begingroup\$

Jelly, 41 bytes

“ñ[“m‘Ọj
“¡ṭḊßȥṡoẋ»¹13Ọ;9Ǥ;;0Ǥ;“"dE»œS1

Doesn't work on online interpreter.

\$\endgroup\$
  • \$\begingroup\$ Why not? Can compatibility be added cheaply? \$\endgroup\$ – CalculatorFeline Feb 28 '17 at 0:54
  • \$\begingroup\$ @CalculatorFeline No, Dennis must implement control codes for it to work, and it's not his priority currently. \$\endgroup\$ – Erik the Outgolfer Feb 28 '17 at 11:45
  • \$\begingroup\$ Can you give a screenshot/animated gif of the output? \$\endgroup\$ – ʰᵈˑ Feb 28 '17 at 13:12
  • \$\begingroup\$ @ʰᵈˑ I might do, although there is no guarantee. In the meantime, you can download the interpreter and test it yourself :) \$\endgroup\$ – Erik the Outgolfer Feb 28 '17 at 13:25
0
\$\begingroup\$

Python (137 Bytes)

from turtle import *;import time;write("La La Land");time.sleep(1);clearscreen();write("\u0336".join("La La Land ")+" Moonlight");done()
\$\endgroup\$
  • 2
    \$\begingroup\$ You don't need the space after the import. I would also suggest saving "La La Land" as a variable. \$\endgroup\$ – Wheat Wizard Feb 28 '17 at 0:44
0
\$\begingroup\$

TI-BASIC, 57 53 bytes

:" LA
:Text(3,4,Ans+Ans+Ans+"ND
:Pause "",1
:Line(-9,8,-2,8
:Text(3,41,"MOONLIGHT

Note that this uses the TI-84+ CE ability with the newest OS to pause for 1 second. This will return a synthax error on the TI-84+. For testing, you can omit the 1 second pause by removing that line. Also remember to press Zoom, 6 first so that you are on default window settings, otherwise the line command won't work.

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

SpecBAS - 58 bytes

1  ?"La La Land ";
2 WAIT 1e3
3 DRAW 0,4;80,0
4  ?"Moonlight"

Each character is 8x8 pixels, so draws a line from 0,4 to the relative position 80,4 (80 added to first coordinate and 0 to second so it stays on same line).

enter image description here

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

OIL, 76 bytes

↩︎⎋[9m
La La Land
⎋[0m Moonlight
4
1
10
20
4
14
10
9
20
6
5
4
0
4
1
4
2
89999

Replace the with an escape character and ↩︎ with a carriage return. OIL lacks any kind of sleep command, so I emulate it using a loop that counts down from 89999 to 1. It takes about one second on my computer, but it may not on yours.

The first 3 lines are ignored by the interpreter, it then prints (4) the second line (line 1; "La La Land"). The following structure is the loop that decrements the large number at the end until it's equal to 1. In the end, I just print the first 3 lines.

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

PHP, not competing (64 bytes)

<?=$s="\rLa La Land",sleep(1)?:wordwrap($s,1,--,1)," Moonlight";

uses UTF-8: -- stands for U+0336 - but I am pretty certain that it does not work standing alone.

If it does not, try ~"1I" or ~I1 instead of -- (+3 or +1 bytes).

No time to store it to a file or figure out how to set my console to UTF-8; so I couldn´t test either of these; but whoever can: please let me know wether this is complete BS or not.

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

Powershell, 63 bytes

Works only in PowerShell ISE. Non-competing, since strikethrough is shifted by one char and I can't fix it.

'La La Land',('̶'*10+' Moonlight')|%{sleep 1;Write-Host $_ -N}

L̶a̶ ̶L̶a̶ ̶L̶a̶n̶d̶ Moonlight

\$\endgroup\$

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.