ello. I need help forming my hierarchy chart from my python code. Can I add comp_move to both get_computer_play() and main() functions? And should I remove import random as it's not a function?

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 13RQ: How is an array stored in main memory? How is a linked list stored in main memory? What are their...
icon
Related questions
Question

Hello. I need help forming my hierarchy chart from my python code. Can I add comp_move to both get_computer_play() and main() functions? And should I remove import random as it's not a function?

def get_user_play(name, rock 8, paper 1, scissors - 2):
move int(input("Enter your move (8 for Rock, 1 for Paper, and 2 for Scissors: "))
if rock move:
print(name, "plays rock, Computer plays ", end-'')
elif paper move:
print(name, "plays paper, Computer plays ", end-'')
elif scissors -- move:
print(name, plays scissors, Computer plays ", end-'')
return nove
import random
def get_computer_play (rock-8, paper 1, scissors - 2):
comp_num= random.randint(0,2)
if rock comp_num:
print("rock")
return rock
elif paper comp_num:
print("paper")
return paper
elif scissors - comp_num:
print("scissors")
return scissors
def main():
name = str(input("Welcome to the game, Rock, Papers, Scissors. You will be playing against the computer. What is your name?: "))
print (f"Here are the rules {name}")
print("If a player chooses Rock and other chooses Scissors, Rock wins.")
print("If a player chooses Scissors and other chooses Paper, Scissors wins.")
print("If a player chooses Paper and other chooses Rock, Paper wins.")
print("If both players make the same choice, it's a tic")
print("Enter -1 to quit the game")
P_win-0
c_win-e
c_tic-0
while True:
main()
user_move = get_user_play(name)
#User winning
if user_move--1:
break
comp_move = get_computer_play()
if user_move -- comp_move:
print("Its a tie')
c_tie-c_tie+1
elif user_move
and comp_move-2: #if user plays rock & computer plays scissors, user wins
print(f'Rock breaks scissors. (name) wins!')
P_win-p_win+1
elif user_move 1 and comp_move 8: #if user plays paper & computer plays rock, user wins
print(f'Paper covers rock. (name) wins!')
P_win-p_win+1
elif user_move -- 2 and comp_move1: sif user plays scissors & computer plays paper, user wins
print(f'Scissors cuts paper. {name} wins!')
P_win-p_win+1
# Computer winning
elif comp_move -- and user_move 2: sif computer plays rock & user plays scissors, computer wins
print (f'Rock breaks scissors. The computer wins!')
c_win - c_win+1
elif comp_move
1 and user_move 8: sif computer plays paper & user plays rock, computer wins
rint(f'Paper covers rock. The computer wins!')
c_win - c_win + 1
2 and user_move 1: #if computer plays scissors & user plays paper, computer wins
print(f'Scissors cuts paper. The computer wins!')
c_win - c_win +1
print (f'There were (c_tie+p_win+c_win} games: (name) won (p_win} games, computer won (c_win) games, and there were (c_tie) ties.')
elif comp_move
Transcribed Image Text:def get_user_play(name, rock 8, paper 1, scissors - 2): move int(input("Enter your move (8 for Rock, 1 for Paper, and 2 for Scissors: ")) if rock move: print(name, "plays rock, Computer plays ", end-'') elif paper move: print(name, "plays paper, Computer plays ", end-'') elif scissors -- move: print(name, plays scissors, Computer plays ", end-'') return nove import random def get_computer_play (rock-8, paper 1, scissors - 2): comp_num= random.randint(0,2) if rock comp_num: print("rock") return rock elif paper comp_num: print("paper") return paper elif scissors - comp_num: print("scissors") return scissors def main(): name = str(input("Welcome to the game, Rock, Papers, Scissors. You will be playing against the computer. What is your name?: ")) print (f"Here are the rules {name}") print("If a player chooses Rock and other chooses Scissors, Rock wins.") print("If a player chooses Scissors and other chooses Paper, Scissors wins.") print("If a player chooses Paper and other chooses Rock, Paper wins.") print("If both players make the same choice, it's a tic") print("Enter -1 to quit the game") P_win-0 c_win-e c_tic-0 while True: main() user_move = get_user_play(name) #User winning if user_move--1: break comp_move = get_computer_play() if user_move -- comp_move: print("Its a tie') c_tie-c_tie+1 elif user_move and comp_move-2: #if user plays rock & computer plays scissors, user wins print(f'Rock breaks scissors. (name) wins!') P_win-p_win+1 elif user_move 1 and comp_move 8: #if user plays paper & computer plays rock, user wins print(f'Paper covers rock. (name) wins!') P_win-p_win+1 elif user_move -- 2 and comp_move1: sif user plays scissors & computer plays paper, user wins print(f'Scissors cuts paper. {name} wins!') P_win-p_win+1 # Computer winning elif comp_move -- and user_move 2: sif computer plays rock & user plays scissors, computer wins print (f'Rock breaks scissors. The computer wins!') c_win - c_win+1 elif comp_move 1 and user_move 8: sif computer plays paper & user plays rock, computer wins rint(f'Paper covers rock. The computer wins!') c_win - c_win + 1 2 and user_move 1: #if computer plays scissors & user plays paper, computer wins print(f'Scissors cuts paper. The computer wins!') c_win - c_win +1 print (f'There were (c_tie+p_win+c_win} games: (name) won (p_win} games, computer won (c_win) games, and there were (c_tie) ties.') elif comp_move
get user-play)
Hierarchy Chart OLAG
move()
Main()
-Play) import random
import random get_computer_play() [main ()
[Comp_num()
namel) [user_movel)
Transcribed Image Text:get user-play) Hierarchy Chart OLAG move() Main() -Play) import random import random get_computer_play() [main () [Comp_num() namel) [user_movel)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Algebraic Expressions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning