Skip to content

Instantly share code, notes, and snippets.

@fabienhinault
Created November 6, 2022 17:01
Show Gist options
  • Save fabienhinault/3dc80f48b6a1a0f18f9ce14b74684c9c to your computer and use it in GitHub Desktop.
Save fabienhinault/3dc80f48b6a1a0f18f9ce14b74684c9c to your computer and use it in GitHub Desktop.
use List::Util qw(zip)
@a = reverse sort map {int(rand 6) + 1} (1..3)
print "tirage attaquant: @a\n"
@d = reverse sort map {int(rand 6) + 1} (1,2)
print "tirage defenseur: @d\n"
@r = map {$_->[0] > $_->[1]} ((zip \@a, \@d)[0..1])
$dd = - grep $_ == 1, @r
$da = - grep($_ == "", @r)
print "dommage attaquant:$da\n"
print "dommage défenseur:$dd\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment