Solver CARTOON of a TRUCK on number line
Algebra
->
Number-Line
-> Solver CARTOON of a TRUCK on number line
Log On
Algebra: Number Line
Section
Solvers
Solvers
Lessons
Lessons
Answers archive
Answers
Source code of 'CARTOON of a TRUCK on number line'
This Solver (CARTOON of a TRUCK on number line)
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 train move from point *[input a=10] to point *[input b=0] on the number line. ==section solution perl $x=1; my $str = "cartoon( "; my $comma = ""; my $sprite = "sprite_truckR"; my $change = 1; if( $b < $a ) { $sprite = "sprite_truckL"; $change = -1; } my $i =$a; while( 1 ) { $str .= "$comma\n drawing( 600, 150, 0, 10, 0, 5, "; $str .= "locate_center( $i, 3.5, $sprite( $i ) )"; $str .= ", locate( 0, 3, number_line( 600, 0, 10, X=$i ) )"; $str .= ",locate( $i-2, 4, x=$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