pipe-game

Un jeu de cartes à piper les une dans les autres - retour accueil

git clone git://bebou.netlib.re/pipe-game

Log | Files | Refs | README |

game (607B)


      1 #! /bin/sh
      2 
      3 attack() {
      4 	< ennemy awk -v nb="$1" '/health/ {printf "%s %s\n",$1,$2-nb;next}1' > tmpennemy
      5 	mv tmpennemy ennemy
      6 }
      7 
      8 defend() {
      9 	< player awk -v nb="$1" '/block/ {printf "%s %s\n",$1,nb+$2;next}1' > tmpplayer
     10 	mv tmpplayer player
     11 }
     12 
     13 while ! grep -q "block: 10" player;do
     14 	sources=$(find cards/sources -type f | shuf | head -n2 | sort)
     15 	filters=$(find cards/filters -type f | shuf | head -n7 | sort)
     16 	cardnames=$(echo "$sources\n$filters" | xargs -n1 basename)
     17 	echo "$sources\n$filters" | xargs -I {} cp {} .
     18 	printf "%s\n" "$cardnames" | ./interface > actions
     19 	. ./actions
     20 	rm $cardnames
     21 done
     22