<s> from __future__ import division <EOL> from builtins import range <EOL> import copy <EOL> import math <EOL> from asciimatics . effects import Cycle , Print , Stars <EOL> from asciimatics . renderers import SpeechBubble , FigletText , Box <EOL> from asciimatics . scene import Scene <EOL> from asciimatics . screen import Screen <EOL> from asciimatics . sprites import Arrow , Plot , Sam <EOL> from asciimatics . paths import Path <EOL> from asciimatics . exceptions import ResizeScreenError <EOL> import sys <EOL> def _speak ( screen , text , pos , start ) : <EOL> return Print ( <EOL> screen , <EOL> SpeechBubble ( text , "<STR_LIT:L>" ) , <EOL> x = pos [ <NUM_LIT:0> ] + <NUM_LIT:4> , y = pos [ <NUM_LIT:1> ] - <NUM_LIT:4> , <EOL> colour = Screen . COLOUR_CYAN , <EOL> clear = True , <EOL> start_frame = start , <EOL> stop_frame = start + <NUM_LIT:50> ) <EOL> def demo ( screen ) : <EOL> scenes = [ ] <EOL> centre = ( screen . width // <NUM_LIT:2> , screen . height // <NUM_LIT:2> ) <EOL> podium = ( <NUM_LIT:8> , <NUM_LIT:5> ) <EOL> path = Path ( ) <EOL> path . jump_to ( - <NUM_LIT:20> , centre [ <NUM_LIT:1> ] ) <EOL> path . move_straight_to ( centre [ <NUM_LIT:0> ] , centre [ <NUM_LIT:1> ] , <NUM_LIT:10> ) <EOL> path . wait ( <NUM_LIT:30> ) <EOL> path . move_straight_to ( podium [ <NUM_LIT:0> ] , podium [ <NUM_LIT:1> ] , <NUM_LIT:10> ) <EOL> path . wait ( <NUM_LIT:100> ) <EOL> effects = [ <EOL> Arrow ( screen , path , colour = Screen . COLOUR_GREEN ) , <EOL> _speak ( screen , "<STR_LIT>" , centre , <NUM_LIT:30> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , <EOL> "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> ] <EOL> scenes . append ( Scene ( effects ) ) <EOL> path = Path ( ) <EOL> path . jump_to ( podium [ <NUM_LIT:0> ] , podium [ <NUM_LIT:1> ] ) <EOL> effects = [ <EOL> Arrow ( screen , path , colour = Screen . COLOUR_GREEN ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT:10> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> Print ( screen , Box ( screen . width , screen . height ) , <NUM_LIT:0> , <NUM_LIT:0> , start_frame = <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , <EOL> podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , <EOL> podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , <EOL> podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> Stars ( screen , ( screen . width + screen . height ) // <NUM_LIT:2> , start_frame = <NUM_LIT> ) <EOL> ] <EOL> scenes . append ( Scene ( effects , - <NUM_LIT:1> ) ) <EOL> path = Path ( ) <EOL> path . jump_to ( podium [ <NUM_LIT:0> ] , podium [ <NUM_LIT:1> ] ) <EOL> effects = [ <EOL> Arrow ( screen , path , colour = Screen . COLOUR_GREEN ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT:10> ) , <EOL> _speak ( screen , "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <EOL> <NUM_LIT:200> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> ] <EOL> scenes . append ( Scene ( effects , - <NUM_LIT:1> ) ) <EOL> path = Path ( ) <EOL> path . jump_to ( podium [ <NUM_LIT:0> ] , podium [ <NUM_LIT:1> ] ) <EOL> effects = [ <EOL> Arrow ( screen , path , colour = Screen . COLOUR_GREEN ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT:10> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <EOL> <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <EOL> <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> ] <EOL> scenes . append ( Scene ( effects , - <NUM_LIT:1> ) ) <EOL> path = Path ( ) <EOL> path . jump_to ( podium [ <NUM_LIT:0> ] , podium [ <NUM_LIT:1> ] ) <EOL> effects = [ <EOL> Arrow ( screen , path , colour = Screen . COLOUR_GREEN ) , <EOL> _speak ( screen , "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> podium , <NUM_LIT:10> ) , <EOL> Cycle ( screen , <EOL> FigletText ( "<STR_LIT>" ) , <EOL> centre [ <NUM_LIT:1> ] - <NUM_LIT:5> , <EOL> start_frame = <NUM_LIT:100> ) , <EOL> Cycle ( screen , <EOL> FigletText ( "<STR_LIT>" ) , <EOL> centre [ <NUM_LIT:1> ] + <NUM_LIT:1> , <EOL> start_frame = <NUM_LIT:100> ) , <EOL> _speak ( screen , "<STR_LIT>" , <EOL> podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> ] <EOL> scenes . append ( Scene ( effects , - <NUM_LIT:1> ) ) <EOL> path = Path ( ) <EOL> path . jump_to ( podium [ <NUM_LIT:0> ] , podium [ <NUM_LIT:1> ] ) <EOL> curve_path = [ ] <EOL> for i in range ( <NUM_LIT:0> , <NUM_LIT:11> ) : <EOL> curve_path . append ( <EOL> ( centre [ <NUM_LIT:0> ] + ( screen . width / <NUM_LIT:4> * math . sin ( i * math . pi / <NUM_LIT:5> ) ) , <EOL> centre [ <NUM_LIT:1> ] - ( screen . height / <NUM_LIT:4> * math . cos ( i * math . pi / <NUM_LIT:5> ) ) ) ) <EOL> path2 = Path ( ) <EOL> path2 . jump_to ( centre [ <NUM_LIT:0> ] , centre [ <NUM_LIT:1> ] - screen . height // <NUM_LIT:4> ) <EOL> path2 . move_round_to ( curve_path , <NUM_LIT> ) <EOL> effects = [ <EOL> Arrow ( screen , path , colour = Screen . COLOUR_GREEN ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT:10> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> Plot ( screen , path2 , colour = Screen . COLOUR_BLUE , start_frame = <NUM_LIT> , <EOL> stop_frame = <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> Sam ( screen , copy . copy ( path2 ) , start_frame = <NUM_LIT> ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT> ) , <EOL> ] <EOL> scenes . append ( Scene ( effects , - <NUM_LIT:1> ) ) <EOL> path = Path ( ) <EOL> path . jump_to ( podium [ <NUM_LIT:0> ] , podium [ <NUM_LIT:1> ] ) <EOL> path . wait ( <NUM_LIT> ) <EOL> path . move_straight_to ( - <NUM_LIT:5> , podium [ <NUM_LIT:1> ] , <NUM_LIT:20> ) <EOL> path . wait ( <NUM_LIT> ) <EOL> effects = [ <EOL> Arrow ( screen , path , colour = Screen . COLOUR_GREEN ) , <EOL> _speak ( screen , "<STR_LIT>" , podium , <NUM_LIT:10> ) , <EOL> Cycle ( screen , <EOL> FigletText ( "<STR_LIT>" ) , <EOL> centre [ <NUM_LIT:1> ] - <NUM_LIT:4> , <EOL> start_frame = <NUM_LIT:100> ) , <EOL> Print ( screen , SpeechBubble ( "<STR_LIT>" ) , centre [ <NUM_LIT:1> ] + <NUM_LIT:6> , <EOL> start_frame = <NUM_LIT> ) <EOL> ] <EOL> scenes . append ( Scene ( effects , <NUM_LIT> ) ) <EOL> screen . play ( scenes , stop_on_resize = True ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> while True : <EOL> try : <EOL> Screen . wrapper ( demo ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> except ResizeScreenError : <EOL> pass </s>
