1 | |||
0 ignored issues
–
show
|
|||
2 | |||
3 | 1 | class Piece: |
|
0 ignored issues
–
show
This class should have a docstring.
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods: class SomeClass:
def some_method(self):
"""Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions. ![]() |
|||
4 | |||
5 | 1 | def __init__(self, piece_name, piece_color, moves): |
|
6 | 1 | self.kind = piece_name |
|
7 | 1 | self.color = piece_color |
|
8 | 1 | self.moves = moves |
|
9 | 1 | self.move_count = 0 |
|
10 | |||
11 | 1 | def __str__(self): |
|
12 | return "{} {}".format(self.color, self.kind) |
||
13 | |||
14 | 1 | def __repr__(self): |
|
15 | 1 | character = self.kind[0] |
|
16 | 1 | if self.kind == "knight": |
|
17 | 1 | character = 'n' |
|
18 | 1 | if self.color == "white": |
|
19 | 1 | character = character.upper() |
|
20 | return character |
||
21 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.