Created
November 6, 2022 16:59
-
-
Save fabienhinault/acfd72195353a37398533584340c68f7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
use List::Util qw(zip) | |
@t = ( [ 3, "attaquant", "" ], [ 2, "defenseur", 1]) | |
map { push @$_, ([reverse sort map {(int rand 6) + 1} (1..$_->[0])]) } @t | |
map { print "tirage $_->[1]: @{$_->[3]}\n" } @t | |
@r = map {$_->[0] > $_->[1]} ((zip $t[0]->[3], $t[1]->[3])[0..1]) | |
map { $v = $_->[2]; push @$_, ( - grep $_ == $v, @r) } @t | |
map { print "domage $_->[1]: $_->[4]\n" } @t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment