This repository was archived by the owner on Jun 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSandBox8.py
More file actions
38 lines (34 loc) · 1.56 KB
/
SandBox8.py
File metadata and controls
38 lines (34 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import random
from random import choice
create_perso = input("Voulez-vous créer un personnage ? (O/N) ")
if create_perso == "O":
persos = []
perso = {}
perso['nom'] = input("Nom du personnage : ")
perso['sexe'] = input("Sexe du personnage : ")
perso['race'] = input("Race du personnage : ")
perso['classe'] = input("Classe du personnage : ")
perso['niveau'] = int(input("Niveau du personnage : "))
perso['pv'] = int(input("Points de vie du personnage : "))
perso['dv'] = int(input("Dégâts de l'arme du personnage : "))
persos.append(perso)
print(persos)
print(choice(persos))
else:
print("Ok, au revoir")
# Ici, je dois créer des personnages et le stocker dans une liste...ensuite je dois choisir un personnage dans
# la liste au hasard et le stocker dans une variable perso_to_fight
# ensuite je dois créer un personnage à combattre et le stocker dans une variable perso_to_fight
# ensuite je dois comparer les pv de perso et perso_to_fight et afficher le gagnant
perso_to_fight = {}
perso_to_fight['nom'] = input("Nom du personnage à combattre : ")
perso_to_fight['sexe'] = input("Sexe du personnage à combattre : ")
perso_to_fight['race'] = input("Race du personnage à combattre : ")
perso_to_fight['classe'] = input("Classe du personnage à combattre : ")
perso_to_fight['niveau'] = random.randint(1, 10)
perso_to_fight['pv'] = random.randint(1, 100)
perso_to_fight['dv'] = random.randint(1, 10)
if perso['pv'] > perso_to_fight['pv']:
print("Le personnage a gagné !")
else:
print("Le personnage à combattre a gagné !")