()
| 111 | |
| 112 | |
| 113 | def decision(): # function to calculate score for rock,paper and scissors |
| 114 | attributes["rps_count"] += 1 |
| 115 | rps = attributes["rps"] |
| 116 | if rps[0] == "ROCK": |
| 117 | p1 = 0 |
| 118 | if rps[0] == "PAPER": |
| 119 | p1 = 5 |
| 120 | if rps[0] == "SCISSOR": |
| 121 | p1 = 2 |
| 122 | if rps[1] == "ROCK": |
| 123 | p2 = 0 |
| 124 | if rps[1] == "PAPER": |
| 125 | p2 = 5 |
| 126 | if rps[1] == "SCISSOR": |
| 127 | p2 = 2 |
| 128 | if p1 == 0: |
| 129 | if p2 == 0: |
| 130 | return -1 |
| 131 | elif p2 == 2: |
| 132 | return 1 |
| 133 | else: |
| 134 | return 2 |
| 135 | if p1 == 2: |
| 136 | if p2 == 0: |
| 137 | return 2 |
| 138 | elif p2 == 5: |
| 139 | return 1 |
| 140 | else: |
| 141 | return -1 |
| 142 | if p1 == 5: |
| 143 | if p2 == 0: |
| 144 | return 1 |
| 145 | elif p2 == 2: |
| 146 | return 2 |
| 147 | else: |
| 148 | return -1 |
| 149 | |
| 150 | |
| 151 | def game2_1(clientAddress): |