Advertisement
Guest User

CHIFOUMI V1.4 [APPLESCRIPT 2.5]

a guest
Jul 6th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. display dialog "Bienvenue au jeu du Pierre feuille ciseaux" with title "Chifoumi" buttons {"Annuler", "Commencer"} default button 2
  2. set mode to display dialog "Choisissez un mode de jeu:" with title "Chifoumi" buttons {"🤖 Jouer avec un robot", "👫 Jouer à deux"}
  3. if button returned of mode is "👫 Jouer à deux" then
  4.     set j1_score to 0
  5.     set j2_score to 0
  6.     set manche_nbr to 1
  7.     set manches_cmd to display dialog "Combien de manches ?" default answer "3" buttons ("OK") default button 1
  8.     set nbr_manches to text returned of manches_cmd
  9.     set j1_cmd to display dialog "Entrez le nom du joueur n°1 :" default answer "" with title "Chifoumi" buttons ("Valider") default button 1
  10.     set j1_n to text returned of j1_cmd
  11.     set j2_cmd to display dialog "Entrez le nom du joueur n°2 :" default answer "" with title "Chifoumi" buttons ("Valider") default button 1
  12.     set j2_n to text returned of j2_cmd
  13.     repeat nbr_manches times
  14.         display dialog j1_n & " et " & j2_n & ", La manche " & manche_nbr & " va commencer !" with title "Chifoumi"
  15.         display dialog j1_n & " commence !" with title "Chifoumi" buttons ("Démarrer") default button 1
  16.         set j1_di to display dialog j1_n & ", choisis pierre, feuille, ou ciseaux" with title "Chifoumi" buttons {"💎 Pierre", "🍁 Feuille", "✂️ Ciseaux"}
  17.         set j1_ch to button returned of j1_di
  18.         display dialog j2_n & ", à ton tour !" with title "Chifoumi" buttons ("Démarrer") default button 1
  19.         set j2_di to display dialog j2_n & ", choisis pierre, feuille, ou ciseaux" with title "Chifoumi" buttons {"💎 Pierre", "🍁 Feuille", "✂️ Ciseaux"}
  20.         set j2_ch to button returned of j2_di
  21.         display dialog "OK !" with title "Chifoumi" buttons ("Voir les résultats") default button 1
  22.         display notification "Calcul des résultats..." with title "Chifoumi" sound name "Purr"
  23.         delay 1
  24.         if j1_ch = j2_ch then set results to "Match nul !"
  25.         if j1_ch = "💎 Pierre" and j2_ch = "🍁 Feuille" then set results to j2_n & " gagne !"
  26.         if j1_ch = "💎 Pierre" and j2_ch = "✂️ Ciseaux" then set results to j1_n & " gagne !"
  27.         if j1_ch = "🍁 Feuille" and j2_ch = "💎 Pierre" then set results to j1_n & " gagne !"
  28.         if j1_ch = "🍁 Feuille" and j2_ch = "✂️ Ciseaux" then set results to j2_n & " gagne !"
  29.         if j1_ch = "✂️ Ciseaux" and j2_ch = "🍁 Feuille" then set results to j1_n & " gagne !"
  30.         if j1_ch = "✂️ Ciseaux" and j2_ch = "💎 Pierre" then set results to j2_n & " gagne !"
  31.         display dialog j1_n & " : " & j1_ch & "
  32. " & j2_n & " : " & j2_ch & "
  33.  
  34. ★ " & results & " ★" buttons ("OK") with title "Résultats" default button 1
  35.         if results = j1_n & " gagne !" then set j1_score to j1_score + 1
  36.         if results = j2_n & " gagne !" then set j2_score to j2_score + 1
  37.         set manche_nbr to manche_nbr + 1
  38.     end repeat
  39.     if j1_score = j2_score then set score_res to "Match nul !"
  40.     if j1_score < j2_score then set score_res to j2_n & " Gagne !"
  41.     if j2_score < j1_score then set score_res to j1_n & " Gagne !"
  42.     display dialog j1_n & " : " & j1_score & " Points
  43. " & j2_n & " : " & j2_score & " Points
  44.  
  45. ★ " & score_res & " ★" buttons ("OK") with title "Résultats" default button 1
  46. end if
  47. if button returned of mode is "🤖 Jouer avec un robot" then
  48.     set j1_n to "🤖 Robot"
  49.     set j2_cmd to display dialog "Entrez votre nom :" default answer "" with title "Chifoumi" buttons ("Valider") default button 1
  50.     set j2_n to text returned of j2_cmd
  51.    
  52.     display dialog j1_n & " et " & j2_n & ", Le jeu va commencer !" with title "Chifoumi"
  53.     display dialog j2_n & " commence !" with title "Chifoumi" buttons ("Démarrer") default button 1
  54.     set j2_di to display dialog j2_n & ", choisis pierre, feuille, ou ciseaux" with title "Chifoumi" buttons {"💎 Pierre", "🍁 Feuille", "✂️ Ciseaux"}
  55.     set j2_ch to button returned of j2_di
  56.     display dialog "au tour du robot !" with title "Chifoumi" buttons ("Démarrer") default button 1
  57.     display notification "Veuillez patienter..." with title "🤖 le robot choisit..." sound name "Purr"
  58.     random number from 1 to 3
  59.     set bot_nbr to result
  60.     if bot_nbr = 1 then set j1_ch to "💎 Pierre"
  61.     if bot_nbr = 2 then set j1_ch to "🍁 Feuille"
  62.     if bot_nbr = 3 then set j1_ch to "✂️ Ciseaux"
  63.     delay 1
  64.     display dialog "OK !" with title "Chifoumi" buttons ("Voir les résultats") default button 1
  65.     display notification "Calcul des résultats..." with title "Chifoumi" sound name "Purr"
  66.     delay 1
  67.     if j1_ch = j2_ch then set results to "Match nul !"
  68.     if j1_ch = "💎 Pierre" and j2_ch = "🍁 Feuille" then set results to j2_n & " gagne !"
  69.     if j1_ch = "💎 Pierre" and j2_ch = "✂️ Ciseaux" then set results to j1_n & " gagne !"
  70.     if j1_ch = "🍁 Feuille" and j2_ch = "💎 Pierre" then set results to j1_n & " gagne !"
  71.     if j1_ch = "🍁 Feuille" and j2_ch = "✂️ Ciseaux" then set results to j2_n & " gagne !"
  72.     if j1_ch = "✂️ Ciseaux" and j2_ch = "🍁 Feuille" then set results to j1_n & " gagne !"
  73.     if j1_ch = "✂️ Ciseaux" and j2_ch = "💎 Pierre" then set results to j2_n & " gagne !"
  74.     display dialog j1_n & " : " & j1_ch & "
  75. " & j2_n & " : " & j2_ch & "
  76.  
  77. ★ " & results & " ★" buttons ("OK") with title "Résultats" default button 1
  78.    
  79.    
  80. end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement