-
Notifications
You must be signed in to change notification settings - Fork 0
/
speler.py
40 lines (30 loc) · 915 Bytes
/
speler.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
from datetime import datetime
from time import gmtime, strftime, time
from typing import Optional
import random
import pytz
class Speler:
def __init__(
self,
naam: str,
doetmee: bool,
n_wissels: int,
in_veld: bool,
keeper: bool,
laatste_wissel: Optional[str]
):
self.laatste_wissel = laatste_wissel
self.naam = naam
self.doetmee = doetmee
self.n_wissels = n_wissels
self.in_veld = in_veld
self.keeper = keeper
self.laatste_wissel_sec = 0
self.random_nr = random.random()
def gaat_eruit(self):
self.n_wissels += 1
self.in_veld = False
self.laatste_wissel = datetime.now(pytz.timezone('Europe/Amsterdam')).strftime("%H:%M")
self.laatste_wissel_sec = int(time())
def komt_erin(self):
self.in_veld = True