diff options
| -rw-r--r-- | challenge-101/james-smith/perl/ch-2.pl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-101/james-smith/perl/ch-2.pl b/challenge-101/james-smith/perl/ch-2.pl index e68bdbbca8..e9fbf7ed2c 100644 --- a/challenge-101/james-smith/perl/ch-2.pl +++ b/challenge-101/james-smith/perl/ch-2.pl @@ -23,9 +23,9 @@ sub winding_number { ## crosses the +ve axis (adding or subtracking 1 depending on the ## direction) - this boils down to the algorithm below.. - my @pts = @_; - my ($a,$b,$wn) = @pts[-2,-1],0; - while( my($x,$y) = splice @pts,0,2 ) { + my ( $a, $b, $wn ) = @_[ -2, -1 ], 0; + + while( my($x,$y) = splice @_, 0, 2 ) { $wn += $a<=0 ? $y>0 && $a*$y-$x*$b > 0 ? 1 : 0 : $y<=0 && $a*$y-$x*$b <= 0 ? -1 : 0; ($a,$b)=($x,$y); |
