Last active
December 11, 2018 02:03
-
-
Save zengargoyle/c37970b0050053f653d923d961c69660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
class P { | |
has $.x; | |
has $.y; | |
has $.vx; | |
has $.vy; | |
} | |
sub Pprint (@p is copy) { | |
use Terminal::Print; | |
my $xoff = @p.map(*.x).min; | |
my $yoff = @p.map(*.y).min; | |
@p .= map({.x - $xoff, .y -$yoff}); | |
my $s = Terminal::Print.new; | |
$s.initialize-screen; | |
for @p -> ($x,$y) { | |
$s.print-cell($x,$y,'*'); | |
# $s.shutdown-screen; | |
} | |
} | |
my @P = do for "small".IO.lines.comb(/'-'?\d+/)>>.Int -> $x,$y,$vx,$vy { P.new: :$x, :$y, :$vx, :$vy } | |
Pprint(@P); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $xoff = @p.map(*.x).min; | |
my $yoff = @p.map(*.y).min; | |
say "$xoff $yoff"; | |
say @p.map({.x, .y}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-2 -2 | |
((9 1) (7 0) (3 -2) (6 10) (2 -4) (-6 10) (1 8) (1 7) (-3 11) (7 6) (-2 3) (-4 3) (10 -3) (5 11) (4 7) (8 -2) (15 0) (1 6) (8 9) (3 3) (0 5) (-2 2) (5 -2) (1 4) (-2 7) (3 6) (5 0) (-6 0) (5 9) (14 7) (-3 6)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment