Bon nombre d’entre vous connaissent le jeu traditionnel « Pierre, Feuille, Ciseaux » mais beaucoup moins pourrait connaître sa variante plus récente: « Pierre, Feuille, Ciseaux, Lézard, Spock ».

Selon Sam Kass et Karen Bryla, qui ont inventés ou plutôt « fait évolué » le jeu de sorte à augmenter la probabilité, que la partie ne finisse pas en match nul. Effectivement, dans le jeu traditionnel ça se termine trop souvent par une égalité car avec seulement trois choix possibles, il existe une chance sur trois d’avoir fait le même choix (Pierre, Feuille ou Ciseaux). Avec cinq possibilités au lieu de trois, seulement une chance sur cinq conduit à un match nul, tandis que deux sur cinq conduisent à une victoire ou perte. Cela rend le jeux sûrement plus intéressant!
Voici une vidéo du Docteur Sheldon Cooper montrant les règles du jeu :
Jouer à pierre,feuille,ciseaux, lézard, Spock dans son terminal
Pour pouvoir jouer à ce jeu:
- il faut copier le code suivant dans un fichier:
nano spock
#!/bin/bash
#Rock, Paper, Scissors, Lizard, Spock
clear
gethelp () {
# Instructions and options
echo -e \\033[33\;1m"Run script without options to get this help;
Run with option \"a\" for [a]utomated (CPU vs CPU) game;
Run with option \"h\" for [h]uman (Player vs CPU) game."\\033[0m
# Theory and author's web page
echo -e \\033[32m"---
The Theory:
Scissors cut paper, Paper covers rock,
Rock crushes lizard, Lizard poisons Spock,
Spock smashes scissors, Scissors decapitate lizard,
Lizard eats paper, Paper disproves Spock,
Spock vaporizes rock, Rock crushes scissors.
Visit http://www.samkass.com/theories/RPSSL.html
---"\\033[0m
# Results table
echo -e \\033[33\;1m"Table usage: Result of \"row\" to \"column\" draw
0: draw / 1: \"row\" loses to \"column\" / 2: \"row\" wins to \"column\"
----------------------------------------------------
| Rock | Paper | Scissors | Lizard | Spock |
--------|------|-------|----------|--------|-------|
Rock | 0 | 1 | 2 | 2 | 1 |
--------|------|-------|----------|--------|-------|
Paper | 2 | 0 | 1 | 1 | 2 |
--------|------|-------|----------|--------|-------|
Scissors| 1 | 2 | 0 | 2 | 1 |
--------|------|-------|----------|--------|-------|
Lizard | 1 | 2 | 1 | 0 | 2 |
--------|------|-------|----------|--------|-------|
Spock | 2 | 1 | 2 | 1 | 0 |
----------------------------------------------------
Examples: Rock (r1) vs. Paper (c2) -> Result: 1 -> Rock loses on Paper
Lizard (r4) vs. Spock (c5) -> Result: 2 -> Lizard wins on Spock"\\033[0m
}
# Print help and exit with no/invalid options
[[ -z $1 ]] || [[ ${1^} != [A\|H] ]] && gethelp && exit 0
game_type=${1^}
pl_score=0
opp_score=0
hand_count=0
human_player () {
echo -ne "Draw your hand: \\033[35;4;1mR\\033[0mock, \\033[35;4;1mP\\033[0maper, \\033[35;4;1mS\\033[0mcissors,
\\033[35;4;1mL\\033[0mizard or Spoc\\033[35;4;1mk\\033[0m [R,P,S,L,K], X to finish > "
read -n 1 pl_hand; sleep 0.3
[[ "${pl_hand^}" = "X" ]] && final_score && exit 0
until [[ "${pl_hand^}" =~ [R|P|L|S|K] ]]
do
echo
echo -n "Invalid draw, please retry (R, P, S, L, K) > "
read -n 1 pl_hand; sleep 0.3
done
pl_res=$(echo ${pl_hand^} | sed 'y/RPSLK/01234/')
}
final_score () {
if [[ $pl_score -gt $opp_score ]]
then
winner="Player wins!"
elif [[ $pl_score -lt $opp_score ]]
then
winner="Opponent wins!"
else
winner="it's a draw!"
fi
echo -e \\n"Final score: Player $pl_score - $opp_score Opponent
after $hand_count hand(s) $winner"
}
draw_hands () {
if [[ "$game_type" = "A" ]]
then
pl_res=$(($RANDOM%5))
else
human_player
fi
opp_res=$(($RANDOM%5))
pl_draw=${draws[$pl_res]}
opp_draw=${draws[$opp_res]}
hand_count=$(($hand_count+1))
case "${results[$pl_res]:$opp_res:1}" in
0 ) result_string="Draw!"
color=33 ;;
1 ) opp_score=$(($opp_score+1))
color=32
result_string="Opponent wins!" ;;
2 ) pl_score=$(($pl_score+1))
color=31
result_string="Player wins!" ;;
esac
# Print hand result
printf "\n\033[31mPlayer \033[31;1m[%8s]\033[0m:\033[32;1m[%8s]\033[0m \033[32mOpponent \033[$color;1m-> %s\033[0m\n" "$pl_draw" "$opp_draw" "$result_string"
# Print score
printf "\033[31mPlayer \033[31;1m[%8u]\033[0m:\033[32;1m[%8u]\033[0m \033[32mOpponent\033[0m after %u hand(s)\n\r" "$pl_score" "$opp_score" "$hand_count"
}
declare -a draws=(Rock Paper Scissors Lizard Spock)
declare -a results=(01221 20112 12021 12102 21210)
again="q"
until [ "${again^}" = "X" ]
do
draw_hands
if [[ "$game_type" = "A" ]]
then
echo -n "Continue? (x/X to finish, any key to continue): "
read -n 1 again
fi
done
final_score
exit
chmod +x spock
./spock

Merci! (And that’s almost all my French skills…)
I am happy you appreciated the post.
Hi,
I find this very nice game ! :-D
Je pensais que c’était une variante créer pour la série , merci de me faire coucher moins bete