vendredi 17 juillet 2020

I'm making a rock/paper/scissors game between mltiple "cpu's"

I have the relevant code below. The "cpu's" are represented by two random numbers. It's supposed to move on to the actual game, but this error keeps getting in the way: Traceback (most recent call last): File "main.py", line 64, in <module> if (randNum1 < 0.3): TypeError: '<' not supported between instances of 'builtin_function_or_method' and 'float' I've tried moving where I defined randNum1 and 2 and tried making them into integers, but I'm really new to programming and am kinda lost

   x = 1
   (randNum2) = random.random
   (randNum1) = random.random

   evePlay = "play"
   while evePlay != "stop":
     x = 1

    
     
     if (randNum1 < 0.3):
       pMove = "scissors"
     elif (randNum1 < 0.6):
       pMove = "rock"
     else:
       pMove = "paper"
     if (randNum2 < 0.3):
       cMove = "rock"
     elif (randNum2 < 0.6):
       cMove = "paper"
     else:
       cMove = "scissors"

     p1Int = moveToInt(pMove)
     p2Int = moveToInt(cMove)
     winner = winCheck(p1Int, p2Int)```
Thanks a lot



Aucun commentaire:

Enregistrer un commentaire