Created
November 4, 2022 15:23
-
-
Save fabienhinault/39f3671ec76b5b6d29c62e32641b371b 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
cat /dev/urandom | tr -dc '1-6' | head -c 3 | sed -r 's/(.)/\1\n/g' | sort -r > DA ; echo 'tirage attaquant'; cat DA; cat /dev/urandom | tr -dc '1-6' | head -c 2 | sed -r 's/(.)/\1\n/g' | sort -r > DD ; echo 'tirage défenseur'; cat DD; paste DA DD | head -n 2 | sed -e '1 iA=0; D=0' -e 's/\([1-6]\).*\([1-6]\)/if [[ \1 -le \2 ]]; then A=\$(( A - 1 )); else D=\$(( D - 1 )); fi/' -e '$ aecho attaquant \$A ; echo defenseur \$D ' | bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment