From c11a070602bab3effc2a18237a82b622afa82f3f Mon Sep 17 00:00:00 2001 From: SotirisKantz Date: Thu, 18 Jul 2019 04:13:11 +0300 Subject: [PATCH 1/2] Update __init__.py --- chess/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/chess/__init__.py b/chess/__init__.py index c92505ce6..353f18c09 100644 --- a/chess/__init__.py +++ b/chess/__init__.py @@ -386,6 +386,21 @@ def _rays() -> Tuple[List[List[Bitboard]], List[List[Bitboard]]]: FEN_CASTLING_REGEX = re.compile(r"^(?:-|[KQABCDEFGH]{0,2}[kqabcdefgh]{0,2})\Z") +class Time: + """keeps time at the beginning of the game""" + Starting_Time = int(round(time.time())) + + """returns the current running time""" + def get_time(self) -> str: + playing_time = int(round(time.time())) - self.Starting_Time + + hours = playing_time / 3600 + less_than_an_hour = playing_time % 3600 + minutes = less_than_an_hour / 60 + seconds = less_than_an_hour % 60 + + Time = 'hours: %d minutes: %d seconds: %d' % (hours, minutes, seconds) + return Time class Piece: """A piece with type and color.""" From f0b5edddc43b7f5f03f6cb5976ebbf2cb1f706cb Mon Sep 17 00:00:00 2001 From: SotirisKantz Date: Thu, 18 Jul 2019 04:17:05 +0300 Subject: [PATCH 2/2] Update __init__.py --- chess/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/chess/__init__.py b/chess/__init__.py index 353f18c09..135eacf2d 100644 --- a/chess/__init__.py +++ b/chess/__init__.py @@ -34,6 +34,7 @@ import re import itertools import typing +import time from typing import ClassVar, Callable, Dict, Generic, Hashable, Iterable, Iterator, List, Mapping, MutableSet, Optional, SupportsInt, Tuple, Type, TypeVar, Union