@ash15khng/

EnragedVitalEmulators challenge

Python

default name challenge

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6284911487731109","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IyBob3cgYW0gaSBzdXBwb3NlZCB0byBtYWtlIGEgZW11bGF0b3IgaW4gcHl0aG9uIHdpdGggbXkgbGltaXRlZCBrbm93bGVkZ2UKIyBhbHNvIGhvdyBpcyBhbiBlbXVsYXRvciB2aXRhbAojIGFuZCBlbnJhZ2VkCiMgaSBndWVzcyBpbSBtYWtpbmcgYSByb2NrIHBhcGVyIHNjaXNzb3JzICJlbXVsYXRvciIgCiMgaSB0aGluayB0aGlzIGlzIGNoZWF0aW5nIGJ1dCBvawppbXBvcnQgcmFuZG9tCnJhbmRvbW9wdGlvbiA9IDAKcGxheWVyb3B0aW9uID0gMApwbGF5ZXJzY29yZSA9IDAKY29tc2NvcmUgPSAwIApyb3VuZG51bSA9IDAKZGVmIHNldG51bWJlcihvcHRpb24pOgogIGdsb2JhbCBwbGF5ZXJvcHRpb24KICBpZiBvcHRpb24gPT0gInMiOgogICAgcGxheWVyb3B0aW9uID0gMQogIGlmIG9wdGlvbiA9PSAicCI6CiAgICBwbGF5ZXJvcHRpb24gPSAyCiAgaWYgb3B0aW9uID09ICJyIjoKICAgIHBsYXllcm9wdGlvbiA9IDMKZGVmIHNldG5hbWUocm9wdGlvbiwgcG9wdGlvbik6CiAgZ2xvYmFsIHBsYXllcm9wdGlvbiwgcmFuZG9tb3B0aW9uCiAgaWYgcm9wdGlvbiA9PSAxOgogICAgcmFuZG9tb3B0aW9uID0gInNjaXNzb3JzIgogIGlmIHJvcHRpb24gPT0gMjoKICAgIHJhbmRvbW9wdGlvbiA9ICJwYXBlciIKICBpZiByb3B0aW9uID09IDM6CiAgICByYW5kb21vcHRpb24gPSAicm9jayIKICBpZiBwb3B0aW9uID09IDE6CiAgICBwbGF5ZXJvcHRpb24gPSAic2Np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oY29tc2NvcmUpKQogIGVsc2U6CiAgICBzZXRuYW1lKHJhbmRvbW9wdGlvbiwgcGxheWVyb3B0aW9uKQogICAgcHJpbnQoIkNvbXB1dGVyJ3MgJXMgYmVhdHMgeW91ciAlcywgeW91IGxvc2UgOigiICUocmFuZG9tb3B0aW9uLCBwbGF5ZXJvcHRpb24pKQogICAgY29tc2NvcmUgKz0gMQogICAgcm91bmRudW0gKz0gMQogICAgcHJpbnQoIlRoZSBzY29yZSBpcyAiK3N0cihwbGF5ZXJzY29yZSkrIi0iK3N0cihjb21zY29yZSkpCndoaWxlIHJvdW5kbnVtIDwgNTogICAgCiAgcmFuZG9tb3B0aW9uID0gcmFuZG9tLnJhbmRpbnQoMSwzKQogIHBsYXllcm9wdGlvbiA9IGlucHV0KCJXaGF0IGlzIHlvdXIgb3B0aW9uPyByL3AvcyAiKQogIGNoZWNrdmFsaWQoKQogIG9uZXJvdW5kKCkKaWYgcGxheWVyc2NvcmUgPT0gMzoKICBwcmludCgiWW91IHdpbiEiKQplbGlmIGNvbXNjb3JlID09IDM6CiAgcHJpbnQoIllvdSBsb3NlLi4uIikKCiMgdGhpcyBjb2RlIGlzIG9sZCBhbmQgYmFkZGRk"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# how am i supposed to make a emulator in python with my limited knowledge
# also how is an emulator vital
# and enraged
# i guess im making a rock paper scissors "emulator" 
# i think this is cheating but ok
import random
randomoption = 0
playeroption = 0
playerscore = 0
comscore = 0 
roundnum = 0
def setnumber(option):
  global playeroption
  if option == "s":
    playeroption = 1
  if option == "p":
    playeroption = 2
  if option == "r":
    playeroption = 3
def setname(roption, poption):
  global playeroption, randomoption
  if roption == 1:
    randomoption = "scissors"
  if roption == 2:
    randomoption = "paper"
  if roption == 3:
    randomoption = "rock"
  if poption == 1:
    playeroption = "scissors"
  if poption == 2:
    playeroption = "paper"
  if poption == 3:
    playeroption = "rock"
def checkvalid(): 
  if playeroption!="s" and playeroption!="r" and playeroption!="p":
    print("Invalid option "+playeroption)
    exit()
def oneround():
  global playerscore, comscore, roundnum
  setnumber(playeroption)
  if playeroption < randomoption or playeroption == 3 and randomoption == 1:
    setname(randomoption, playeroption)
    print(" Your %s beats computer's %s, you win!" % (playeroption, randomoption))
    playerscore += 1
    roundnum += 1
    print("The score is "+str(playerscore)+"-"+str(comscore))
  elif playeroption == randomoption:
    setname(randomoption, playeroption)
    print("Your %s and computer's %s result in a tie!" % (playeroption, randomoption))
    print("The score is "+str(playerscore)+"-"+str(comscore))
  else:
    setname(randomoption, playeroption)
    print("Computer's %s beats your %s, you lose :(" %(randomoption, playeroption))
    comscore += 1
    roundnum += 1
    print("The score is "+str(playerscore)+"-"+str(comscore))
while roundnum < 5:    
  randomoption = random.randint(1,3)
  playeroption = input("What is your option? r/p/s ")
  checkvalid()
  oneround()
if playerscore == 3:
  print("You win!")
elif comscore == 3:
  print("You lose...")

# this code is old and badddd