Advertisement
GalinaKG

Mini demo game "Conquest"

May 19th, 2022
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.04 KB | None | 0 0
  1. import random
  2.  
  3. countries = ['Romania', 'Serbia', 'Macedonia', 'Greece', 'Turkey', 'Albania', 'Hungary', 'Austria', 'Germany', 'France']
  4. conquest_country = []
  5.  
  6. gold_player = 0
  7. power_player = 0
  8. gold_computer = 0
  9. power_computer = 0
  10. next_will_be = ''
  11.  
  12. who_s_first = ['player', 'computer']
  13. first_will_be = random.choice(who_s_first)
  14. your_name = input('What is your name?\n')
  15. print('***********************************************************************')
  16. print(f'* Hello, {your_name}. Welcome to the game "Conquest"! I wish you good luck! *')
  17. print('***********************************************************************\n')
  18. print(f'{first_will_be} will start to play first.')
  19.  
  20. for _ in range(0, 30):
  21.     conquest = random.choice(countries)
  22.     country = conquest
  23.  
  24.     if country not in conquest_country:
  25.         conquest_country.append(conquest)
  26.     else:
  27.         continue
  28.  
  29.     if next_will_be:
  30.         print(f'Is your turn {next_will_be}!')
  31.     print(f'You will fight for {country}.\n')
  32.  
  33.     if country in ['Romania', 'Serbia', 'Macedonia', 'Albania']:
  34.         if first_will_be == 'computer':
  35.             gold_computer += 100
  36.             power_computer += 1000
  37.         elif first_will_be == 'player':
  38.             gold_player += 100
  39.             power_player += 1000
  40.             fight = input('Press "f" to fight: ')
  41.         if next_will_be == 'computer':
  42.             gold_computer += 100
  43.             power_computer += 1000
  44.         elif next_will_be == 'player':
  45.             gold_player += 100
  46.             power_player += 1000
  47.             print('Press "f" to fight: ')
  48.             fight = input()
  49.  
  50.     elif country in ['Greece', 'Turkey', 'Hungary', 'Austria']:
  51.         if first_will_be == 'computer':
  52.             gold_computer += 150
  53.             power_computer += 1500
  54.         elif first_will_be == 'player':
  55.             gold_player += 150
  56.             power_player += 1500
  57.             fight = input('Press "f" to fight: ')
  58.         if next_will_be == 'computer':
  59.             gold_computer += 150
  60.             power_computer += 1500
  61.         elif next_will_be == 'player':
  62.             gold_player += 150
  63.             power_player += 1500
  64.             fight = input('Press "f" to fight: ')
  65.  
  66.     elif country in ['Germany', 'France']:
  67.         if first_will_be == 'computer':
  68.             gold_computer += 200
  69.             power_computer += 2000
  70.         elif first_will_be == 'player':
  71.             gold_player += 200
  72.             power_player += 2000
  73.             fight = input('Press "f" to fight: ')
  74.         if next_will_be == 'computer':
  75.             gold_computer += 200
  76.             power_computer += 2000
  77.         elif next_will_be == 'player':
  78.             gold_player += 200
  79.             power_player += 2000
  80.             fight = input('Press "f" to fight: ')
  81.  
  82.     if next_will_be == 'computer':
  83.         next_will_be = 'player'
  84.     else:
  85.         next_will_be = 'computer'
  86.  
  87.     if first_will_be == 'computer':
  88.         next_will_be = 'player'
  89.         first_will_be = ''
  90.     elif first_will_be == 'player':
  91.         next_will_be = 'computer'
  92.         first_will_be = ''
  93.  
  94. print('Now you will see the RESULT:')
  95. print('----------------------------')
  96. print(f'Player power is {power_player} and gain {gold_player} gold.')
  97. print(f'Computer power is {power_computer} and gain {gold_computer} gold.')
  98.  
  99. if gold_player > gold_computer:
  100.     gold_player += gold_computer
  101.     print('Player will use the all gold for refreshing Bulgarian economy.')
  102.     print(f'Total gold: {gold_player}.')
  103. elif gold_computer > gold_player:
  104.     print('Computer doesn`t need the gold. Will give it all for charity!')
  105. elif gold_player == gold_computer:
  106.     print(f'Player and computer will give {gold_player + gold_computer} gold for charity.')
  107.  
  108. if power_player > power_computer:
  109.     print(f'Player you win the game and join all the territories of the countries to Bulgaria!')
  110. elif power_computer > power_player:
  111.     print(f'Computer wins this game. But one game over doesn`t mean the war is won!')
  112. elif power_player == power_computer:
  113.     print('You will need to fight again!!!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement