From 133aaf07906065cefe78ffd66bbcfa0a551e5e5b Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Mon, 16 Feb 2015 12:59:07 +0100 Subject: [PATCH 1/2] =?UTF-8?q?AUTO=20Cr=C3=A9e=20liens=20symboliques=20s?= =?UTF-8?q?=20et=20t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto.py | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 auto.py diff --git a/auto.py b/auto.py old mode 100644 new mode 100755 index d076153..e547efc --- a/auto.py +++ b/auto.py @@ -78,4 +78,6 @@ def creerZip(semestre, tp): fichierZip.write(os.path.join(chem, f), os.path.join(nomDossier, f)) fichierZip.close() +os.link(chemin(semestreEnCours(), tpEnCours()), 't') +os.link(chemin(semestreEnCours()), 's') creerZip(semestreEnCours(), tpEnCours()) From ad24bff223f0ec34f4f62b39200d2b86d9e7ee31 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Mon, 16 Feb 2015 14:29:35 +0100 Subject: [PATCH 2/2] TP3 Affichage plateau graphique --- S2/TP3/bataille_navale.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/S2/TP3/bataille_navale.py b/S2/TP3/bataille_navale.py index 4330eaa..4558db3 100755 --- a/S2/TP3/bataille_navale.py +++ b/S2/TP3/bataille_navale.py @@ -68,6 +68,7 @@ def jouer(nom, descr): decrire_le_jeu(jeu) nbre_tirs = 0 while not tous_coules(jeu): + afficher_jeu(jeu) tir = lire_un_tir(nom) nbre_tirs += 1 nav, res = analyse_un_tir(jeu, tir) @@ -291,6 +292,17 @@ def decrire_le_jeu(jeu): print( 'À vous de jouer en répondant à l\'invite ?- par deux nombres séparés par une virgule.') +def afficher_jeu(jeu): + for x in range(1, jeu['plateau']['larg']+1): + for y in range(1, jeu['plateau']['haut']+1): + if (x, y) in jeu['coups_joues']: + if (x, y) in jeu['plateau']: + print('o', end='') + else: + print('x', end='') + else: + print('.', end='') + print() def lire_un_tir(nom): """