@JAGMAN248/

Roll the Dice

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.55292929516639","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHRpbWUsIHN5cywgbWF0aCwgcmFuZG9tCgpkZWYgZGlhbG9nKGRpYWxvZykgOgogIGZvciBjaGFyYWN0ZXIgaW4gZGlhbG9nOgogICAgc3lzLnN0ZG91dC53cml0ZShjaGFyYWN0ZXIpCiAgICBzeXMuc3Rkb3V0LmZsdXNoKCkKICAgIHRpbWUuc2xlZXAoMC4wMjUpCiAgdGltZS5zbGVlcCgwLjI1KQogIHByaW50KCIiKQoKZ29sZCA9IDEwCmRpYWxvZygiQmV0IGdvbGQgYW5kIHdpbiBjb2lucywgaWYgeW91IGdldCB0byAxMDAgeW91IHdpbiIpCmRpYWxvZygiQ2hvb3NlIGEgbnVtYmVyIGJldHdlZW4gMS0xMiIpCiNkaWFsb2coIjIgb3IgMTI6IDIuNzglLiAxMHggYmV0IGlmIGNvcnJlY3QiKQojZGlhbG9nKCIzIG9yIDExOiA1LjU2JS4gNXggYmV0IGlmIGNvcnJlY3QiKQojZGlhbG9nKCI0IG9yIDEwOiA4LjMzJS4gM3ggYmV0IGlmIGNvcnJlY3QiKQojZGlhbG9nKCI1IG9yIDk6IDExLjExJS4gMnggYmV0IGlmIGNvcnJlY3QiKQojZGlhbG9nKCI2IG9yIDg6IDEzLjg5JS4gMS41eCBiZXQgaWYgY29ycmVjdCIpCiNkaWFsb2coIjc6IDE2LjY3JS4gMS4yNXggYmV0IGlmIGNvcnJlY3QiKQpwcmludCgiIikKYmV0ID0gIjAiCmRpY2VHdWVzcyA9ICIwIgoKd2hpbGUgZ29sZCA+IDAgOgoJd2hpbGUgYmV0ID09ICIwIiA6CgkJYmV0ID0gaW5wdXQoIkhvdyBtdWNoIGRvIHlvdSBiZXQ/IFlvdSBoYXZlICIgKyBzdHIoZ29sZCkgKyAi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3VyIGJldCEiKSAKCQkJCQkJCWdvbGQgPSBnb2xkICsgYmV0ICogMgoJCQkJCQllbGlmIHJvbGwgPT0gNiBvciByb2xsID09IDggOgoJCQkJCQkJZGlhbG9nKCJZb3Ugd29uIDEuNXggeW91ciBiZXQhIikKCQkJCQkJCWdvbGQgPSBnb2xkICsgcm91bmQoYmV0KjEuNSkKCQkJCQkJZWxpZiByb2xsID09IDcgOgoJCQkJCQkJZGlhbG9nKCJZb3Ugd29uIDEuMjV4IHlvdXIgYmV0ISIpCgkJCQkJCQlnb2xkID0gZ29sZCArIHJvdW5kKGJldCoxLjI1KQoJCQkJCQlkaWFsb2coIkN1cnJlbnQgZ29sZCAiICsgc3RyKGdvbGQpKQoJCQkJCQlpZiBnb2xkID49IDEwMCA6CgkJCQkJCQlkaWFsb2coIllvdSB3aW4gdGhlIGdhbWUhIikKCQkJCQkJCWJyZWFrCgkJCQkJZWxzZSA6CgkJCQkJCWRpYWxvZygiWW91ciBndWVzcyB3YXMgaW5jb3JyZWN0Li4uIikKCQkJCQkJcHJpbnQoZ29sZCkKCQkJCQkJaWYgZ29sZCA8PSAwIDoKCQkJCQkJCWRpYWxvZygiWW91IGhhdmUgbm8gbW9yZSBtb25leSIpCgkJCQkJCQlicmVhayAKCQkJCQliZXQgPSAiMCI="},"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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import time, sys, math, random

def dialog(dialog) :
  for character in dialog:
    sys.stdout.write(character)
    sys.stdout.flush()
    time.sleep(0.025)
  time.sleep(0.25)
  print("")

gold = 10
dialog("Bet gold and win coins, if you get to 100 you win")
dialog("Choose a number between 1-12")
#dialog("2 or 12: 2.78%. 10x bet if correct")
#dialog("3 or 11: 5.56%. 5x bet if correct")
#dialog("4 or 10: 8.33%. 3x bet if correct")
#dialog("5 or 9: 11.11%. 2x bet if correct")
#dialog("6 or 8: 13.89%. 1.5x bet if correct")
#dialog("7: 16.67%. 1.25x bet if correct")
print("")
bet = "0"
diceGuess = "0"

while gold > 0 :
	while bet == "0" :
		bet = input("How much do you bet? You have " + str(gold) + " ")
		bet = int(bet)
		if int(bet) > gold or int(bet) < 0:
			dialog("Please enter in a sufficient number")
			bet = "0"
		else :
			gold = gold - bet 
			diceGuess = "0"
			while diceGuess == "0" :
				diceGuess = input("Chose a number between 2-12 ")
				diceGuess = int(diceGuess)
				if int(diceGuess) > 12 or int(diceGuess) < 2 :
					dialog("Please enter in a sufficient number")
					diceGuess = "0"
				else :
					dice1 = random.randint(1, 6)
					dice2 = random.randint(1, 6)
					if dice1 == 1 :
						dialog("Dice 1: #")
					elif dice1 == 2 :
						dialog("Dice 1: ##")
					elif dice1 == 3 :
						dialog("Dice 1: ###")
					elif dice1 == 4 :
						dialog("Dice 1: ####")
					elif dice1 == 5 :
						dialog("Dice 1: #####")
					elif dice1 == 6 :
						dialog("Dice 1: ######")
					if dice2 == 1 :
						dialog("Dice 2: #")
					elif dice2 == 2 :
						dialog("Dice 2: ##")
					elif dice2 == 3 :
						dialog("Dice 2: ###")
					elif dice2 == 4 :
						dialog("Dice 2: ####")
					elif dice2 == 5 :
						dialog("Dice 2: #####")
					elif dice2 == 6 :
						dialog("Dice 2: ######")
					roll = dice1 + dice2
					dialog("The roll was " + str(roll))
					if roll == diceGuess :
						dialog("You guessed correctly!")
						if roll == 2 or roll == 12 :
							dialog("You won 10x your bet!")
							gold = gold + bet * 10
						elif roll == 3 or roll == 11 :
							dialog("You won 5x your bet!") 
							gold = gold + bet * 5
						elif roll == 4 or roll == 10 :
							dialog("You won 3x your bet!") 
							gold = gold + bet * 3
						elif roll == 5 or roll == 9 :
							dialog("You won 2x your bet!") 
							gold = gold + bet * 2
						elif roll == 6 or roll == 8 :
							dialog("You won 1.5x your bet!")
							gold = gold + round(bet*1.5)
						elif roll == 7 :
							dialog("You won 1.25x your bet!")
							gold = gold + round(bet*1.25)
						dialog("Current gold " + str(gold))
						if gold >= 100 :
							dialog("You win the game!")
							break
					else :
						dialog("Your guess was incorrect...")
						print(gold)
						if gold <= 0 :
							dialog("You have no more money")
							break 
					bet = "0"