Skip to content

Commit d5cf85b

Browse files
Célande AdrienCDaffyJr
authored andcommitted
[3] add some colors to the winner/loser statement
1 parent eacd610 commit d5cf85b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

torpydo/battleship.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import colorama
44
import platform
55

6-
from colorama import Fore, Back, Style
6+
from colorama import Fore, Style
77
from torpydo.ship import Color, Letter, Position, Ship
88
from torpydo.game_controller import GameController
99
from torpydo.telemetryclient import TelemetryClient
@@ -91,9 +91,6 @@ def start_game():
9191
start_colouring(right_colour(is_hit))
9292
print("Yeah ! Nice hit !" if is_hit else "Miss")
9393
TelemetryClient.trackEvent('Player_ShootPosition', {'custom_dimensions': {'Position': str(position), 'IsHit': is_hit}})
94-
if is_fleet_down(enemyFleet):
95-
print("Congratulations! You are the winner \o/")
96-
break
9794

9895
print( r'''
9996
\ . ./
@@ -106,6 +103,11 @@ def start_game():
106103
\ \ / /''')
107104

108105
end_colouring()
106+
if is_fleet_down(enemyFleet):
107+
start_colouring(Fore.MAGENTA)
108+
print("Congratulations! You are the winner \o/")
109+
end_colouring()
110+
break
109111

110112
print("\n\nComputer is thinking...")
111113
time.sleep(3)
@@ -128,7 +130,9 @@ def start_game():
128130
\ \ / /''')
129131
end_colouring()
130132
if is_fleet_down(myFleet):
133+
start_colouring(Fore.LIGHTRED_EX)
131134
print("Sorry, you lost...")
135+
end_colouring()
132136
break
133137

134138
print("Thank you for playing!")

0 commit comments

Comments
 (0)