import random
import time
class Player:
def __init__(self, name):
self.name = name
self.start_time = time.time()
self.score = 0
self.end_time = None
self.play_time = None
self.logon_time = time.ctime()
def add_score(self, amount):
self.score += amount
def deduct_score(self, amount):
self.score -= amount
def get_score(self, print_score=True, return_score=False):
if print_score and return_score:
print("What do you even need both for?")
if print_score:
print("{a}'s score: {b}".format(a=self.name, b=self.score))
if return_score:
return self.score
def get_end_time(self):
self.end_time = time.time()
def get_play_time(self):
self.play_time = self.end_time - self.start_time
def show_stats(self):
print(f"Player's name: {self.name}")
print("Stats are as follows:")
print(f"Your score is: {self.score}")
print(f"You played for {self.play_time:.2f}")
print(f"You logged on at: {self.logon_time}")
# lol
# i forgor what i wanted to code