sachin-chess-utils 0.1.1__tar.gz → 0.1.3__tar.gz

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.
@@ -0,0 +1,27 @@
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
+
11
+ # sachin-chess-utils
12
+
13
+ General propose Chess related utility functions.
14
+
15
+ # Build
16
+
17
+ python3 setup.py sdist bdist_wheel
18
+
19
+ # Local Test
20
+
21
+ pip install dist/sachin_chess_utils-0.1.1-py3-none-any.whlhttps://www.youtube.com/watch?v=Kz6IlDCyOUY&t=377s&ab_channel=pixegami
22
+
23
+ # Publish
24
+
25
+ twine upload dist/\*
26
+
27
+
@@ -0,0 +1,15 @@
1
+ # sachin-chess-utils
2
+
3
+ General propose Chess related utility functions.
4
+
5
+ # Build
6
+
7
+ python3 setup.py sdist bdist_wheel
8
+
9
+ # Local Test
10
+
11
+ pip install dist/sachin_chess_utils-0.1.1-py3-none-any.whlhttps://www.youtube.com/watch?v=Kz6IlDCyOUY&t=377s&ab_channel=pixegami
12
+
13
+ # Publish
14
+
15
+ twine upload dist/\*
@@ -0,0 +1,3 @@
1
+ from .main import hello
2
+ from .move import describe_move
3
+
@@ -0,0 +1,65 @@
1
+ import chess
2
+
3
+ pice_mapping = {
4
+ key: value
5
+ for key, value in zip(chess.PIECE_SYMBOLS, chess.PIECE_NAMES)
6
+ }
7
+
8
+ def describe_move(move, extra=None):
9
+ """
10
+ >>> describe_move('Nxe4#')
11
+ 'Knight captures e4 check and mate.'
12
+ """
13
+
14
+ move = move.lower()
15
+
16
+ is_check = move[-1] == '+'
17
+ is_mate = move[-1] == '#'
18
+ if is_check or is_mate:
19
+ move = move[:-1]
20
+
21
+ is_ep = extra == 'e.p.'
22
+
23
+ is_pawn_move = len(move) == 2
24
+
25
+ if move == 'o-o':
26
+ return 'castle king size'
27
+ if move == 'o-o-o':
28
+ return 'castle queen size'
29
+
30
+ square = move[-2:]
31
+
32
+ p = move[0].upper()
33
+ is_pice = False
34
+ if p in [pi.upper() for pi in list(pice_mapping.keys())[1:]]:
35
+ pice = pice_mapping[p.lower()]
36
+ is_pice = True
37
+ else:
38
+ pice = p
39
+
40
+ is_capture = False
41
+ if 'x' in move:
42
+ is_capture = True
43
+ move = move.replace('x', '')
44
+
45
+ is_doubled_pice = False
46
+ if is_pice and len(move) == 4:
47
+ is_doubled_pice = True
48
+
49
+ output = ''
50
+ if is_pawn_move:
51
+ output = move
52
+ else:
53
+ output = pice + ' ' + (move[1] if is_doubled_pice else '') + (
54
+ ' captures ' if is_capture else ' to ') + square
55
+
56
+ if is_check:
57
+ output += ' check'
58
+
59
+ if is_mate:
60
+ output += ' check and mate'
61
+
62
+ if is_ep:
63
+ output += ' en passant'
64
+
65
+ return output
@@ -0,0 +1,27 @@
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
+
11
+ # sachin-chess-utils
12
+
13
+ General propose Chess related utility functions.
14
+
15
+ # Build
16
+
17
+ python3 setup.py sdist bdist_wheel
18
+
19
+ # Local Test
20
+
21
+ pip install dist/sachin_chess_utils-0.1.1-py3-none-any.whlhttps://www.youtube.com/watch?v=Kz6IlDCyOUY&t=377s&ab_channel=pixegami
22
+
23
+ # Publish
24
+
25
+ twine upload dist/\*
26
+
27
+
@@ -2,6 +2,7 @@ README.md
2
2
  setup.py
3
3
  sachin_chess_utils/__init__.py
4
4
  sachin_chess_utils/main.py
5
+ sachin_chess_utils/move.py
5
6
  sachin_chess_utils.egg-info/PKG-INFO
6
7
  sachin_chess_utils.egg-info/SOURCES.txt
7
8
  sachin_chess_utils.egg-info/dependency_links.txt
@@ -1,16 +1,21 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
+ with open("README.md", "r") as f:
4
+ description = f.read()
5
+
3
6
  setup(
4
7
  name="sachin_chess_utils",
5
- version="0.1.1",
8
+ version="0.1.3",
6
9
  author="Sachin Chauhan Infocusp",
7
10
  packages=find_packages(),
8
11
  install_requires=[
9
- 'numpy>=1.11.0'
12
+ 'chess==1.11.2',
10
13
  ],
11
14
  entry_points={
12
15
  'console_scripts': [
13
16
  'sachin_hello = sachin_chess_utils:hello'
14
17
  ]
15
- }
18
+ },
19
+ long_description=description,
20
+ long_description_content_type="text/markdown",
16
21
  )
@@ -1,11 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: sachin_chess_utils
3
- Version: 0.1.1
4
- Summary: UNKNOWN
5
- Home-page: UNKNOWN
6
- Author: Sachin Chauhan Infocusp
7
- License: UNKNOWN
8
- Platform: UNKNOWN
9
-
10
- UNKNOWN
11
-
@@ -1,13 +0,0 @@
1
- # sachin-chess-utils
2
-
3
- General propose Chess related utility functions.
4
-
5
- # Build
6
-
7
- python3 setup.py sdist bdist_wheel
8
-
9
- # Local Test
10
-
11
- pip install dist/sachin_chess_utils-0.1.1-py3-none-any.whl
12
-
13
- https://www.youtube.com/watch?v=Kz6IlDCyOUY&t=377s&ab_channel=pixegami
@@ -1 +0,0 @@
1
- from .main import hello
@@ -1,11 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: sachin-chess-utils
3
- Version: 0.1.1
4
- Summary: UNKNOWN
5
- Home-page: UNKNOWN
6
- Author: Sachin Chauhan Infocusp
7
- License: UNKNOWN
8
- Platform: UNKNOWN
9
-
10
- UNKNOWN
11
-
@@ -1 +0,0 @@
1
- numpy>=1.11.0