manim-chess 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><g fill="none" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><g fill="#000" stroke-linecap="butt"><path d="M9 36c3.4-1 10.1.4 13.5-2 3.4 2.4 10.1 1 13.5 2 0 0 1.6.5 3 2-.7 1-1.6 1-3 .5-3.4-1-10.1.5-13.5-1-3.4 1.5-10.1 0-13.5 1-1.4.5-2.3.5-3-.5 1.4-2 3-2 3-2z"/><path d="M15 32c2.5 2.5 12.5 2.5 15 0 .5-1.5 0-2 0-2 0-2.5-2.5-4-2.5-4 5.5-1.5 6-11.5-5-15.5-11 4-10.5 14-5 15.5 0 0-2.5 1.5-2.5 4 0 0-.5.5 0 2z"/><path d="M25 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 1 1 5 0z"/></g><path stroke="#ececec" stroke-linejoin="miter" d="M17.5 26h10M15 30h15m-7.5-14.5v5M20 18h5"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><g fill="none" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path stroke-linejoin="miter" d="M22.5 11.6V6"/><path fill="#000" stroke-linecap="butt" stroke-linejoin="miter" d="M22.5 25s4.5-7.5 3-10.5c0 0-1-2.5-3-2.5s-3 2.5-3 2.5c-1.5 3 3 10.5 3 10.5"/><path fill="#000" d="M11.5 37a22.3 22.3 0 0 0 21 0v-7s9-4.5 6-10.5c-4-6.5-13.5-3.5-16 4V27v-3.5c-3.5-7.5-13-10.5-16-4-3 6 5 10 5 10V37z"/><path stroke-linejoin="miter" d="M20 8h5"/><path stroke="#ececec" d="M32 29.5s8.5-4 6-9.7C34.1 14 25 18 22.5 24.6v2.1-2.1C20 18 9.9 14 7 19.9c-2.5 5.6 4.8 9 4.8 9"/><path stroke="#ececec" d="M11.5 30c5.5-3 15.5-3 21 0m-21 3.5c5.5-3 15.5-3 21 0m-21 3.5c5.5-3 15.5-3 21 0"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><g fill="none" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path fill="#000" d="M22 10c10.5 1 16.5 8 16 29H15c0-9 10-6.5 8-21"/><path fill="#000" d="M24 18c.38 2.91-5.55 7.37-8 9-3 2-2.82 4.34-5 4-1.04-.94 1.41-3.04 0-3-1 0 .19 1.23-1 2-1 0-4 1-4-4 0-2 6-12 6-12s1.89-1.9 2-3.5c-.73-1-.5-2-.5-3 1-1 3 2.5 3 2.5h2s.78-2 2.5-3c1 0 1 3 1 3"/><path fill="#ececec" stroke="#ececec" d="M9.5 25.5a.5.5 0 1 1-1 0 .5.5 0 1 1 1 0zm5.43-9.75a.5 1.5 30 1 1-.86-.5.5 1.5 30 1 1 .86.5z"/><path fill="#ececec" stroke="none" d="m24.55 10.4-.45 1.45.5.15c3.15 1 5.65 2.49 7.9 6.75S35.75 29.06 35.25 39l-.05.5h2.25l.05-.5c.5-10.06-.88-16.85-3.25-21.34-2.37-4.49-5.79-6.64-9.19-7.16l-.51-.1z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><path stroke="#000" stroke-linecap="round" stroke-width="1.5" d="M22.5 9a4 4 0 0 0-3.22 6.38 6.48 6.48 0 0 0-.87 10.65c-3 1.06-7.41 5.55-7.41 13.47h23c0-7.92-4.41-12.41-7.41-13.47a6.46 6.46 0 0 0-.87-10.65A4.01 4.01 0 0 0 22.5 9z"/></svg>
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="utf-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45"
5
+ height="45">
6
+ <g style="fill:#000000;stroke:#000000;stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round">
7
+
8
+ <path d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"
9
+ style="stroke-linecap:butt;fill:#000000" />
10
+ <path d="m 9,26 c 0,2 1.5,2 2.5,4 1,1.5 1,1 0.5,3.5 -1.5,1 -1,2.5 -1,2.5 -1.5,1.5 0,2.5 0,2.5 6.5,1 16.5,1 23,0 0,0 1.5,-1 0,-2.5 0,0 0.5,-1.5 -1,-2.5 -0.5,-2.5 -0.5,-2 0.5,-3.5 1,-2 2.5,-2 2.5,-4 -8.5,-1.5 -18.5,-1.5 -27,0 z" />
11
+ <path d="M 11.5,30 C 15,29 30,29 33.5,30" />
12
+ <path d="m 12,33.5 c 6,-1 15,-1 21,0" />
13
+ <circle cx="6" cy="12" r="2" />
14
+ <circle cx="14" cy="9" r="2" />
15
+ <circle cx="22.5" cy="8" r="2" />
16
+ <circle cx="31" cy="9" r="2" />
17
+ <circle cx="39" cy="12" r="2" />
18
+ <path d="M 11,38.5 A 35,35 1 0 0 34,38.5"
19
+ style="fill:none; stroke:#000000;stroke-linecap:butt;" />
20
+ <g style="fill:none; stroke:#ffffff;">
21
+ <path d="M 11,29 A 35,35 1 0 1 34,29" />
22
+ <path d="M 12.5,31.5 L 32.5,31.5" />
23
+ <path d="M 11.5,34.5 A 35,35 1 0 0 33.5,34.5" />
24
+ <path d="M 10.5,37.5 A 35,35 1 0 0 34.5,37.5" />
25
+ </g>
26
+ </g>
27
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><g fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path stroke-linecap="butt" d="M9 39h27v-3H9v3zm3.5-7 1.5-2.5h17l1.5 2.5h-20zm-.5 4v-4h21v4H12z"/><path stroke-linecap="butt" stroke-linejoin="miter" d="M14 29.5v-13h17v13H14z"/><path stroke-linecap="butt" d="M14 16.5 11 14h23l-3 2.5H14zM11 14V9h4v2h5V9h5v2h5V9h4v5H11z"/><path fill="none" stroke="#ececec" stroke-linejoin="miter" stroke-width="1" d="M12 35.5h21m-20-4h19m-18-2h17m-17-13h17M11 14h23"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><g fill="none" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><g fill="#fff" stroke-linecap="butt"><path d="M9 36c3.39-.97 10.11.43 13.5-2 3.39 2.43 10.11 1.03 13.5 2 0 0 1.65.54 3 2-.68.97-1.65.99-3 .5-3.39-.97-10.11.46-13.5-1-3.39 1.46-10.11.03-13.5 1-1.35.49-2.32.47-3-.5 1.35-1.94 3-2 3-2z"/><path d="M15 32c2.5 2.5 12.5 2.5 15 0 .5-1.5 0-2 0-2 0-2.5-2.5-4-2.5-4 5.5-1.5 6-11.5-5-15.5-11 4-10.5 14-5 15.5 0 0-2.5 1.5-2.5 4 0 0-.5.5 0 2z"/><path d="M25 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 1 1 5 0z"/></g><path stroke-linejoin="miter" d="M17.5 26h10M15 30h15m-7.5-14.5v5M20 18h5"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><g fill="none" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path stroke-linejoin="miter" d="M22.5 11.63V6M20 8h5"/><path fill="#fff" stroke-linecap="butt" stroke-linejoin="miter" d="M22.5 25s4.5-7.5 3-10.5c0 0-1-2.5-3-2.5s-3 2.5-3 2.5c-1.5 3 3 10.5 3 10.5"/><path fill="#fff" d="M11.5 37c5.5 3.5 15.5 3.5 21 0v-7s9-4.5 6-10.5c-4-6.5-13.5-3.5-16 4V27v-3.5c-3.5-7.5-13-10.5-16-4-3 6 5 10 5 10V37z"/><path d="M11.5 30c5.5-3 15.5-3 21 0m-21 3.5c5.5-3 15.5-3 21 0m-21 3.5c5.5-3 15.5-3 21 0"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><g fill="none" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path fill="#fff" d="M22 10c10.5 1 16.5 8 16 29H15c0-9 10-6.5 8-21"/><path fill="#fff" d="M24 18c.38 2.91-5.55 7.37-8 9-3 2-2.82 4.34-5 4-1.042-.94 1.41-3.04 0-3-1 0 .19 1.23-1 2-1 0-4.003 1-4-4 0-2 6-12 6-12s1.89-1.9 2-3.5c-.73-.994-.5-2-.5-3 1-1 3 2.5 3 2.5h2s.78-1.992 2.5-3c1 0 1 3 1 3"/><path fill="#000" d="M9.5 25.5a.5.5 0 1 1-1 0 .5.5 0 1 1 1 0zm5.433-9.75a.5 1.5 30 1 1-.866-.5.5 1.5 30 1 1 .866.5z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><path fill="#fff" stroke="#000" stroke-linecap="round" stroke-width="1.5" d="M22.5 9c-2.21 0-4 1.79-4 4 0 .89.29 1.71.78 2.38C17.33 16.5 16 18.59 16 21c0 2.03.94 3.84 2.41 5.03-3 1.06-7.41 5.55-7.41 13.47h23c0-7.92-4.41-12.41-7.41-13.47 1.47-1.19 2.41-3 2.41-5.03 0-2.41-1.33-4.5-3.28-5.62.49-.67.78-1.49.78-2.38 0-2.21-1.79-4-4-4z"/></svg>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
4
+ <g style="fill:#ffffff;stroke:#000000;stroke-width:1.5;stroke-linejoin:round">
5
+ <path d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"/>
6
+ <path d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 11,36 11,36 C 9.5,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z"/>
7
+ <path d="M 11.5,30 C 15,29 30,29 33.5,30" style="fill:none"/>
8
+ <path d="M 12,33.5 C 18,32.5 27,32.5 33,33.5" style="fill:none"/>
9
+ <circle cx="6" cy="12" r="2" />
10
+ <circle cx="14" cy="9" r="2" />
11
+ <circle cx="22.5" cy="8" r="2" />
12
+ <circle cx="31" cy="9" r="2" />
13
+ <circle cx="39" cy="12" r="2" />
14
+ </g>
15
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45"><g fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path stroke-linecap="butt" d="M9 39h27v-3H9v3zm3-3v-4h21v4H12zm-1-22V9h4v2h5V9h5v2h5V9h4v5"/><path d="m34 14-3 3H14l-3-3"/><path stroke-linecap="butt" stroke-linejoin="miter" d="M31 17v12.5H14V17"/><path d="m31 29.5 1.5 2.5h-20l1.5-2.5"/><path fill="none" stroke-linejoin="miter" d="M11 14h23"/></g></svg>
@@ -1,212 +1,213 @@
1
- Metadata-Version: 2.1
2
- Name: manim_chess
3
- Version: 0.0.1
4
- Home-page: https://github.com/swoyer2/manim_chess
5
- Author: Swoyer2
6
- Author-email: swoyer.logan@gmail.com
7
- License: MIT
8
- Classifier: License :: OSI Approved :: MIT License
9
- Description-Content-Type: text/markdown
10
- Provides-Extra: dev
11
- Requires-Dist: twine>=4.0.2; extra == "dev"
12
-
13
- # Manim Chess
14
-
15
- This is a [Manim Community](https://www.manim.community/) plugin that allows you to generate a chess board/chess game easily.
16
-
17
-
18
- ## Installation
19
-
20
- ```bash
21
- pip install manim-chess
22
- ```
23
-
24
- ## Features
25
-
26
- - **Create Chessboard**: Allows you to create and display a chessboard.
27
- - **Move Pieces**: Animate piece movement with PGN notation or the simplified notation in the package.
28
- - **Special Moves**: Handle special chess moves like castling and en passant.
29
- - **Load FEN Strings**: Load and display a board configuration from a FEN string.
30
- - **Play PGN Files**: Load and animate moves from PGN files.
31
- - **Evaluation Bar**: Allows the creation and ability to display an evaluation bar.
32
- - **Update Evaluation Bar**: Can update the value in the evaluation bar with externally obtained evaulations.
33
- - **Mark Squares**: Can mark and unmark squares to highlight them.
34
- - **Draw Arrows**: Can draw/undraw arrows similar to chess.com
35
-
36
- ## Usage
37
-
38
- In order to use this package you need to run the script using Manim. I have provided some examples on how to use it
39
- below.
40
-
41
-
42
- ### Moving Pieces
43
- This example initializes the chessboard and shows how you can move a piece.
44
-
45
- ![MovingPieces](https://github.com/swoyer2/manim_chess/blob/main/gifs/moving_pieces.gif)
46
-
47
-
48
- ```python
49
- from manim import *
50
- import manim_chess
51
-
52
- class MovingPieces(Scene):
53
- def construct(self):
54
- chess_board = manim_chess.Board()
55
- chess_board.set_board_from_FEN("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") # Also can set the default board with no arguments
56
-
57
- # Define the moves you want to be done with the default notation (starting_square, ending_square, promotion_piece)
58
- # Note that the promotion piece is blank unless a pawn is promoting
59
- moves = [('e2', 'e4', ''), ('e7', 'e5', ''), ('g1', 'f3', '')]
60
-
61
- self.add(chess_board)
62
- self.wait()
63
- manim_chess.play_game(scene=self, board=chess_board, moves=moves)
64
- self.wait()
65
- ```
66
-
67
- ### Using a PGN Notation
68
- This example demonstrates playing moves from a PGN file on the chessboard. NOTE if you are starting from a different FEN than the standard start of a game, include FEN=your_fen_string
69
-
70
- ![PGNExample](https://github.com/swoyer2/manim_chess/blob/main/gifs/PGN_example.gif)
71
-
72
-
73
- ```python
74
- from manim import *
75
- import manim_chess
76
-
77
- class PGN_Example(MovingCameraScene):
78
- def construct(self):
79
- chess_board = manim_chess.Board()
80
- chess_board.set_board_from_FEN("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") # Also can set the default board with no arguments
81
-
82
- # You can paste a PGN straight from wherever you got your pgn. Just make it a multiline string with """PGN"""
83
- moves = manim_chess.convert_from_PGN("""[Event "It (cat.17)"]
84
- [Site "Wijk aan Zee (Netherlands)"]
85
- [Date "1999.??.??"]
86
- [Round "4"]
87
- [White "Kasparov Garry (RUS)"]
88
- [Black "Topalov Veselin (BUL)"]
89
- [Result "1-0"]
90
- [ECO "B07"]
91
- [WhiteElo "2851"]
92
- [BlackElo "2690"]
93
- [Annotator ""]
94
- [Source ""]
95
- [Remark "I"]
96
- [WhiteUrl "https://images.chesscomfiles.com/uploads/v1/master_player/4fe1281a-a9df-11e8-8450-4ff4fd58ed06.bb91bfe2.50x50o.77b8f8a95e5e.jpeg"]
97
- [WhiteCountry ""]
98
- [WhiteTitle ""]
99
- [BlackUrl "https://images.chesscomfiles.com/uploads/v1/master_player/e9640f50-c002-11e8-b93d-e56e1835faa8.4a751865.50x50o.dd0ca3584c8b.png"]
100
- [BlackCountry ""]
101
- [BlackTitle ""]
102
- [Link "https://www.chess.com/analysis/game/master/969971?tab=analysis"]
103
-
104
- 1. e4 d6 2. d4 Nf6 3. Nc3 g6 4. Be3 Bg7 5. Qd2 c6 6. f3 b5 7. Nge2 Nbd7 8. Bh6
105
- Bxh6 9. Qxh6 Bb7 10. a3 e5 11. O-O-O Qe7 12. Kb1 a6 13. Nc1 $6 O-O-O $2 14. Nb3 $6
106
- exd4 15. Rxd4 c5 16. Rd1 Nb6 17. g3 $6 Kb8 $6 18. Na5 $6 Ba8 19. Bh3 d5 20. Qf4+
107
- Ka7 21. Rhe1 d4 $1 22. Nd5 Nbxd5 23. exd5 Qd6 24. Rxd4 $1 cxd4 $2 25. Re7+ $3 Kb6 26.
108
- Qxd4+ Kxa5 27. b4+ $1 Ka4 28. Qc3 $1 Qxd5 29. Ra7 $1 Bb7 30. Rxb7 Qc4 31. Qxf6 Kxa3 $2
109
- 32. Qxa6+ $1 Kxb4 33. c3+ $1 Kxc3 34. Qa1+ $1 Kd2 35. Qb2+ $1 Kd1 36. Bf1 $3 Rd2 37.
110
- Rd7 $3 Rxd7 38. Bxc4 bxc4 39. Qxh8 Rd3 40. Qa8 c3 41. Qa4+ Ke1 42. f4 f5 43. Kc1
111
- Rd2 44. Qa7 1-0""")
112
-
113
- self.add(chess_board)
114
- self.wait()
115
- manim_chess.play_game(scene=self, board=chess_board, moves=moves)
116
- self.wait()
117
- ```
118
-
119
- ### Evaluation Bar
120
- This example shows how to add and adjust the values of the evaluation bar
121
-
122
- ![EvalBarExample](https://github.com/swoyer2/manim_chess/blob/main/gifs/eval_bar.gif)
123
-
124
-
125
- ```python
126
- from manim import *
127
- import manim_chess
128
-
129
-
130
- class EvalBarExample(MovingCameraScene):
131
- def construct(self):
132
- chess_board = manim_chess.Board()
133
- chess_board.set_board_from_FEN("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") # Also can set the default board with no arguments
134
-
135
- eval_bar = manim_chess.EvaluationBar()
136
- eval_bar.move_to(chess_board.get_left()).shift(LEFT*0.5)
137
-
138
- self.add(chess_board, eval_bar)
139
- self.wait()
140
- self.play(eval_bar.set_evaluation(1.5))
141
- self.wait()
142
- self.play(eval_bar.set_evaluation(-3))
143
- self.wait()
144
- ```
145
-
146
- ### Marking Squares
147
- This example shows how to mark and unmark squares on the chessboard.
148
-
149
- ![MarkSquaresExample](https://github.com/swoyer2/manim_chess/blob/main/gifs/mark_squares_example.gif)
150
-
151
-
152
- ```python
153
- from manim import *
154
- import manim_chess
155
-
156
-
157
- class MarkSquaresExample(MovingCameraScene):
158
- def construct(self):
159
- chess_board = manim_chess.Board()
160
- chess_board.set_board_from_FEN()
161
-
162
- self.add(chess_board)
163
-
164
- chess_board.mark_square('e4')
165
- self.wait()
166
- chess_board.mark_square('c5')
167
- self.wait()
168
- chess_board.unmark_square('e4')
169
- chess_board.unmark_square('c5')
170
- self.wait()
171
- ```
172
-
173
- ### Draw Arrows
174
- This is how you would draw and remove arrows.
175
-
176
- ![DrawArrowsExample](https://github.com/swoyer2/manim_chess/blob/main/gifs/draw_arrows_example.gif)
177
-
178
-
179
- ```python
180
- from manim import *
181
- import manim_chess
182
-
183
-
184
- class DrawArrowsExample(MovingCameraScene):
185
- def construct(self):
186
- chess_board = manim_chess.Board()
187
- chess_board.set_board_from_FEN()
188
-
189
- self.add(chess_board)
190
-
191
- chess_board.draw_arrow('e2', 'e4')
192
- self.wait()
193
- chess_board.draw_arrow('b8', 'c6')
194
- self.wait()
195
- chess_board.draw_arrow('b1', 'a3')
196
- self.wait()
197
- chess_board.remove_arrows()
198
- self.wait()
199
- ```
200
-
201
-
202
- ### Running the Examples
203
- To run any of the examples, execute the script using Manim. For instance, here is an example on how to render the first example with low quality (if you want high quality replace -pql with -hql)
204
-
205
- ```sh
206
- manim -pql examples.py MovingPieces
207
- ```
208
-
209
- Replace `MovingPieces` with the class name of the example you want to run.
210
-
211
- ### License
212
- This project is licensed under the MIT License. See the LICENSE file for more details.
1
+ Metadata-Version: 2.3
2
+ Name: manim-chess
3
+ Version: 0.0.3
4
+ Summary:
5
+ Author: swoyer2
6
+ Author-email: swoyer.logan@gmail.com
7
+ Requires-Python: >=3.12
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Description-Content-Type: text/markdown
12
+
13
+ # Manim Chess
14
+
15
+ This is a [Manim Community](https://www.manim.community/) plugin that allows you to generate a chess board/chess game easily.
16
+
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install manim-chess
22
+ ```
23
+
24
+ ## Features
25
+
26
+ - **Create Chessboard**: Allows you to create and display a chessboard.
27
+ - **Move Pieces**: Animate piece movement with PGN notation or the simplified notation in the package.
28
+ - **Special Moves**: Handle special chess moves like castling and en passant.
29
+ - **Load FEN Strings**: Load and display a board configuration from a FEN string.
30
+ - **Play PGN Files**: Load and animate moves from PGN files.
31
+ - **Evaluation Bar**: Allows the creation and ability to display an evaluation bar.
32
+ - **Update Evaluation Bar**: Can update the value in the evaluation bar with externally obtained evaulations.
33
+ - **Mark Squares**: Can mark and unmark squares to highlight them.
34
+ - **Draw Arrows**: Can draw/undraw arrows similar to chess.com
35
+
36
+ ## Usage
37
+
38
+ In order to use this package you need to run the script using Manim. I have provided some examples on how to use it
39
+ below.
40
+
41
+
42
+ ### Moving Pieces
43
+ This example initializes the chessboard and shows how you can move a piece.
44
+
45
+ ![MovingPieces](https://github.com/swoyer2/manim_chess/blob/main/gifs/moving_pieces.gif)
46
+
47
+
48
+ ```python
49
+ from manim import *
50
+ import manim_chess
51
+
52
+ class MovingPieces(Scene):
53
+ def construct(self):
54
+ chess_board = manim_chess.Board()
55
+ chess_board.set_board_from_FEN("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") # Also can set the default board with no arguments
56
+
57
+ # Define the moves you want to be done with the default notation (starting_square, ending_square, promotion_piece)
58
+ # Note that the promotion piece is blank unless a pawn is promoting
59
+ moves = [('e2', 'e4', ''), ('e7', 'e5', ''), ('g1', 'f3', '')]
60
+
61
+ self.add(chess_board)
62
+ self.wait()
63
+ manim_chess.play_game(scene=self, board=chess_board, moves=moves)
64
+ self.wait()
65
+ ```
66
+
67
+ ### Using a PGN Notation
68
+ This example demonstrates playing moves from a PGN file on the chessboard. NOTE if you are starting from a different FEN than the standard start of a game, include FEN=your_fen_string
69
+
70
+ ![PGNExample](https://github.com/swoyer2/manim_chess/blob/main/gifs/PGN_example.gif)
71
+
72
+
73
+ ```python
74
+ from manim import *
75
+ import manim_chess
76
+
77
+ class PGN_Example(MovingCameraScene):
78
+ def construct(self):
79
+ chess_board = manim_chess.Board()
80
+ chess_board.set_board_from_FEN("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") # Also can set the default board with no arguments
81
+
82
+ # You can paste a PGN straight from wherever you got your pgn. Just make it a multiline string with """PGN"""
83
+ moves = manim_chess.convert_from_PGN("""[Event "It (cat.17)"]
84
+ [Site "Wijk aan Zee (Netherlands)"]
85
+ [Date "1999.??.??"]
86
+ [Round "4"]
87
+ [White "Kasparov Garry (RUS)"]
88
+ [Black "Topalov Veselin (BUL)"]
89
+ [Result "1-0"]
90
+ [ECO "B07"]
91
+ [WhiteElo "2851"]
92
+ [BlackElo "2690"]
93
+ [Annotator ""]
94
+ [Source ""]
95
+ [Remark "I"]
96
+ [WhiteUrl "https://images.chesscomfiles.com/uploads/v1/master_player/4fe1281a-a9df-11e8-8450-4ff4fd58ed06.bb91bfe2.50x50o.77b8f8a95e5e.jpeg"]
97
+ [WhiteCountry ""]
98
+ [WhiteTitle ""]
99
+ [BlackUrl "https://images.chesscomfiles.com/uploads/v1/master_player/e9640f50-c002-11e8-b93d-e56e1835faa8.4a751865.50x50o.dd0ca3584c8b.png"]
100
+ [BlackCountry ""]
101
+ [BlackTitle ""]
102
+ [Link "https://www.chess.com/analysis/game/master/969971?tab=analysis"]
103
+
104
+ 1. e4 d6 2. d4 Nf6 3. Nc3 g6 4. Be3 Bg7 5. Qd2 c6 6. f3 b5 7. Nge2 Nbd7 8. Bh6
105
+ Bxh6 9. Qxh6 Bb7 10. a3 e5 11. O-O-O Qe7 12. Kb1 a6 13. Nc1 $6 O-O-O $2 14. Nb3 $6
106
+ exd4 15. Rxd4 c5 16. Rd1 Nb6 17. g3 $6 Kb8 $6 18. Na5 $6 Ba8 19. Bh3 d5 20. Qf4+
107
+ Ka7 21. Rhe1 d4 $1 22. Nd5 Nbxd5 23. exd5 Qd6 24. Rxd4 $1 cxd4 $2 25. Re7+ $3 Kb6 26.
108
+ Qxd4+ Kxa5 27. b4+ $1 Ka4 28. Qc3 $1 Qxd5 29. Ra7 $1 Bb7 30. Rxb7 Qc4 31. Qxf6 Kxa3 $2
109
+ 32. Qxa6+ $1 Kxb4 33. c3+ $1 Kxc3 34. Qa1+ $1 Kd2 35. Qb2+ $1 Kd1 36. Bf1 $3 Rd2 37.
110
+ Rd7 $3 Rxd7 38. Bxc4 bxc4 39. Qxh8 Rd3 40. Qa8 c3 41. Qa4+ Ke1 42. f4 f5 43. Kc1
111
+ Rd2 44. Qa7 1-0""")
112
+
113
+ self.add(chess_board)
114
+ self.wait()
115
+ manim_chess.play_game(scene=self, board=chess_board, moves=moves)
116
+ self.wait()
117
+ ```
118
+
119
+ ### Evaluation Bar
120
+ This example shows how to add and adjust the values of the evaluation bar
121
+
122
+ ![EvalBarExample](https://github.com/swoyer2/manim_chess/blob/main/gifs/eval_bar.gif)
123
+
124
+
125
+ ```python
126
+ from manim import *
127
+ import manim_chess
128
+
129
+
130
+ class EvalBarExample(MovingCameraScene):
131
+ def construct(self):
132
+ chess_board = manim_chess.Board()
133
+ chess_board.set_board_from_FEN("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") # Also can set the default board with no arguments
134
+
135
+ eval_bar = manim_chess.EvaluationBar()
136
+ eval_bar.move_to(chess_board.get_left()).shift(LEFT*0.5)
137
+
138
+ self.add(chess_board, eval_bar)
139
+ self.wait()
140
+ self.play(eval_bar.set_evaluation(1.5))
141
+ self.wait()
142
+ self.play(eval_bar.set_evaluation(-3))
143
+ self.wait()
144
+ ```
145
+
146
+ ### Marking Squares
147
+ This example shows how to mark and unmark squares on the chessboard.
148
+
149
+ ![MarkSquaresExample](https://github.com/swoyer2/manim_chess/blob/main/gifs/mark_squares_example.gif)
150
+
151
+
152
+ ```python
153
+ from manim import *
154
+ import manim_chess
155
+
156
+
157
+ class MarkSquaresExample(MovingCameraScene):
158
+ def construct(self):
159
+ chess_board = manim_chess.Board()
160
+ chess_board.set_board_from_FEN()
161
+
162
+ self.add(chess_board)
163
+
164
+ chess_board.mark_square('e4')
165
+ self.wait()
166
+ chess_board.mark_square('c5')
167
+ self.wait()
168
+ chess_board.unmark_square('e4')
169
+ chess_board.unmark_square('c5')
170
+ self.wait()
171
+ ```
172
+
173
+ ### Draw Arrows
174
+ This is how you would draw and remove arrows.
175
+
176
+ ![DrawArrowsExample](https://github.com/swoyer2/manim_chess/blob/main/gifs/draw_arrows_example.gif)
177
+
178
+
179
+ ```python
180
+ from manim import *
181
+ import manim_chess
182
+
183
+
184
+ class DrawArrowsExample(MovingCameraScene):
185
+ def construct(self):
186
+ chess_board = manim_chess.Board()
187
+ chess_board.set_board_from_FEN()
188
+
189
+ self.add(chess_board)
190
+
191
+ chess_board.draw_arrow('e2', 'e4')
192
+ self.wait()
193
+ chess_board.draw_arrow('b8', 'c6')
194
+ self.wait()
195
+ chess_board.draw_arrow('b1', 'a3')
196
+ self.wait()
197
+ chess_board.remove_arrows()
198
+ self.wait()
199
+ ```
200
+
201
+
202
+ ### Running the Examples
203
+ To run any of the examples, execute the script using Manim. For instance, here is an example on how to render the first example with low quality (if you want high quality replace -pql with -hql)
204
+
205
+ ```sh
206
+ manim -pql examples.py MovingPieces
207
+ ```
208
+
209
+ Replace `MovingPieces` with the class name of the example you want to run.
210
+
211
+ ### License
212
+ This project is licensed under the MIT License. See the LICENSE file for more details.
213
+
@@ -0,0 +1,20 @@
1
+ manim_chess/__init__.py,sha256=x6PCRFc18I6rHgyQfwkxsxS7bsi9i0QDd7zvMZX0gFA,199
2
+ manim_chess/board.py,sha256=FIFEiLzssQRtojcIhWCdkiOlaWOaeJqkknSc29bRzsU,19715
3
+ manim_chess/evaluation_bar.py,sha256=ELjhyFPi5x_Q4Gw3U0FLVhQqN55k8rYCu-lpkru4nPo,3655
4
+ manim_chess/game_player.py,sha256=fESDu5eksZK9ic47CwQNgeq1rpkcMKt0O7_X7-E5lp0,31102
5
+ manim_chess/piece_svgs/bB.svg,sha256=d-nev6XLgFKglq_9SdXU2EIxPM1RlNWoXji4p4MYhb8,683
6
+ manim_chess/piece_svgs/bK.svg,sha256=xfIsI1-5PyydjPV4ARdACn778s_YfO4biavea4UQWgw,786
7
+ manim_chess/piece_svgs/bN.svg,sha256=0GZVZOrKMoY2djhEqbpLFrOt-4XimWrJw8O8Rdw4Jws,801
8
+ manim_chess/piece_svgs/bP.svg,sha256=CVOfMiYHZeZibEZTl4rusWbHEHhUoD3jfNI8d_Xsbmo,298
9
+ manim_chess/piece_svgs/bQ.svg,sha256=gQYPnxTv6jK6uh6AkfnlAXWWnF9_d2jVrAR_p4bLHD8,1449
10
+ manim_chess/piece_svgs/bR.svg,sha256=wzo9VBE6ce2W7r4dHKIrip4zD8JPAcPzGqp4Qd3m_ps,575
11
+ manim_chess/piece_svgs/wB.svg,sha256=t9GhGPTPp0GQ6_f2jdiPQCAHKCHixJI2sHlnZrNOFZ0,700
12
+ manim_chess/piece_svgs/wK.svg,sha256=vHJ03RPqLNSfWoACN9hiw2quxoCDIyxreLtAmjx8ZvQ,613
13
+ manim_chess/piece_svgs/wN.svg,sha256=aLeI18M7gtUnrNrFD4DYaxoMjH5nQ-SYyfvyMOo3VlA,595
14
+ manim_chess/piece_svgs/wP.svg,sha256=BZa3zm9xUXgAtRA_SrA3DUeebWbmnBQR8nSQ0gdy6NY,400
15
+ manim_chess/piece_svgs/wQ.svg,sha256=3SCkD3QlZH7SwQ435sYe8uP3Dx9zy_xxdSy5_DbdwzU,1102
16
+ manim_chess/piece_svgs/wR.svg,sha256=6ela3ONk9djAPG3E2pqfhPVewWSyCRAtRvfm9Ycspcc,481
17
+ manim_chess/pieces.py,sha256=890HggU4vGv_PgLyUPnJj2p3ZdivoqG5BukjqsS6MeU,7634
18
+ manim_chess-0.0.3.dist-info/METADATA,sha256=yBPLYZu2pcVl-Mne2GShgIy2aiZLQjRnK6ZGZKwJtWM,7052
19
+ manim_chess-0.0.3.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
20
+ manim_chess-0.0.3.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.0.0)
2
+ Generator: poetry-core 2.0.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1,9 +0,0 @@
1
- src/__init__.py,sha256=x6PCRFc18I6rHgyQfwkxsxS7bsi9i0QDd7zvMZX0gFA,199
2
- src/board.py,sha256=FIFEiLzssQRtojcIhWCdkiOlaWOaeJqkknSc29bRzsU,19715
3
- src/evaluation_bar.py,sha256=ELjhyFPi5x_Q4Gw3U0FLVhQqN55k8rYCu-lpkru4nPo,3655
4
- src/game_player.py,sha256=fESDu5eksZK9ic47CwQNgeq1rpkcMKt0O7_X7-E5lp0,31102
5
- src/pieces.py,sha256=890HggU4vGv_PgLyUPnJj2p3ZdivoqG5BukjqsS6MeU,7634
6
- manim_chess-0.0.1.dist-info/METADATA,sha256=oSYlLtpXsj6LvT7oKQkLmIIs5g31vLrXyA6VdQ_3U7Y,7257
7
- manim_chess-0.0.1.dist-info/WHEEL,sha256=5Mi1sN9lKoFv_gxcPtisEVrJZihrm_beibeg5R6xb4I,91
8
- manim_chess-0.0.1.dist-info/top_level.txt,sha256=74rtVfumQlgAPzR5_2CgYN24MB0XARCg0t-gzk6gTrM,4
9
- manim_chess-0.0.1.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- src
File without changes
File without changes
File without changes
File without changes
File without changes