| Bytes | Lang | Time | Link |
|---|---|---|---|
| 090 | AWK | 250930T143556Z | xrs |
| 024 | MATL | 170512T111941Z | Luis Men |
| 018 | Stax | 210226T080255Z | Razetime |
| 022 | Japt | 200916T113756Z | Shaggy |
| 064 | Powershell | 181106T112153Z | mazzy |
| 109 | VBA Excel | 181105T041305Z | remoel |
| 013 | Noodel | 170512T131345Z | tkellehe |
| 134 | VBA 32bit | 170514T173657Z | Taylor R |
| 064 | shortC | 170513T031439Z | MD XF |
| 181 | Windows batch | 170512T125304Z | stevefes |
| 073 | C gcc | 170512T235654Z | MD XF |
| 179 | JS ES6 | 170524T175814Z | NAND |
| 110 | F# Mono | 170515T184826Z | Brunner |
| 100 | R | 170515T111625Z | Sven Hoh |
| 132 | Haskell | 170517T185930Z | Fox |
| 231 | CSS/HTML | 170512T140927Z | Neil |
| 022 | Japt | 170513T142025Z | Luke |
| nan | Bash | 170512T131427Z | marcosm |
| 044 | APL Dyalog | 170516T084105Z | Adá |
| 069 | Perl | 170512T113811Z | Dada |
| 058 | TIBasic TI84 Plus CE | 170516T033023Z | pizzapan |
| 115 | C gcc | 170512T134319Z | cleblanc |
| 056 | Ruby | 170512T223212Z | Kaia Lea |
| 091 | C | 170514T225831Z | takra |
| 071 | Octave | 170514T194139Z | algmyr |
| 066 | PowerShell | 170512T125207Z | colsw |
| 124 | Go | 170513T032141Z | totallyh |
| 027 | Jelly | 170512T115325Z | Jonathan |
| 078 | Python 2 | 170512T121211Z | Jonathan |
| 077 | Mathematica | 170512T114039Z | Ian Mill |
| 832 | Python 3 | 170512T121349Z | Rod |
| 093 | C | 170513T095808Z | jdt |
| 124 | Java 7 | 170512T130843Z | Kevin Cr |
| 073 | C | 170513T093027Z | 2501 |
| 098 | Batch | 170512T224951Z | Conor O& |
| 282 | S.I.L.O.S | 170513T030437Z | Rohan Jh |
| 100 | c | 170512T235738Z | Digital |
| 064 | GNU sed with exec extension | 170512T232029Z | Digital |
| 061 | Ruby | 170512T215441Z | Value In |
| 159 | Haskell Windows | 170512T214214Z | user4686 |
| 068 | Pure bash | 170512T205748Z | Digital |
| 072 | Groovy | 170512T184715Z | staticme |
| 061 | Perl 6 | 170512T164944Z | Sean |
| 086 | Javascript ES6 | 170512T180436Z | nderscor |
| 015 | V | 170512T111943Z | user4180 |
| 028 | Pyth | 170512T145209Z | izzyg |
| 083 | JavaScript ES6 + HTML | 170512T125052Z | Shaggy |
| 039 | CJam | 170512T132713Z | Business |
| 157 | C# | 170512T115314Z | LiefdeWe |
| 023 | 05AB1E | 170512T114130Z | Emigna |
| 067 | PHP | 170512T112835Z | Titus |
AWK, 90 bytes
END{for(i=2;;system("sleep .1"))printf"\r["substr(" .... ....",10-++i%10,10)"]"}
An earlier attempt that had uh... sophisticated... formatting. (155 bytes)
END{for(;++i;system("sleep .1"))printf"\r\033[K[%*s%*s%*s]",(a=(7>y=i%10))?y:0,a?X:substr(d,1,4-(q=10-y)),a?4:y-4+q,a?d="....":X,a?6-y:0,a?X:substr(d,1,q)}
MATL, 24 bytes
`1&Xx'['897B@YS46*93hhDT
Try it at MATL Online! Or see a gif from the offline compiler:
Explanation
` % Do...while
1&Xx % Pause for 0.1 s and clear screen
'[' % Push this character
897B % Push [1 1 1 0 0 0 0 0 0 1]
@ % Push current iteration index, 1-based
YS % Circularly shift the array by that amount
46* % Multiply by 46 (code point of '.')
93 % Push 93 (code point of ']')
hh % Concatenate horizontally twice. Numbers are interpreted as chars
% with the corresponding code points
D % Display
T % Push true. Used as loop condition. Results in an infinite loop
% End (implicit)
Powershell, 64 bytes
for(){cls;"[$('... .'*2|% s*g(9-$i++%10)10)]";sleep -m 100}
Where $string|% s*g $From $Length is a shortcut to summon $string.SubString($From,$Length)
This solution has one small disadvantage:
- there will be an overflow exception after the Windows style Loading bar has worked for 988 million years.
Powershell, 65 bytes
for(){9..0|%{cls;"[$('... .'*2|% s*g $_ 10)]";sleep -m 100}}
This Windows style Loading bar is an Immortal Eldar from Valinor.
VBA (Excel), 109 bytes
Using Immediate Window and Cell A1 as output
a="... .":Do:b=Right(a,1):a=b &Left(a,9):[A1]="["& a &"]":c=Timer+.1:Do While Timer<c:DoEvents:Loop:Loop
Noodel, 16 15 14 13 bytes
[ CỤ‘Ṁ~ððÐ]ʠḷẸḍt
]ʠ[Ð.×4¤×6⁺ḷẸḍt
]ʠ⁶¤⁴.ȧ[ėÐḷẸḍt
How it works
]ʠ⁶¤⁴.ȧ[ėÐḷẸḍt
]ʠ⁶¤⁴.ȧ[ėÐ # Set up for the animation.
] # Pushes the literal string "]" onto the stack.
ʠ # Move the top of the stack down by one such that the "]" will remain on top.
⁶¤ # Pushes the string "¤" six times onto the stack where "¤" represents a space.
⁴. # Pushes the string "." four times onto the stack.
ȧ # Take everything on the stack and create an array.
[ # Pushes on the string literal "[".
ė # Take what is on the top of the stack and place it at the bottom (moves the "[" to the bottom).
Ð # Pushes the stack to the screen which in Noodel means by reference.
ḷẸḍt # The main animation loop.
ḷ # Loop endlessly the following code.
Ẹ # Take the last character of the array and move it to the front.
ḍt # Delay for a tenth of a second.
# Implicit end of loop.
Update
[Ð]ıʠ⁶¤⁴.ḷėḍt
Don’t know why this took me a while to think of. Anyways, this places it at 13 bytes.
[Ð]ıʠ⁶¤⁴.ḷėḍt
[Ð]ıʠ⁶¤⁴. # Sets up the animation.
[ # Push on the character "["
Ð # Push the stack as an array (which is by reference) to the screen.
] # Push on the character "]"
ı # Jump into a new stack placing the "[" on top.
ʠ # Move the top of the stack down one.
⁶¤ # Push on six spaces.
⁴. # Push on four dots.
ḷėḍt # The main loop that does the animation.
ḷ # Loop the following code endlessly.
ė # Take the top of the stack and put it at the bottom.
ḍt # Delay for a tenth of a second.
<div id="noodel" code="[Ð]ıʠ⁶¤⁴.ḷėḍt" input="" cols="12" rows="2"></div>
<script src="https://tkellehe.github.io/noodel/noodel-latest.js"></script>
<script src="https://tkellehe.github.io/noodel/ppcg.min.js"></script>
VBA 32-bit, 159 157 143 141 134 Bytes
VBA does not have a built in function that allows for waiting for time periods less than one second so we must declare a function from kernel32.dll
32 Bit Declare Statement (41 Bytes)
Declare Sub Sleep Lib"kernel32"(ByVal M&)
64 Bit Declare Statement (49 Bytes)
Declare PtrSafe Sub Sleep Lib"kernel32"(ByVal M&)
Additionally, we must include a DoEvents flag to avoid the infinite loop from making Excel appear as non-responsive. The final function is then a subroutine which takes no input and outputs to the VBE immediate window.
Immediate Window function, 93 Bytes
Anonymous VBE immediate window function that takes no input and outputs to the range A1 on the ActiveSheet
s="... .... .":Do:DoEvents:Sleep 100:[A1]="["&Mid(s,10-i,10)&"]":i=(i+1)Mod 10:Loop
Old Version, 109 Bytes
Immediate window function that takes no input and outputs to the VBE immediate window.
s="... .... .":i=0:Do:DoEvents:Sleep 100:Debug.?"["&Mid(s,10-i,10)&"]":i=(i+1) Mod 10:Loop
Ungolfted and formatted
Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal M&)
Sub a()
Dim i As Integer, s As String
s = "... .... ."
i = 0
Do
Debug.Print [REPT(CHAR(10),99]; "["; Mid(s, 10 - i, 10); "]"
DoEvents
Sleep 100
i = (i + 1) Mod 10
Loop
End Sub
-2 Bytes for removing whitespace
-30 Bytes for counting correctly
-14 Bytes for converting to immediate window function
Output
The gif below uses the full subroutine version because I was too lazy to rerecord this with the immediate window function.
shortC, 85 72 71 66 65 64 bytes
f(i){Udprintf(2,"\r[%-10.10s]",".... ...."+i%10)<<13);f(i+9
Explanation:
f(i){ function that takes integer
U sleep
dprintf(2, print unbuffered
"\r[%-10.10s]", string with exactly 10 characters, wrapped with spaces
".... ...." a string that, when printed with exactly 10 characters, will always have output that is in the loading screen
+i%10 scroll through the string
)<<13); sleep 10<<13 microseconds
f(i+9 recursion :D
Windows batch , 201 181 bytes
Turns out using the old-school method actually saves bytes!
@for %%p in (".... " " .... " " .... " " .... " " .... " " .... " " ...." ". ..." ".. .." "... .")do @echo [%%~p]&timeout 0 >nul&cls
@%0
Note:
get-screenrecorder.level
- low grade
get-gpu.level
- horrible
if get-screenrecorder.level == low grade || get-gpu.level == horrible {
say("GIF may not be accurate");
}
Please note that my GIF recorder skipped a few frames, making the loading bar jumps :(
C (gcc), 202 198 196 189 96 99 88 86 79 77 75 74 73 bytes
Saved 7 8 bytes thanks to Digital Trauma.
f(i){usleep(dprintf(2,"\r[%-10.10s]",".... ...."+i%10)<<13);f(i+9);}
Or, if your system's stdout doesn't need to be flushed after every write without a newline:
C (gcc), 70 bytes
f(i){usleep(printf("\r[%-10.10s]",".... ...."+i%10)<<13);f(i+9);}
How it works
usleep(sleeps for the next return value in microseconds.dprintf(2,prints to file descriptor 2, orstderr. This is necessary because whilestdoutis line-buffered (meaning output will not show until it prints a newline),stderris character-buffered (all output is shown immediately)."\rprints a carriage return (clears the current line).[%-10.10s]"is theprintfformat specifier for a string with exact length 10 (no matter what string provided the output will always be a string with length 10), padded with spaces to the right if necessary. This will be enclosed with brackets.".... ...."is the loading bar.+i%10offsets the loading bar by the current index modulo 10. For example, ifi == 3,i % 10is equal to 3. Offsetting the loading bar by 3 makes it equal to". ....".- When the offset-ed string is passed to the
printfformat specifier, it limits to a length of 10 if necessary and adds spaces to the end if necessary. Therefore, the loading bar will always be between[.... ]and[. ...].
JS (ES6), 179 bytes
x=`[.... ]
[ .... ]
[ .... ]
[ .... ]
[ .... ]
[ .... ]
[ ....]
[. ...]
[.. ..]
[... .]`.split`
`;c=0;setTimeout(y=>alert(x[++c]),100)
F# (Mono), 122 114 118 110 bytes
let rec t s=printf"[%s]\r"s;System.Threading.Thread.Sleep(100);t((string s.[8])+s.Substring(0,8))
t" ..."
R, 100 bytes
z=".... "
repeat{flush.console()
cat("\r[",z,"]",sep="")
z=sub("(.)(.+)(.)","\\3\\1\\2",z)
Sys.sleep(.1)}
Haskell, 132 bytes
import Control.Concurrent
main=mapM_(\x->putStrLn("\27[H\27[J["++x++"]")>>threadDelay(10^5))$iterate(\x->last x:init x)".... "
First, we define a function r to rotate a string to the right. We begin with ".... " and construct an infinite list of its right-rotations, then for each x of these, print:
- An ANSI escape sequence to clear the screen,
- A left-bracket,
xitself,- A right-bracket,
- And a newline character so the terminal will flush.
Then threadDelay waits 100000 microseconds before continuing onto the next element.
Since we are applying these operations to an infinite list, it will continue forever.
CSS/HTML, 202 190 186 + 45 = 247 235 231 bytes
pre{position:relative}x{position:absolute;display:inline-block;width:10ch;height:1em;overflow:hidden}x>x{width:14ch;left:-10ch;animation:1s steps(10,end)infinite l}@keyframes l{to{left:0
<pre>[<x><x>.... ....</x></x> ]
Edit: Saved 12 14 bytes thanks to @Luke.
Bash, 93 90 96 bytes
s="... .... ."
for((;;)){ for i in {0..9};do printf "\r[${s:10-i:10}]";sleep .1;done;}
couldn't get nested { } in for syntax
APL (Dyalog), 44 bytes
{∇r⊣⎕DL.1⊣⎕←⎕TC[20⍴2],1⌽'][',r←¯1⌽⍵}10↑4⍴'.'
Try it online with a slightly modified version: ⎕← replaced by ∆_ which outputs with timestamps.
4⍴'.' four periods
10↑ take the first ten characters of that (pads with spaces)
{…} apply the following function
¯1⌽ rotate one character from the tail to the head
r← assign that to r
'][', prepend the brackets
1⌽ rotate one character from the head to the tail
⎕TC[…] index the list of Terminal Control characters with
20⍴2 twenty repetitions of the number two (the second element is the newline)
⎕← output that
.1⊣ discard that in favour of the number 0.1
⎕DL Delay that many seconds (returns elapsed time)
r⊣ discard that in favour of r (which is then returned by the function)
∇ recurse (tail calls do not work up a stack, and can thus be repeated forever)
Perl, 69 bytes
-3 bytes thanks to @Dom Hastings.
$_="....".$"x6;{print"\ec[$_]
";select$a,$a,!s/(.*)(.)/$2$1/,.1;redo}
That select undef,undef,undef,.1 is the shortest way to sleep less than 1 second in Perl, and it takes a lot of bytes...
Slightly longer (79 bytes), there is:
@F=((".")x4,($")x6);{print"\ec[",@F,"]\n";@F=@F[9,0..8];select$a,$a,$a,.1;redo}
TI-Basic (TI-84 Plus CE), 58 bytes
".... (6 spaces)
Ans+Ans
While 1
For(X,11,2,-1
ClrHome
Disp "["+sub(Ans,X,10)+"]
Wait .1
End
End
C (gcc), 126 125 124 123 122 121 119 118 117 114 115 bytes
This one uses a bitmask to keep track of where the dots are.
I had to add another byte as I was only outputting 5 spaces before.
m=30;f(i){usleep(3<<15);system("clear");for(i=1;i<1920;i*=2)putchar(i^1?i&m?46:32:91);m+=m&512?m+1:m;f(puts("]"));}
Ruby, 57 56 bytes
s=?.*4+' '*6;loop{$><<"[%s]\r"%s=s[-1]+s.chop;sleep 0.1}
Heavily influenced by other answers here.
Saved a byte thanks to @manatwork. Also apparently I have trouble counting characters -- I use ST3 and apparently it will include newlines in the count of characters in the line if you're not attentive.
C, 91 bytes
main(i){for(char*s=".... .... ";;i+=9)usleep(dprintf(2,"[%.10s]\r",s+i%10-1)<<13);}
If it doesn't have to begin at the left: (89 bytes)
main(i){for(char*s=".... .... ";;i+=9)usleep(dprintf(2,"[%.10s]\r",s+i%10)<<13);}
Octave, 71 bytes
s="... ."';do;printf('[%s]\r',s=circshift(s,1));pause(.1);until 0
For once my Octave answer is not MATLAB compatible. Specifically this solution uses
- Both
"and'for quotes, to transpose a string- MATLAB:
('asd')' - Octave:
"asd"'
- MATLAB:
- Octave specific
do ... until 0structure, one char shorter thanwhile 1 ... end - Octave's
printf,one char shorter than thefprintfin MATLAB
PowerShell, 67 66 Bytes
for($s='.'*4+' '*6;$s=-join($s[,9+0..8])){cls;"[$s]";sleep -m 100}
-1 by using shortened constructor thanks to Beatcracker
replaces the string with a copy of the string where the last char is put in front of the remaining chars, clears the screen, prints it, and then sleeps for 100 ms.
saved a lot of bytes by using the for loop constructor rather than wrap the logic inside the string.
Go, 150 145 132 129 124 bytes
-5 bytes thanks to sudee.
I feel like I don't see enough Go here... But my answer is topping C so... pls halp golf?
package main
import(."fmt"
."time")
func main(){s:=".... ";for{Print("\r["+s+"]");Sleep(Duration(1e8));s=(s+s)[9:19];}}
Jelly, 28 27 bytes
ṙ©-j@⁾[]ṭ”ÆȮœS.1®ß
897ṃ⁾. Ç
How?
ṙ©-j@⁾[]ṭ”ÆȮœS.1®ß - Link 1, the infinite loop: list of characters s
ṙ - rotate s left by:
- - -1 (e.g. "... ." -> ".... ")
© - copy to the register and yield
⁾[] - literal ['[',']']
j@ - join with reversed @rguments
Ӯ - literal '\r'
ṭ - tack (append the display text to the '\r')
Ȯ - print with no newline ending
.1 - literal 0.1
œS - sleep for 0.1 seconds then yield the printed text (unused)
® - recall the value from the register
ß - call this link (1) again with the same arity
897ṃ⁾. Ç - Main link: no arguments
897 - literal 897
⁾. - literal ['.',' ']
ṃ - base decompression: convert 897 to base ['.',' '] = "... ."
Python 2, 81 78 bytes
-1 byte (noticing I missed use of %s when Rod submitted an almost identical Python 3 version at the same time!)
-2 bytes (using totallyhuman's idea - replace s[-1]+s[:-1] with s[9]+s[:9])
import time
s='.'*4+' '*6
while s:print'\r[%s]'%s,;s=s[9]+s[:9];time.sleep(.1)
Mathematica, 67 77 Bytes
+10 Bytes as I forgot the square brackets.
Animate["["<>".... "~StringRotateRight~n<>"]",{n,1,10,1},RefreshRate->10]
Python 3, 99 93 85 83+2 (-u flag) bytes
-12 bytes thanks to ovs
-2 bytes thanks to totallyhuman
import time
s=4*'.'+6*' '
while 1:print(end='\r[%s]'%s);time.sleep(.1);s=s[9]+s[:9]
C, 98 93 Bytes
main(){char b[]="x... .";for(;;)*b=b[10],usleep(12<<printf("\r[%s]",memcpy(b+1,b,10)));}
Java 7, 139 124 bytes
String s=".... ";void c()throws Exception{System.out.print("["+s+"]\r");s=(s+s).substring(9,19);Thread.sleep(100);c();}
- Mentioning of
\rthanks to @Phoenix.
The carriage return \r resets the 'cursor' back to the begin of the line, which can then be overwritten. Unfortunately, online compilers nor the Eclipse IDE doesn't support this, so I've added a gif at the end of this answer to show it from Windows Command Prompt.
Try it here. (Slightly modified so you won't have to wait for the time-out before viewing the result. Also, the TIO doesn't support carriage returns, so every line is printed without overwriting the previous line.)
Explanation:
String s=".... "; // Starting String ".... " on class level
void c() // Method without parameter nor return-type
throws Exception{ // throws-clause/try-catch is mandatory for Thread.sleep
System.out.print("["+s+"]\r"); // Print the String between square-brackets,
// and reset the 'cursor' to the start of the line
s=(s+s).substring(9,19); // Set `s` to the next String in line
Thread.sleep(100); // Wait 100 ms
c(); // Recursive call to same method
} // End of method
Output gif:
C, 74 73 bytes
i;f(){usleep(printf("\r[%-10.10s]",".... ...."+i%10)*7692);f(i+=9);}
Modified and improved version of https://codegolf.stackexchange.com/a/120321.
Displays correct output on MinGW.
Batch, 99 98 bytes
Saved 1 byte thanks to SteveFest!
(I could remove \r from the code, but in the spirit of batch golfing, I won't.)
@SET s=....
:g
@CLS
@ECHO [%s%]
@SET s=%s:~-1%%s:~,-1%
@ping 0 -n 1 -w 100>nul
@GOTO g
There are four spaces after the first line.
The main logic is modifying the string. %s:~-1% is the last character of %s% and %s:~0,-1% is all but the last character of %s%. Thus, we are moving the last character to the front of the string, which rotates the string.
S.I.L.O.S, 282 bytes
canvas # #
def # 1000 ! Obj N new M move > 10
newObj 0 # #
pen 255 255 255
N! 0 > >0
M! 1 > >
N! 0 > >0
M! 2 560 >
x=8
lblx
x-1
N! 0 > >
if x x
M! 3 20 >
M! 4 20 >0
M! 5 550 >
M! 6 550 >0
lbla
x=4
lbly
A=6+x
B=60+50*(((x-1)+a)%>)
M! A B 50
x-1
if x y
refresh
a+1
a%>
wait >0
GOTO a
TIO currently does not support graphical output, but the official interpreter does. I think this is the first time I have gotten a chance to test out the graphical output functionality of SILOS.
c, 100
char *s=".... .... ";main(i){for(i=0;;i=(i+9)%10)dprintf(2,"[%.10s]\r",s+i),usleep(3<<15);}
GNU sed (with exec extension), 64
Score includes +1 for -r flag.
s/^/[.... ]/
:
esleep .1
s/[^. ]*(.+)(.)].*/\c[c[\2\1]/p
b
Ruby, 61 bytes
If the spec were for the dots to scroll left instead of right, it would save 1 byte because rotate! with no arguments shifts the array once to the left.
s=[?.]*4+[' ']*6
loop{print ?[,*s,"]\r";s.rotate!9;sleep 0.1}
Haskell (Windows), 159 bytes
import System.Process
import Control.Concurrent
main=mapM id[do system"cls";putStrLn('[':[".... "!!mod(i-n)10|i<-[0..9]]++"]");threadDelay(10^5)|n<-[0..]]
Explanation
mapM id sequentially perform each IO action in the following list
[ start a list comprehension where each element is...
do an IO operation where
system "cls"; we clear the screen by calling the windows builtin "cls"
putStrLn( then display the string...
'[': with '[' appended to
[ a list comprehension where each character is...
".... "!! the character in literal string ".... " at the index
mod(i-n)10 (i - n) % 10
|i<-[0..9]] where i goes from 0 to 9
++"]" and that ends with ']'
);
threadDelay(10^5) then sleep for 100,000 microseconds (100 ms)
|n<-[0..]] where n starts at 0 and increments without bound
Haskell's purity made generating the cycling dot pattern somewhat complex. I ended up creating a nested list comprehension that generated an infinite list of strings in the order they should be output, then went back added the appropriate IO operations.
Pure bash, 68
s=${1:-.... }
printf "[$s]\r"
sleep .1
exec $0 "${s: -1}${s%?}"
Groovy, 72 bytes
s="*"*4+" "*6
for(;;){print("["+s+"]"+"\n"*20);s=s[9]+s[0..8];sleep 100}
Explaination
s="*"*4+" "*6 //creates the string "**** "
for(;;){ //classic infinite loop
print("["+s+"]"+"\n"*20) //prints the string with [ at the beginning and ] at the end. After that some newlines
s=s[9]+s[0..8] //appends the final char of the string to beginning, creating a cycling illusion
sleep 100 //100 ms delay
}
Perl 6, 61 bytes
$_='.... ';loop {"^M[$_]".print;s/(.*)(.)/$1$0/;sleep .1}
(That ^M is a single carriage return character.)
I really tried to base the output on a lazy infinite list, but couldn't nearly approach the terseness of this solution.
Javascript (ES6), 86 bytes
setInterval('with(console)clear(),log(`[${x=x[9]+x.slice(0,9)}]`)',100,x='... .')
V, 17 16 15 bytes
i[´.¶ ]<esc>ògó$X|p
<esc> is 0x1b.
And the hexdump:
00000000: 695b b42e b620 5d1b f267 f324 587c 70 i[... ]..g.$X|p
Explanation
i " Insert
[ " a [
´. " 4 .s
¶<space> " 6 spaces
]<esc> " and a ]. Then return to normal mode
ò " Recursively do:
gó " Sleep for 100 milliseconds
$ " Go to the ]
X " Delete the character to the left of the ]
| " Go to the [
p " And paste the deleted character right after the [
" Implicit ending ò
Pyth, 28 bytes
J+*4\.*6d#.d.1p"\r"pj=.>J1`Y
JavaScript (ES6) + HTML, 104 85 83 bytes
f=(s=".... ")=>setTimeout(f,100,s[9]+s.slice(0,9),o.value=`[${s}]`)
<input id=o
- Saved 2 bytes thanks to Johan's suggestion that I use an
inputinstead of apre.
Try It
Requires a closing > on the input tag in order to function in a Snippet.
(f=(s=".... ")=>setTimeout(f,100,s[9]+s.slice(0,9),o.value=`[${s}]`))()
<input id=o>
CJam, 39 bytes
'.4*S6*+{_a`'"-oDcoes{es1$m100<}g;1m>}h
Can't make a GIF right now...
How it works
'.4*S6*+ e# Push a string containing 4 dots and 6 spaces
{ e# Do:
_ e# Copy the string
a` e# Wrap it in an array and take its string representation: [".... "]
'"- e# Remove quote characters from it: [.... ]
o e# Print it
Dco e# Print a carriage return (ASCII 13), moving the cursor back to the start
es e# Push the current time in milliseconds
{es1$m100<}g e# Loop until the current time is at least 100 more than that time
; e# Delete the old time
1m> e# Rotate the string 1 space to the right
}h e# Repeat while the TOS is truthy. The string being printed is non-empty, so
e# it is always truthy, and will repeat forever.
C#, 162 157 bytes
()=>{for(string o="[.... ]";;){o=o.Insert(1,o[10]+"").Remove(11,1);System.Console.Write(o);System.Threading.Thread.Sleep(100);System.Console.Clear();}};
or as whole program for 177 bytes
namespace System{class P{static void Main(){for(string o="[.... ]";;){o=o.Insert(1,o[10]+"").Remove(11,1);Console.Write(o);Threading.Thread.Sleep(100);Console.Clear();}}}}
05AB1E, 23 bytes
'.4×ð6×J[D…[ÿ],Á¶т×,т.W
Explanation
'.4×ð6×J # push the string ".... "
[ # forever do:
D # duplicate
…[ÿ], # interpolate the copy between brackets and print
Á # rotate the remaining copy right
¶т×, # print 100 newlines
т.W # wait 100ms
PHP, 67 bytes
for($s="... .";$s=substr($s.$s,9,10);usleep(1e5))echo"\r[$s]";
no comment












