TP3 cree_jeu
This commit is contained in:
parent
98d620741f
commit
8cd6a24796
|
@ -183,6 +183,17 @@ def cree_jeu(descr):
|
|||
|
||||
CU : le fichier doit contenir une description correcte du jeu (cf lire_donnees)
|
||||
"""
|
||||
plateau = cree_plateau(*lire_donnees(descr))
|
||||
etats_navires = dict()
|
||||
nb_cases_occupees = 0
|
||||
for i in plateau:
|
||||
if type(i) == tuple:
|
||||
if plateau[i] not in etats_navires:
|
||||
etats_navires[plateau[i]] = 0
|
||||
etats_navires[plateau[i]] += 1
|
||||
nb_cases_occupees += 1
|
||||
return {'plateau': plateau, 'nb_cases_occupees' : nb_cases_occupees, \
|
||||
'touches': {'nb_touches': 0, 'etats_navires': etats_navires}, 'coups_joues': set()}
|
||||
|
||||
|
||||
def cree_plateau(l, h, l_nav):
|
||||
|
|
Reference in a new issue