The Task:
Given a .txt
file with frames of ASCII art each separated by a \n
(see this example if you are unclear) output a motion picture with frame with 1 frame per second.
Note that there is a trailing \n
on the final frame.
Each frames dimensions will be:
- X<80
- Y<20
The Rules
- The Previous frame must be cleared before the next is displayed, so just printing each frame onto the terminal isn't a valid answer.
- New You can grab the file name however you want, either from it being stored in a variable or from sys args.
- New The images must Loop indefinitely
- This is code golf: smallest program wins.
Example
Input
0 0
0 0
00000
0 0
0 0
00000
0
00000
0
00000
0 0
0 0
0
0
0
Output
Un-golfed
import curses, time
stdscr = curses.initscr()
Frames = file.read(file('Frames.txt')).split('\n')
while True:
y = 0
for i in range(len(Frames)):
stdscr.addstr(y,0,Frames[i])
stdscr.refresh()
y += 1
if Frames[i] == '':
y = 0
stdscr.clear()
time.sleep(1)
document.body.innerText
\$\endgroup\$