[Question]
  [
This is my first challenge, so I'm keeping it fairly simple.
If you've ever typed `telnet towel.blinkenlights.nl` on your command line and pressed enter, you will have experienced the joy of asciimation. Asciimation is, quite simply, doing an animation with ascii art. Today we will be doing a very basic asciimation of a person doing jumping jacks.
There will be two ascii pictures that we will put together into one asciimation.
Number 1:
```
_o_
 0
/ \
```
Number 2:
```
\o/
_0_
<blank line>
```
Note that the second one has a blank line at the end.
So your program should do these steps:
1. Clear the console screen.
2. Print the correct ascii art image.
3. Set a flag or something so you know to do the other image next time.
4. Wait a moment (about a second).
5. Continue at 1.
# Rules
* Your program must be a (theoretically) infinite loop.
* The programming language you use must have been created before this challange was posted.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest code in bytes wins.
* Standard loopholes apply.
Enjoy!
  
[Answer]
# CJam, ~~51~~ ~~45~~ ~~42~~ ~~38~~ 36 bytes
```
"c\o/
_0_""^[c_o_
 0
/ \^["{_o\6e4m!}g
```
The above uses caret notation; the sequence `^[` is actually the ASCII character with code point 27.
I've borrowed the escape sequence (`^[c`) from [@DomHastings' answer](https://codegolf.stackexchange.com/a/57138) ([with his permission](https://codegolf.stackexchange.com/questions/57120/asciimation-jumping-jacks/57138?noredirect=1#comment137801_57138)) to save 4 bytes.
### Verification
You can recreate the file like this:
```
base64 -d > jj.cjam <<< ImNcby8KXzBfIiIbY19vXwogMAovIFwbIntfb1w2ZTRtIX1n
```
To run the code, download the [CJam interpreter](https://sourceforge.net/p/cjam/wiki/Home/) and execute this:
```
java -jar cjam-0.6.5.jar jj.cjam
```
This will work on any terminal that supports [console\_codes](http://man7.org/linux/man-pages/man4/console_codes.4.html) or an appropriate subset.1
### How it works
```
e# Push both jumping jacks on the stack.
"c\o/
_0_"
"^[c_o_
 0
/ \^["
e# When chained together, they contain two occurrences of the string "\ec",
e# which resets the terminal. Encoding the ESC byte in the second string
e# eliminates the need two escape a backslash before the string terminator.
{         e# Do:
  _o      e#   Copy the jumping jack on top of the stack and print the copy.
  \       e#   Swap the order of the jumping jacks.
  6e4m!   e#   Calculate the factorial of 60,000 and discard the result.
          e#   This takes "about a second".
}g        e# Since the discarded factorial was non-zero, repeat the loop.
```
---
1 The jumping jacks will look better if you hide the terminal's cursor before running the program. In Konsole, e.g., you can set the cursor's color to match the background color. This has to be done via your terminal's settings, since `^[c` resets the terminal.
[Answer]
# Pyth - ~~41~~ ~~40~~ 39 bytes
```
.VZ"\x1b[H\x1b[J"@c"_o_
 0
/ \\\o/
_0_"Tb .p9
```
(I'm counting the `\x1b`'s as one byte since SO destroys special characters).
Clearly doesn't work online since its a) an infinite loop and b) uses terminal escape codes.
```
#                Infinite loop
 "..."           Print escape sequences to clear screen
 @               Modular indexing
  c     T        Chop at index ten into the constituent frames
   "..."         Frames 1 & 2 concatenated (Pyth allows literal newlines in strings)
  ~              Post assign. This is an assign that returns the old value.
   h             Increment function. Putting it after an assign makes it augmented assign.
   Z             Variable auto-initialized to zero.
 .p9             Permutations(range(9), 9). Takes about a second on my machine.
```
I was surprised to find out that augmented-assign worked with post-assign. Pyth is awesome.
[Answer]
# QBasic, ~~58~~ 54 bytes
Tested on [QB64](http://www.qb64.net) and at [Archive.org](https://archive.org/details/msdos_qbasic_megapack).
```
CLS
?"_o_
?0
?"/ \
SLEEP 1
CLS
?"\o/
?"_0_
SLEEP 1
RUN
```
The right language for the problem can be surprisingly competitive, even if it is usually verbose. The `?` shortcut for `PRINT` helps too, of course. `CLS` is **cl**ear **s**creen; `RUN` without arguments restarts the program, which is the shortest way to get an infinite loop.
The only other trick here is printing `0` for the midsection of the first picture. QBasic puts a space in front of (and after) nonnegative numeric values when it prints them, resulting in  `0` . Saved 2 characters over `" 0`.
I may also point out that the delay in this code is *literally a second*, and is not machine-dependent. ;^P
[Answer]
# Perl *(\*nix)*, 54 bytes
```
sleep print"\x1bc",$-++%2?'\o/
_0_
':'_o_
 0
/ \
'while 1
```
(`\x1b` is counted as 1 byte but escaped for easier testing.) The above has been tested with Bash and shortened by another byte thanks to [@Dennis](https://codegolf.stackexchange.com/users/12012/dennis)!
# Perl *(Windows)*, 56 bytes
```
sleep print"\x1b[2J",$-++%2?'\o/
_0_
':'_o_
 0
/ \
'while 1
```
Thanks to [@Jarmex](https://codegolf.stackexchange.com/u/26977) for his testing and advice!
[Answer]
# Javascript (ES6), ~~109~~ ~~93~~ ~~79~~ 70 bytes + HTML, ~~12~~ 10 bytes = ~~120~~ ~~106~~ ~~91~~ 80 bytes
Fairly straightforward. Uses template strings to store the images, and toggles a boolean value to determine which to use.
**NOTE:** This solution may not be valid, as it does not actually use a console. However, I don't believe it's possible to clear a browser console using JS, at least not while using Firefox.
```
a=!1,setInterval(_=>O.innerHTML=(a=!a)?`_o_ 
 0
/ \\`:`\\o/ 
_0_`,1e3)
```
```
<pre id=O>
```
[Answer]
# Bash, ~~86~~ 84 bytes
```
while sleep 1;do printf "\e[2J_o_\n 0\n/ \\";sleep 1;printf "\r\e[2J\o/\n_0_\n";done
```
[Answer]
# [Dash](https://wiki.debian.org/Shell), 67 bytes
Also `bash`, `ksh`, `zsh`, `ash`, `yash` and probably many more besides. While it apparently works in these other shells, their own features and idiosyncrasies may allow for further golfing. I'll leave that as an exercise for the reader.
Notably **not** `fish` or `tcsh`.
```
f(){ clear;echo "$1";sleep 1;f "$2" "$1";};f '_o_
 0
/ \' '\o/
_0_'
```
[Try it online!](https://tio.run/##S0kszvj/P01Ds1ohOSc1scg6NTkjX0FJxVDJujgnNbVAwdA6Dcg1UoKI1QJ56vH58VwKBlz6CjHqCuox@fpc8Qbx6v//AwA "Dash – Try It Online") (with STDERR issue -- see **Caveats**)
[Try it online!](https://tio.run/##S0kszvifWlGQX1SiEOIa5GtbVmJoYPA/TUOzWiE5JzWxyDo1OSNfQUnFUMm6OCc1tUDB0DoNyDVSgojVAnnq8fnxXAoGXPoKMeoK6jH5@lzxBvHq//8DAA "Dash – Try It Online") (with visible escape codes issue -- see **Caveats**)
# How it works
Hopefully fairly self explanatory, even so:
Set up a function `f` which
* Clears screen
* Prints contents of `$1`
* Sleeps 1 second
* Calls `f` passing `$1` and `$2` in reverse order. This means the next iteration will display the "other" glyph before flipping them again... and so on.
Outside of the function is the initial call to `f` with literal depictions of the two character glyphs as two arguments.
# Caveats
TIO's terminal implementation doesn't handle the `clear` well -- produces an error to STDOUT. If you add `export TERM=vt100` as a header the error stops and it displays the literal escape string. This is a feature/limitation of TIO, not an issue with my submission. I've included links to both for reference.
Code should work as intended in a "proper" terminal.
The recursion will eventually cause it to fail. Tried a soak test with `sleep 0` in a Docker container and it threw a Segmentation Fault within a minute. Adding a trivial counter, which may or may not have quantum implications, it managed ~15000 iterations in my environment. So like 4 hours with the `sleep` -- and who's going to watch it **that** long? :-)
But I'd still argue that this complies with "theoretically" infinite, because it could go forever if it had "theoretically" infinite resources. That's my story and I'm sticking to it.
[Answer]
# Python 2, 99 bytes
Runs on Windows
```
import os,time
g=0
while 1:os.system("cls");print["\\o/\n_0_","_o_\n 0 \n/ \\"][g];time.sleep(1);g=~g
```
For UNIX machines, add two bytes:
```
import os,time
g=0
while 1:os.system("clear");print["\\o/\n_0_","_o_\n 0 \n/ \\"][g];time.sleep(1);g=~g
```
[Answer]
# awk - 95 92 86 84 83
```
END{
    for(;++j;)
        system("clear;printf '"(j%2?"_o_\n 0\n/ \\":"\\o/\n_0_")"';sleep 1")
}
```
Nice workout :D Just wondered if this was doable. No prices to gain though... ;)
If someone wants to test this: after you run the program you have to press Ctrl+D (end of input) to actually start the END block. To terminate it I have to use Ctrl+Z.
I also have this, which is only 74 bytes, but it starts with pausing a second which isn't the wanted behaviour I think
```
END{
    for(;1;print++j%2?"_o_\n 0\n/ \\":"\\o/\n_0_")
        system("sleep 1;clear")
}
```
[Answer]
# Batch - 82 bytes
Edit: Muted the timeout command and removed the extra newline.
```
cls&echo _o_&echo  0&echo / \&timeout>nul 1&cls&echo \o/&echo _0_&timeout>nul 1&%0
```
I've seen 2 other similar batch answers so I didn't really want to post this, but this is my first ever golf.
[Answer]
# BBC BASIC, 75 bytes
Note that tokenisation pulls it down to 75 bytes. The whitespace is added in by the IDE.
```
      g=0
   10 IFg=0THENPRINT"\o/":PRINT"_0_"ELSEPRINT"_o_":PRINT" 0 ":PRINT"/ \"
      g=1-g:WAIT 100CLS:GOTO10
```
[![Properties showing program size](https://i.stack.imgur.com/UIoh2.jpg)](https://i.stack.imgur.com/UIoh2.jpg)
[Answer]
# JavaScript ES6, ~~100~~ 95 bytes
```
(f=_=>{console.log(_?`_o_
 0
/ \\`:`\\o/
_0_`)
(b=setTimeout)(q=>(clear(),b(b=>f(!_))),1e3)})()
```
Logs to the console. Tested on Safari Nightly
[Answer]
# Batch, ~~151~~ ~~130~~ 118 bytes
```
cls
@echo _o_
@echo  0
@echo / \
@PING -n 2 127.0.0.1>NUL
cls
@echo \o/
@echo _0_
@PING -n 2 127.0.0.1>NUL
%0
```
[Answer]
# CBM 64 BASIC V2, ~~121~~ ~~119~~ ~~112~~ 117 bytes
```
2?CHR$(147)+"\o/":?" 0":?"/ \"
3GOSUB7
4?CHR$(147)+"_o_":?"_0_"
5GOSUB7
6RUN
7A=TI
8IFTI-A<60THENGOTO8
9RETURN
```
[Answer]
# Julia, 70 bytes
(on **Windows**, by replacing `clear` with `cls`, thanks to undergroundmonorail)
```
n(i=1)=(sleep(1);run(`cls`);print(i>0?"_o_
 0
/ \\":"\\o/
_0_");n(-i))
```
### On Linux, 72 bytes
```
n(i=1)=(sleep(1);run(`clear`);print(i>0?"_o_
 0
/ \\":"\\o/
_0_");n(-i))
```
This uses actual newlines rather than `\n` to save a byte; otherwise, the `i` is either 1 or -1 as the "flag", and it uses recursion to achieve the infinite loop. Call it as either `n(1)` or just `n()`.
Also, `run(`clear`)`/`run(`cls`)` uses a shell command to clear the window, because Julia doesn't have a built-in window-clear command.
[Answer]
# Windows Batch, 83 ~~89~~
**Edit** removed the empty line after the clarification by OP
```
@cls&echo _o_&echo  0&echo./ \&timeout>nul 1&cls&echo \o/&echo _0_&timeout>nul 1&%0
```
~~If you get rid of the empty line in the jumping man (that cannot be seen anyway), the score is 83~~
Note: `timeout` is not present in Windows XP. It works in Vista or newer versions. Moreover `timeout` is not precise to the second, so it's a perfect choice to implement step 4 (Wait a moment (*about a second*))
[Answer]
# Javascript (ES6), 82 bytes
A modification of my [previous answer](https://codegolf.stackexchange.com/a/57123/42545) that uses the console. Works partially in Firefox, but only clears the console in Chrome, AFAIK.
```
a=!0,c=console,setInterval(_=>c.log(c.clear(a=!a)|a?`_o_
 0
/ \\`:`\\o/
_0_`),1e3)
```
As always, suggestions welcome!
[Answer]
# JavaScript, ~~92~~ ~~91~~ 89 bytes
```
x=0;setInterval(function(){console.log("\033c"+["_o_\n 0\n/ \\","\\o/\n_0_"][x^=1])},1e3)
```
* No ES6 features (but would be significantly shorter with them)
* Works with Node.js on Linux (don't know about other environments)
* Partially works in Chrome's console (`c` is shown instead of clearing the console, breaking the output)
Removing `"\033c"+` from the above code, the following works in the browser, but doesn't clear the console.
```
x=0;setInterval(function(){console.log(["_o_\n 0\n/ \\","\\o/\n_0_"][x^=1])},1e3)
```
[Answer]
# CBM BASIC v2.0 (68 characters)
```
0?"S_o_q||0q||N M":goS1:?"SMoN":?"_0_":goS1:gO
1wA161,255,pE(161):reT
```
The above requires some explanation, since Stack Exchange markup doesn't properly represent PETSCII characters:
* The program is shown here for convenience in lowercase, but can and should be entered and run in uppercase mode on a Commodore 64.
* The first and third "S" characters are actually in reverse video, and produced by pressing the `CLR` key (`SHIFT`+`HOME`).
* The "q" characters are actually in reverse video, and produced by pressing the down cursor (`CRSR ⇓`).
* The "|" characters are actually in reverse video, and produced by pressing the left cursor (`SHIFT`+`CRSR ⇒`).
[Answer]
# TI-Basic, ~~58~~ 56 bytes
```
While 1
ClrHome
If not(Ans
Disp "_o_"," 0","/ \
If Ans
Disp "\o/","_0_"
not(Ans
If dim(rand(70
End
```
-2 bytes for assuming that the code is run on a fresh interpreter.
[Answer]
## Ruby, 79 bytes
```
k=!0;loop{puts((k)?"\e[H\e[2J_o_\n 0\n/ \\":"\e[H\e[2J\\o/\n_0_");k=!k;sleep 1}
```
Requires escape codes.
[Answer]
# Forth, 86 bytes
Requires GNU Forth for the escaped strings. To run in a non-GNU Forth, just change `S\"` to `S"`, and the escaped characters won't print correctly.
```
: P PAGE TYPE CR 999 MS ;
: R BEGIN S\" \\o/\n_0_" P S\" _o_\n 0 \n/ \\" P 0 UNTIL ; R
```
[Answer]
# [beeswax](http://rosettacode.org/wiki/Category:Beeswax), ~~119~~ 113 bytes
```
ph0`J2[`}ghq'-<gh0N}`0`}gN`/o\`Ngh0`J`<
>g}`o`}N` `0>'d`0 `N`/ \`0hg>-'phg}`[2`b
dF1f+5~Zzf(.FP9f..F3_#     d   <
```
Explanation of the important parts of the program:
```
left to right  right to left
3FBf   or       fBF3          27       ASCII code for (esc)
3             [x,x,3]•        set lstack 1st to 3
 F            [3,3,3]•        set lstack to 1st
  B           [3,3,27]•       1st=1st^2nd
   f                          push lstack 1st on gstack
——————
9PF.(f   or    f(.FP9         102400   counter to roughly match a wait time
                                       of 1 s on my i5 2410M Laptop
9             [x,x,9]•        set lstack 1st to 9
 P            [x,x,10]•       increment 1st
  F           [10,10,10]•     set lstack to 1st
   .          [10,10,100]•    1st=1st*2nd
    (         [10,10,102400]• 1st=1st<<2nd (100<<10=102400, arithmetic shift left)
     f                        push lstack 1st on gstack
——————
zZ~5+f   or    f+5~Zz         95       ASCII for '_'
z             [0,0,0]•        initialize lstack to zero
 Z            [0,0,90]•       get value from relative coordinate (0,0),
                              which is the location of `Z` itself, ASCII(Z)=90
  ~           [0,90,0]•       flip 1st and 2nd lstack values
   5          [0,90,5]•       set lstack 1st to 5 
    +         [0,90,95]•      1st = 1st+2nd
     f                        push lstack 1st on gstack
```
The `f`’s push the values on the gstack (global stack) for later use. These values are accessed by the `0gh` (or the mirrored `hg0`) and `hg` (`gh`) instructions. `h` rotates the gstack upwards, `g` reads the top value of gstack and pushes it onto the lstack (local stack) of the bee (instruction pointer).
```
}`o`}N` 0 `N`/ \`                      sequence to print the standing man
N`\o/`Ng}`0`}N                         sequence to print the jumping man
}`[2J`                        equivalent to the ANSI escape sequence (esc)[2J
                              to clear the screen
>-'p  or >-'q  or >  p        loop for counting down (wait 1 s)
d  <      b  <    d'-<
```
In-depth explanation follows later, if needed. Maybe with animation.
[Answer]
# [Noodel](https://tkellehe.github.io/noodel/), noncompeting 24 bytes
Noncompeting because *Noodel* was born after the challenge was created:)
```
”ṛ|ọBCḊCBCḣ“\o/¶_0_ḷėçḍs
```
[Try it:)](https://tkellehe.github.io/noodel/editor.html?code=%E2%80%9D%E1%B9%9B%7C%E1%BB%8DBC%E1%B8%8ACBC%E1%B8%A3%E2%80%9C%5Co%2F%C2%B6_0_%E1%B8%B7%C4%97%C3%A7%E1%B8%8Ds&input=&run=true)
### How it works
```
”ṛ|ọBCḊCBCḣ              # Creates a string that gets decompressed into "_o_¶¤0¤¶/¤\" and places it into the pipe.
           “\o/¶_0_      # Creates a string and places it into the pipe.
                   ḷ     # Unconditionally loop the code up to a new line or end of program.
                    ė    # Takes what is in the front of the pipe and puts it into the back.
                     ç   # Clears the screen and prints.
                      ḍs # Delays for one second.
```
---
There currently is not a version of *Noodel* that supports the syntax used in this challenge. Here is a version that does:
**24 bytes**
```
\o/¶_0_ _o_¶¤0¤¶/¤\ḷçėḍs
```
```
<div id="noodel" code="\o/¶_0_ _o_¶¤0¤¶/¤\ḷçėḍs" input="" cols="5" rows="5"></div>
<script src="https://tkellehe.github.io/noodel/noodel-latest.js"></script>
<script src="https://tkellehe.github.io/noodel/ppcg.min.js"></script>
```
[Answer]
# [Nim](http://nim-lang.org/), 107 bytes
```
import os,terminal
var f=0
while 0<1:eraseScreen();sleep 999;echo ["_o_\n 0 \n/ \\","\\o/\n_0_\n"][f];f=1-f
```
Don't [Try it online!](https://tio.run/##DcjBCsMgDADQe78ieNqgo/boXL9ix6aIlEgFTUos2@e7vePjXHvP9RS9QNp4kdbMsQyfqJAWO3yPXAjsa36SxkbvXYn4dvetEJ3gnPO0HwKrCRKQwQLyBIhmNIgyIQf7b7OtafNpmR@p9x8 "Nim – Try It Online")
]