Redaction des messages et mini-ajustement|UPDATE pendu.py|Python

This commit is contained in:
Fred Z 2018-01-15 15:06:33 +01:00
parent bce83122c4
commit e9c12fc462

View File

@ -27,21 +27,20 @@ from fonctions import check_letter, cls, stringalise
# Constantes
SCORES_FILE = ".scores"
WORD_LIST_FILE = "dicolight.txt"
ASK_NAME = "ASK_NAME : "
ASK_LETTER = "ASK_LETTER : "
ERR_LETTER_TYPE = "ERR_LETTER_TYPE"
ERR_VALUE_ERR = "ERR_VALUE_ERR"
ERR_WORD_LIST_FILE = "ERR_WORD_LIST_FILE"
ERR_LETTER_LEN = "ERR_LETTER_LEN"
ERR_LETTER_ALPHA = "ERR_LETTER_ALPHA"
ERR_LETTER_USED = "ERR_LETTER_USED"
MAX_TURNS = 16
MAX_TURNS = 12
MAX_NAME_LEN = 7
MIN_NAME_LEN = 2
MSG_END_GAME = "MSG_END_GAME : "
MSG_1ST_GAME = "MSG_1ST_GAME"
MSG_NEW_GAME = "MSG_MEW_GAME"
MSG_SCORES = "MSG_SCORES"
MSG_DISCLAMER = "Bienvenue au zPendu!\nLe but du jeu est de deviner"+\
" un mot de 8 lettres max en moins de {} tours.".format(MAX_TURNS)
ASK_NAME = "Votre nom ({} à {} caratères) : ".format(MIN_NAME_LEN, MAX_NAME_LEN)
ASK_LETTER = "Choisissez une lettre : "
ERR_WORD_LIST_FILE = "\t#!@?# Oups… Le dictionnaire n'est pas accesible! #?@!#"
ERR_LETTER_LEN = "\t#!@?# Oups… Saisie trop courte ou trop longue! #?@!#"
ERR_LETTER_ALPHA = "\t#!@?# Oups… Il faut saisir une lettre! #?@!#"
ERR_LETTER_USED = "\t#!@?# Oups… Cette lettre à déjà été jouée! #?@!#"
MSG_END_GAME = "Partie terminée avec {} point(s).\nLe mot mystère était : \n"
MSG_1ST_GAME = "C'était votre 1ère partie ;-)"
MSG_SCORES = "\n-== Les Scores : ==-"
# Variables
game_continue = True
@ -53,6 +52,8 @@ alphabet = [
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
print(MSG_DISCLAMER)
while (
len(player_name) < MIN_NAME_LEN or
len(player_name) > MAX_NAME_LEN or
@ -115,9 +116,9 @@ while game_continue is True:
# TODO Fin de partie
points = MAX_TURNS - turns
points = (MAX_TURNS - turns) + 1
cls()
print(MSG_END_GAME, points)
print(MSG_END_GAME.format(points))
print(stringalise(target_word))
# TODO Affichage du score de la partie et des highscores