-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults.py
64 lines (50 loc) · 1.68 KB
/
results.py
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
from player import *
class Results:
#player_final_value = 0
#computer_final_value = 0
def Decipher(self,cards):
nums = []
for name,val in cards:
if type(val) is int:
nums.append(val)
else:
nums.append(val[1])
return nums
def total_check(self,value,nums):
#print(value)
if value>21:
if 11 in nums:
nums[nums.index(11)] = 1
return self.total_check(sum(nums),nums)
else:
return value
elif value<=21:
#Results.player_final_value = value
return value
# def Decipher_comp(self,cards):
# nums = []
# for name,val in cards:
# if type(val) is int:
# nums.append(val)
# else:
# nums.append(val[1])
# return self.comp_total_check(sum(nums),nums)
# def comp_total_check(self,value,nums):
# #print(value)
# if value>21:
# if 11 in nums:
# nums[nums.index(11)] = 1
# return self.total_check(sum(nums),nums)
# else:
# return value
# elif value<=21:
# Results.computer_final_value = value
# return value
def final_result(self,comp_final_value,player_final_value):
if comp_final_value>player_final_value:
print("Computer won!")
elif player_final_value>comp_final_value:
return True
else:
print("PUSH")
return "PUSH"