|
6 | 6 | """
|
7 | 7 | # Function rock_paper_scissor--->
|
8 | 8 | def rock_paper_scissor(num1,num2,bit1,bit2):
|
9 |
| - p1=int(num1[bit1])%3 |
10 |
| - p2=int(num2[bit2])%3 |
11 |
| - if(player_one[p1]==player_two[p2]): |
| 9 | + play_pos1=int(num1[bit1])%3 #Play Position For Player 1 |
| 10 | + play_pos2=int(num2[bit2])%3 #Play Position For Player 2 |
| 11 | + if(player_one[play_pos1]==player_two[play_pos2]): |
12 | 12 | print("Draw")
|
13 |
| - elif(player_one[p1]=="Rock" and player_two[p2]=="Scissor"): |
| 13 | + elif(player_one[play_pos1]=="Rock" and player_two[play_pos2]=="Scissor"): |
14 | 14 | print("Player one wins!!")
|
15 |
| - elif(player_one[p1]=="Rock" and player_two[p2]=="Paper"): |
| 15 | + elif(player_one[play_pos1]=="Rock" and player_two[play_pos2]=="Paper"): |
16 | 16 | print("Player two wins!!")
|
17 |
| - elif(player_one[p1]=="Paper" and player_two[p2]=="Scissor"): |
| 17 | + elif(player_one[play_pos1]=="Paper" and player_two[play_pos2]=="Scissor"): |
18 | 18 | print("Player two wins!!")
|
19 |
| - elif(player_one[p1]=="Paper" and player_two[p2]=="Rock"): |
| 19 | + elif(player_one[play_pos1]=="Paper" and player_two[play_pos2]=="Rock"): |
20 | 20 | print("Player one wins!!")
|
21 |
| - elif(player_one[p1]=="Scissor" and player_two[p2]=="Rock"): |
| 21 | + elif(player_one[play_pos1]=="Scissor" and player_two[play_pos2]=="Rock"): |
22 | 22 | print("Player two wins!!")
|
23 |
| - elif(player_one[p1]=="Scissor" and player_two[p2]=="Paper"): |
| 23 | + elif(player_one[play_pos1]=="Scissor" and player_two[play_pos2]=="Paper"): |
24 | 24 | print("Player one wins!!")
|
25 | 25 |
|
26 | 26 | # Main Function To Execute Rock Paper Scissor
|
|
0 commit comments