diff --git a/Python/task/ludo screenshot.png b/Python/task/ludo screenshot.png new file mode 100644 index 00000000..83008d30 Binary files /dev/null and b/Python/task/ludo screenshot.png differ diff --git a/Python/task/ludo.py b/Python/task/ludo.py index 2e42b6d4..9514f840 100644 --- a/Python/task/ludo.py +++ b/Python/task/ludo.py @@ -1,27 +1,30 @@ -import random -goal =int(input("enter the goal")) -Player1=0 -Player2=0 -while (Player1!=goal or Player2!=goal): - print("Player 1 turn") - input ("Enter=dice rolls") - roll1=int(random.randint(1,6)) - print("player 1 rolled",roll1) - Player1=Player1+roll1 - if Player1 == goal: - print("player 1 wins") - break - if Player1>goal: - Player1-=roll1 - print("player 1 score is",Player1) - print("Player 2 turn") - input ("Enter=dice rolls") - roll2=int(random.randint(1,6)) - print("player 2 rolled",roll2) - Player2=Player2+roll2 - if Player2 == goal: - print("player 2 wins") - break - if Player2>goal: - Player2-=roll2 - print("player 2 score is",Player2) \ No newline at end of file + +import random +# t is the target for the game +t = int(input("target is:-")) + #s1,s2 are the scores of player1 and player2 +s1=0 +s2=0 +while (s1 t : + s1=s1-dice1 + if s1==t : + print("Player_1 is the winner") + break + + if s2>t : + s2=s2-dice2 + if s2==t : + print("Player_2 is the winner") + break