sachin-chess-utils 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,8 +5,17 @@ pice_mapping = {
5
5
  for key, value in zip(chess.PIECE_SYMBOLS, chess.PIECE_NAMES)
6
6
  }
7
7
 
8
- def describe_move(move, extra=None):
8
+ def describe_move(move, is_en_passant=False):
9
9
  """
10
+ Convert a chess move in UCI format to a human-readable format.
11
+
12
+ Args:
13
+ move (str): The chess move in UCI format.
14
+ is_en_passant (bool): Whether the move is an en passant capture. Default to False.
15
+
16
+ Returns:
17
+ str: The human-readable description of the move.
18
+
10
19
  >>> describe_move('Nxe4#')
11
20
  'Knight captures e4 check and mate.'
12
21
  """
@@ -18,8 +27,6 @@ def describe_move(move, extra=None):
18
27
  if is_check or is_mate:
19
28
  move = move[:-1]
20
29
 
21
- is_ep = extra == 'e.p.'
22
-
23
30
  is_pawn_move = len(move) == 2
24
31
 
25
32
  if move == 'o-o':
@@ -59,7 +66,7 @@ def describe_move(move, extra=None):
59
66
  if is_mate:
60
67
  output += ' check and mate'
61
68
 
62
- if is_ep:
69
+ if is_en_passant:
63
70
  output += ' en passant'
64
71
 
65
72
  return output
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.1
2
+ Name: sachin-chess-utils
3
+ Version: 0.1.5
4
+ Summary: UNKNOWN
5
+ Home-page: UNKNOWN
6
+ Author: Sachin Chauhan Infocusp
7
+ License: UNKNOWN
8
+ Platform: UNKNOWN
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: chess (==1.11.2)
11
+
12
+ # sachin-chess-utils
13
+
14
+ General propose Chess related utility functions.
15
+ Some examples below.
16
+
17
+ ### 1. Convert chess move to human readable sentence:
18
+
19
+ ```
20
+ >>> from sachin_chess_utils import describe_move
21
+
22
+ >>> print(describe_move('Nxe4#'))
23
+ "knight captures e4 check and mate"
24
+ ```
25
+
26
+ - This is useful for the text to speech model. Machine can "say" the moves.
27
+ - Function might look simple at first glance but there are **some corner cases which are handled here** (That's why I thought to make it open source).
28
+
29
+ ### 2. Many more such functions are work in progress 🚀
30
+
31
+ ....
32
+
33
+
@@ -0,0 +1,8 @@
1
+ sachin_chess_utils/__init__.py,sha256=MeOM322WTU8yCmRUToqwaPquyvlnI8WxBFuM-HUpE3c,57
2
+ sachin_chess_utils/main.py,sha256=Hg4BBo12oTsUeANHQ4t77WcK-lvUaMFrtkc0azI0qkI,97
3
+ sachin_chess_utils/move.py,sha256=-ivdjh_38S2fSy7Gqbx_7tJzLn4VQsBN_-2P9I_w5zE,1643
4
+ sachin_chess_utils-0.1.5.dist-info/METADATA,sha256=DpPZMpPRQTV8rJuXv5ZRY84zvylhbP0Vl2Wowibt2EQ,809
5
+ sachin_chess_utils-0.1.5.dist-info/WHEEL,sha256=00yskusixUoUt5ob_CiUp6LsnN5lqzTJpoqOFg_FVIc,92
6
+ sachin_chess_utils-0.1.5.dist-info/entry_points.txt,sha256=hGJ3J_tepCGzSrdCfH8OplmaMPvCVDKvDKMrWfVYgac,59
7
+ sachin_chess_utils-0.1.5.dist-info/top_level.txt,sha256=7rW6areR0D7SZ19i5nqaKF9L_NeM_7jeqvOXnqx1iBc,19
8
+ sachin_chess_utils-0.1.5.dist-info/RECORD,,
@@ -1,28 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: sachin-chess-utils
3
- Version: 0.1.3
4
- Summary: UNKNOWN
5
- Home-page: UNKNOWN
6
- Author: Sachin Chauhan Infocusp
7
- License: UNKNOWN
8
- Platform: UNKNOWN
9
- Description-Content-Type: text/markdown
10
- Requires-Dist: chess (==1.11.2)
11
-
12
- # sachin-chess-utils
13
-
14
- General propose Chess related utility functions.
15
-
16
- # Build
17
-
18
- python3 setup.py sdist bdist_wheel
19
-
20
- # Local Test
21
-
22
- pip install dist/sachin_chess_utils-0.1.1-py3-none-any.whlhttps://www.youtube.com/watch?v=Kz6IlDCyOUY&t=377s&ab_channel=pixegami
23
-
24
- # Publish
25
-
26
- twine upload dist/\*
27
-
28
-
@@ -1,8 +0,0 @@
1
- sachin_chess_utils/__init__.py,sha256=MeOM322WTU8yCmRUToqwaPquyvlnI8WxBFuM-HUpE3c,57
2
- sachin_chess_utils/main.py,sha256=Hg4BBo12oTsUeANHQ4t77WcK-lvUaMFrtkc0azI0qkI,97
3
- sachin_chess_utils/move.py,sha256=WgBYQe7_VmpLPPsIAkPc52JUQSP2hGa-jjdHpgTLlEk,1352
4
- sachin_chess_utils-0.1.3.dist-info/METADATA,sha256=B7TOygec1QHa0YXfcOoF1tO4IuWSvmlde-Cc_SSMN7U,533
5
- sachin_chess_utils-0.1.3.dist-info/WHEEL,sha256=00yskusixUoUt5ob_CiUp6LsnN5lqzTJpoqOFg_FVIc,92
6
- sachin_chess_utils-0.1.3.dist-info/entry_points.txt,sha256=hGJ3J_tepCGzSrdCfH8OplmaMPvCVDKvDKMrWfVYgac,59
7
- sachin_chess_utils-0.1.3.dist-info/top_level.txt,sha256=7rW6areR0D7SZ19i5nqaKF9L_NeM_7jeqvOXnqx1iBc,19
8
- sachin_chess_utils-0.1.3.dist-info/RECORD,,