-
Notifications
You must be signed in to change notification settings - Fork 62
/
h2EU.py
45 lines (35 loc) · 916 Bytes
/
h2EU.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
import random
class Player:
def __init__(self, name, coin):
self.name = name
self.coin = coin
def info(self):
print(self.name + ':' + str(self.coin))
def set_bet_coin(self, bet_coin):
self.coin -= bet_coin
class Human(Player):
def __init__(self, name, coin):
super().__init__(name, coin)
def bet(self):
bet_message = '何枚BETしますか?:(1-99)'
bet_coin = input(bet_message)
while not self.enable_bet_coin(bet_coin):
bet_coin = input(bet_message)
super().set_bet_coin(int(bet_coin))
print(bet_coin)
def enable_bet_coin(self, string):
if string.isdigit():
number = int(string)
if number >= 1 and number <= 99:
return True
else:
return False
else:
return False
def play():
print('デバッグログ:play()')
human = Human('MY', 500)
human.info()
human.bet()
human.info()
play()