Solver CARTOON of elevator going up and down
Algebra
->
Coordinate-system
-> Solver CARTOON of elevator going up and down
Log On
Algebra: Coordinate systems, graph plotting, etc
Section
Solvers
Solvers
Lessons
Lessons
Answers archive
Answers
Source code of 'CARTOON of elevator going up and down'
This Solver (CARTOON of elevator going up and down)
was created by by
ichudov(507)
:
View Source
,
Show
,
Put on YOUR site
About ichudov
:
I am not a paid tutor, I am the owner of this web site!
==section input See a elevator move from point *[input a=-3] to point *[input b=6] on the Y axis. ==section solution perl $x=1; my $str = "cartoon( "; my $comma = ""; my $sprite = "sprite_elevator"; my $i =$a; while( 1 ) { my $sprite = "sprite_elevator"; $sprite = "sprite_elevator_closed" if (($i != $a) && ($i != $b)); $str .= "$comma\n drawing( 600, 600, -5, 5, -10, 10, grid(0),"; $str .= "locate_center( 0, $i, $sprite( $i ) )"; $str .= ")"; $comma = ","; if( $b > $a ) { $i++; last if $i > $b; } else { $i--; last if $i < $b; } } $str .= "\n)"; print "<CENTER>{{{$str}}}</CENTER><PRE>\n$str\n</PRE>"; ==section output x ==section check x=1