مشروع لعبة حجر ورقة مقص

مشروع لعبة حجر ورقة مقص

# بدء اللعبة بي رسالة ترحيبية و إختيار المستخدم هل يحتاج المساعدة في اللعبة ام لا
Start = input('Welcome to the Rock, Paper, Scissors game: \nPress Enter to continue or type (Help) for the rules ').lower()
# بدء التحقق من إختيار المستخدم إذا كان يريد المساعدة ام لا
if Start == 'help':
    print('''\n
          ******** RULES *******
          1) You choose and the computer chooses
          2) Rock smashes Scissors -> Rock wins
          3) Scissors cut Paper -> Scissors win
          4) Paper covers Rock -> Paper wins
          ''')
# بدء لعبة و عمل امر ليختار المستخدم حجر او ورقة او مقص
Start_Chose = input('\nEnter your choice (Rock, Paper, Scissors): ').capitalize()
# التحقق ماذا اختار هل المستخدم شيئ من ثلاث الإختيارات ام لا
if Start_Chose == 'Paper' or Start_Chose == 'Scissors' or Start_Chose == 'Rock':
    # إستدعاء مكتبة العشوائية
    import random 
    # عمل متغير يحتوي على اختيار عشوائي 
    Chose_random = random.randint(0,2)
    # التحقق ماذا اختار الكمبيوتر
    if Chose_random == 0:
        choice_computer = 'Paper'
        Choose_computer = '''\nComputer chose:
\n
Paper\n
     _______
---'    ____)____
           ______)
          _______)
         _______)
---.__________)'''
    elif Chose_random == 1:
      choice_computer = 'Scissors'
      Choose_computer = '''\nComputer chose:
\n
Scissors\n
    _______
---'   ____)____
          ______)
       __________)
      (____)
---.__(___)
'''
    
    elif Chose_random == 2:
      choice_computer = 'Rock'
      Choose_computer = '''\nComputer chose:
\n
Rock\n
    _______
---'   ____)
      (_____)
      (_____)
      (____)
---.__(___)
''' # التحقق ماذا اختار المستخدم
    if Start_Chose == 'Paper':
       Start_Chose1 = '''\nYou chose:
\n
Paper\n
     _______
---'    ____)____
           ______)
          _______)
         _______)
---.__________)
'''
    elif Start_Chose == 'Scissors':
        Start_Chose1 = '''\nYou chose:
\n
Scissors\n
    _______
---'   ____)____
          ______)
       __________)
      (____)
---.__(___)'''
    elif Start_Chose == 'Rock':
        Start_Chose1 = '''\nYou chose:
\n
Rock\n
    _______
---'   ____)
      (_____)
      (_____)
      (____)
---.__(___)'''
    # عرض إختيار المستخدم و الكمبيوتر
    print(f'{Start_Chose1} \n\n{Choose_computer}')
    # التحقق و عرض من الفائز
    if choice_computer == Start_Chose:
      print('\nYou tied')
    elif Start_Chose == 'Rock' and choice_computer == 'Scissors':
      print(f'\nWell done, you won, Pick {Start_Chose} wins over Pick {choice_computer}')
    elif Start_Chose == 'Paper' and choice_computer == 'Rock':
      print(f'\nWell done, you won, Pick {Start_Chose} wins over Pick {choice_computer}')
    elif Start_Chose == 'Scissors' and choice_computer == 'Paper':
      print(f'\nWell done, you won, Pick {Start_Chose} wins over Pick {choice_computer}')
    else:
      print(f'\nSorry you lost, computer choice {choice_computer} your choice loses {Start_Chose}')
else:
    print('Invalid choice. Please run the program and choose rock, paper, or scissors.')

3 إعجابات

import hand
import random
print(‘Welcome to the game Rock Paper Scissors’)
message =input(‘Press Enter to complete or type (Help)┈➤’)

if message.capitalize() == “Help”:
print(hand.help)
message = input(“Are you ready to play? (Yes) or (No) ┈➤”).capitalize()
if message == “Yes”:
print(“Let’s start programming”)
elif message == “No”:
print(hand.help2)
else:
print(“Let’s start playing right away”)
choose = input(“:video_game: Choose your move:\n|1 ( Rock​:rock: ) \n|2 ( Paper​:page_facing_up: ) \n|3 ( Scissors​:scissors: ) ┈➤”)
opchn = [“Rock”, “Paper”, “Scissors”]
if choose.capitalize() in opchn:
if choose.capitalize() == “Rock”:
choose=hand.r
elif choose.capitalize() == “Paper”:
choose=hand.p
elif choose.capitalize() == “Scissors”:
choose=hand.c
else:
print(“This option is not available. :cross_mark:”)
luck = random.choice(opchn)
if luck.capitalize() in opchn:
if luck.capitalize() == “Rock”:
luck=hand.r
elif luck.capitalize() == “Paper”:
luck=hand.p
elif luck.capitalize() == “Scissors”:
luck=hand.c
print(f"“”
You chose:
{choose}
computer chose:
{luck}
“”")
if choose == luck:
print(“It’s a draw! :handshake:”)

elif choose == hand.r and luck == hand.c or choose == hand.p and luck == hand.r or choose == hand.c and luck == hand.p:
print(“You win! Congratulations! :tada::trophy:”)

elif choose == hand.r and luck == hand.p or choose == hand.p and luck == hand.c or choose == hand.c and luck == hand.r:
print(“You lost, unfortunately. :disappointed_face: Better luck next time! :four_leaf_clover:”)
else:
print(“An error occurred. :warning: Please try again!”)

إعجابَين (2)