2017-10-13 07:55:29 +03:00
|
|
|
"""Example games module."""
|
2017-10-04 00:01:49 +03:00
|
|
|
|
|
|
|
|
2020-01-27 02:41:36 +03:00
|
|
|
class Game:
|
2017-10-04 00:01:49 +03:00
|
|
|
"""Base game class."""
|
|
|
|
|
2017-10-13 07:55:29 +03:00
|
|
|
def __init__(self, player1, player2):
|
2020-01-26 22:22:43 +03:00
|
|
|
"""Initialize instance."""
|
2017-10-13 07:55:29 +03:00
|
|
|
self.player1 = player1
|
|
|
|
self.player2 = player2
|
|
|
|
|
2017-10-04 00:01:49 +03:00
|
|
|
def play(self):
|
|
|
|
"""Play game."""
|
2017-10-13 07:55:29 +03:00
|
|
|
print('{0} and {1} are playing {2}'.format(
|
|
|
|
self.player1, self.player2, self.__class__.__name__.lower()))
|
2017-10-04 00:01:49 +03:00
|
|
|
|
|
|
|
|
|
|
|
class Chess(Game):
|
|
|
|
"""Chess game."""
|
|
|
|
|
|
|
|
|
|
|
|
class Checkers(Game):
|
|
|
|
"""Checkers game."""
|
|
|
|
|
|
|
|
|
|
|
|
class Ludo(Game):
|
|
|
|
"""Ludo game."""
|