DM : Affichage des règles d'un jeu !

 

 

 J'aimerais afficher les règles du jeu !


Rules of the game
Rule 1: 🧻 wins 🪨
Rule 2: 🪨 wins ✂️
Rule 3: ✂️ wins 🧻
✂️  plays against 🧻
         RULE : ✂️  would winw against 🧻
🏆PLAYER1 WINS

Mais comment eviter ce genre d'écriture ! 

if (player1 == '🪨' && player2 == '🧻' ||
  player1 == '🧻' && player2 == '✂️' ||
  player1 == '✂️' && player2 == '🪨') {
  msg = 'player1 lost';
}
if (player1 == '🪨' && player2 == '✂️' ||
  player1 == '🧻' && player2 == '🪨' ||
  player1 == '✂️' && player2 == '🧻') {
  msg = 'player1 win';
}

Il est clair qu'il faut pouvoir changer de formes ou des règles facilement !

Rules of the game
Rule 1: 1️⃣  wins 2️⃣
Rule 2: 2️⃣  wins 3️⃣
Rule 3: 3️⃣  wins 1️⃣
3️⃣   plays against 2️⃣
         RULE : 3️⃣   would win against 1️⃣
 PLAYER1 LOSES!

Rules of the game
Rule 1: ✌️  wins 🖖
Rule 2: 🖖 wins ✊
Rule 3: ✊ wins ✌️
🖖  plays against 🖖
         RULE : 🖖  would win against ✊
DRAW