ankigammon 1.0.7__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.

Potentially problematic release.


This version of ankigammon might be problematic. Click here for more details.

Files changed (71) hide show
  1. ankigammon-1.0.7/LICENSE +21 -0
  2. ankigammon-1.0.7/PKG-INFO +352 -0
  3. ankigammon-1.0.7/README.md +319 -0
  4. ankigammon-1.0.7/ankigammon/__init__.py +7 -0
  5. ankigammon-1.0.7/ankigammon/__main__.py +6 -0
  6. ankigammon-1.0.7/ankigammon/analysis/__init__.py +13 -0
  7. ankigammon-1.0.7/ankigammon/analysis/score_matrix.py +391 -0
  8. ankigammon-1.0.7/ankigammon/anki/__init__.py +6 -0
  9. ankigammon-1.0.7/ankigammon/anki/ankiconnect.py +216 -0
  10. ankigammon-1.0.7/ankigammon/anki/apkg_exporter.py +111 -0
  11. ankigammon-1.0.7/ankigammon/anki/card_generator.py +1325 -0
  12. ankigammon-1.0.7/ankigammon/anki/card_styles.py +1054 -0
  13. ankigammon-1.0.7/ankigammon/gui/__init__.py +8 -0
  14. ankigammon-1.0.7/ankigammon/gui/app.py +192 -0
  15. ankigammon-1.0.7/ankigammon/gui/dialogs/__init__.py +10 -0
  16. ankigammon-1.0.7/ankigammon/gui/dialogs/export_dialog.py +594 -0
  17. ankigammon-1.0.7/ankigammon/gui/dialogs/import_options_dialog.py +201 -0
  18. ankigammon-1.0.7/ankigammon/gui/dialogs/input_dialog.py +762 -0
  19. ankigammon-1.0.7/ankigammon/gui/dialogs/note_dialog.py +93 -0
  20. ankigammon-1.0.7/ankigammon/gui/dialogs/settings_dialog.py +420 -0
  21. ankigammon-1.0.7/ankigammon/gui/dialogs/update_dialog.py +373 -0
  22. ankigammon-1.0.7/ankigammon/gui/format_detector.py +377 -0
  23. ankigammon-1.0.7/ankigammon/gui/main_window.py +1611 -0
  24. ankigammon-1.0.7/ankigammon/gui/resources/down-arrow.svg +3 -0
  25. ankigammon-1.0.7/ankigammon/gui/resources/icon.icns +0 -0
  26. ankigammon-1.0.7/ankigammon/gui/resources/icon.ico +0 -0
  27. ankigammon-1.0.7/ankigammon/gui/resources/icon.png +0 -0
  28. ankigammon-1.0.7/ankigammon/gui/resources/style.qss +402 -0
  29. ankigammon-1.0.7/ankigammon/gui/resources.py +26 -0
  30. ankigammon-1.0.7/ankigammon/gui/update_checker.py +259 -0
  31. ankigammon-1.0.7/ankigammon/gui/widgets/__init__.py +8 -0
  32. ankigammon-1.0.7/ankigammon/gui/widgets/position_list.py +166 -0
  33. ankigammon-1.0.7/ankigammon/gui/widgets/smart_input.py +268 -0
  34. ankigammon-1.0.7/ankigammon/models.py +356 -0
  35. ankigammon-1.0.7/ankigammon/parsers/__init__.py +7 -0
  36. ankigammon-1.0.7/ankigammon/parsers/gnubg_match_parser.py +1094 -0
  37. ankigammon-1.0.7/ankigammon/parsers/gnubg_parser.py +469 -0
  38. ankigammon-1.0.7/ankigammon/parsers/sgf_parser.py +290 -0
  39. ankigammon-1.0.7/ankigammon/parsers/xg_binary_parser.py +1097 -0
  40. ankigammon-1.0.7/ankigammon/parsers/xg_text_parser.py +688 -0
  41. ankigammon-1.0.7/ankigammon/renderer/__init__.py +5 -0
  42. ankigammon-1.0.7/ankigammon/renderer/animation_controller.py +391 -0
  43. ankigammon-1.0.7/ankigammon/renderer/animation_helper.py +191 -0
  44. ankigammon-1.0.7/ankigammon/renderer/color_schemes.py +145 -0
  45. ankigammon-1.0.7/ankigammon/renderer/svg_board_renderer.py +791 -0
  46. ankigammon-1.0.7/ankigammon/settings.py +315 -0
  47. ankigammon-1.0.7/ankigammon/thirdparty/__init__.py +7 -0
  48. ankigammon-1.0.7/ankigammon/thirdparty/xgdatatools/__init__.py +17 -0
  49. ankigammon-1.0.7/ankigammon/thirdparty/xgdatatools/xgimport.py +160 -0
  50. ankigammon-1.0.7/ankigammon/thirdparty/xgdatatools/xgstruct.py +1032 -0
  51. ankigammon-1.0.7/ankigammon/thirdparty/xgdatatools/xgutils.py +118 -0
  52. ankigammon-1.0.7/ankigammon/thirdparty/xgdatatools/xgzarc.py +260 -0
  53. ankigammon-1.0.7/ankigammon/utils/__init__.py +13 -0
  54. ankigammon-1.0.7/ankigammon/utils/gnubg_analyzer.py +590 -0
  55. ankigammon-1.0.7/ankigammon/utils/gnuid.py +577 -0
  56. ankigammon-1.0.7/ankigammon/utils/move_parser.py +204 -0
  57. ankigammon-1.0.7/ankigammon/utils/ogid.py +326 -0
  58. ankigammon-1.0.7/ankigammon/utils/xgid.py +386 -0
  59. ankigammon-1.0.7/ankigammon.egg-info/PKG-INFO +352 -0
  60. ankigammon-1.0.7/ankigammon.egg-info/SOURCES.txt +69 -0
  61. ankigammon-1.0.7/ankigammon.egg-info/dependency_links.txt +1 -0
  62. ankigammon-1.0.7/ankigammon.egg-info/entry_points.txt +2 -0
  63. ankigammon-1.0.7/ankigammon.egg-info/requires.txt +9 -0
  64. ankigammon-1.0.7/ankigammon.egg-info/top_level.txt +1 -0
  65. ankigammon-1.0.7/pyproject.toml +59 -0
  66. ankigammon-1.0.7/setup.cfg +4 -0
  67. ankigammon-1.0.7/tests/test_basic.py +914 -0
  68. ankigammon-1.0.7/tests/test_format_detector.py +76 -0
  69. ankigammon-1.0.7/tests/test_import_dialog_player_matching.py +215 -0
  70. ankigammon-1.0.7/tests/test_played_move_injection.py +217 -0
  71. ankigammon-1.0.7/tests/test_settings.py +143 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AnkiGammon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,352 @@
1
+ Metadata-Version: 2.4
2
+ Name: ankigammon
3
+ Version: 1.0.7
4
+ Summary: Convert eXtreme Gammon backgammon analysis into Anki flashcards
5
+ Author-email: AnkiGammon Contributors <admin@ankigammon.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Deinonychus999/AnkiGammon
8
+ Project-URL: Repository, https://github.com/Deinonychus999/AnkiGammon
9
+ Project-URL: Documentation, https://github.com/Deinonychus999/AnkiGammon#readme
10
+ Project-URL: Issues, https://github.com/Deinonychus999/AnkiGammon/issues
11
+ Keywords: anki,flashcards,backgammon,extreme-gammon,xg,learning,spaced-repetition
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Topic :: Games/Entertainment :: Board Games
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: genanki>=0.13.0
25
+ Requires-Dist: requests>=2.31.0
26
+ Requires-Dist: PySide6>=6.6.0
27
+ Requires-Dist: PySide6-Addons>=6.6.0
28
+ Requires-Dist: qtawesome>=1.3.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pyinstaller>=6.0.0; extra == "dev"
31
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # AnkiGammon
35
+
36
+ A graphical application for converting backgammon positions into Anki flashcards. Analyze positions from eXtreme Gammon, OpenGammon, or GNU Backgammon and create smart study cards.
37
+
38
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/X8X31NIT0H)
39
+
40
+ ## Features
41
+
42
+ - **Modern GUI interface** - Easy-to-use graphical application with drag-and-drop support
43
+ - **Multiple input formats** - XGID/OGID/GNUID position IDs, XG binary files (.xg), match files (.mat), SGF files
44
+ - **Direct XG export support** - Copy/paste pre-analyzed positions from eXtreme Gammon
45
+ - **File import with filtering** - Drag-and-drop files with error threshold and player selection
46
+ - **GNU Backgammon integration** - Analyze unanalyzed positions automatically
47
+ - **Automatic format detection** - Paste any supported format, the app detects it automatically
48
+ - **Two export methods**:
49
+ - AnkiConnect: Push directly to Anki (recommended)
50
+ - APKG: Self-contained package for manual import
51
+ - **Customizable appearance** - 6 color schemes, board orientation, configurable MCQ options (2-10)
52
+ - **Position management** - Multi-select, add notes, preview positions before export
53
+
54
+ ## Installation
55
+
56
+ ### Standalone Executable (Recommended)
57
+
58
+ Download pre-built executables from [GitHub Releases](https://github.com/Deinonychus999/AnkiGammon/releases):
59
+
60
+ **Windows:**
61
+ 1. Download `ankigammon-windows.zip` from the latest release
62
+ 2. Extract the ZIP file
63
+ 3. Double-click `ankigammon.exe`
64
+ 4. **Windows SmartScreen Warning:** Click "More info" → "Run anyway"
65
+ - This warning appears because the app is not code-signed
66
+ - The application is safe and open-source
67
+
68
+ **macOS:**
69
+ 1. Download `AnkiGammon-macOS.dmg` from the latest release
70
+ 2. Open the DMG file
71
+ 3. Drag AnkiGammon to your Applications folder
72
+ 4. **First time only:** Right-click AnkiGammon → Open
73
+ - If blocked, go to System Settings → Privacy & Security
74
+ - Scroll down and click "Open Anyway"
75
+ - Enter your password when prompted
76
+ 5. After first run, you can open AnkiGammon normally
77
+
78
+ **Why do I see a security warning on macOS?**
79
+ AnkiGammon is not code-signed because that requires a $99/year Apple Developer account. The app is open-source and safe to use.
80
+
81
+ **Linux:**
82
+ 1. Download `AnkiGammon-x86_64.AppImage` from the latest release
83
+ 2. Make it executable:
84
+ - Right-click → Properties → Permissions → "Allow executing file as program"
85
+ - Or via terminal: `chmod +x AnkiGammon-x86_64.AppImage`
86
+ 3. Double-click to run!
87
+
88
+ **Note for Ubuntu 22.04+ users:** If the AppImage doesn't run, install FUSE 2:
89
+ - Ubuntu 22.04: `sudo apt install libfuse2`
90
+ - Ubuntu 24.04: `sudo apt install libfuse2t64`
91
+
92
+ ### Install via pip
93
+
94
+ [![PyPI version](https://badge.fury.io/py/ankigammon.svg)](https://pypi.org/project/ankigammon/)
95
+
96
+ If you have Python 3.8+ installed:
97
+
98
+ ```bash
99
+ pip install ankigammon
100
+ ankigammon # Launch the GUI
101
+ ```
102
+
103
+ ### Development Install
104
+
105
+ For developers who want to run from source:
106
+
107
+ ```bash
108
+ git clone https://github.com/Deinonychus999/AnkiGammon.git
109
+ cd AnkiGammon
110
+ pip install -e . # Install in editable mode
111
+ ankigammon # Launches the GUI
112
+ ```
113
+
114
+ ## Usage
115
+
116
+ 1. **Launch the application**:
117
+ - Windows: Double-click `ankigammon.exe`
118
+ - macOS: Open AnkiGammon from Applications folder
119
+ - Linux: Double-click `AnkiGammon-x86_64.AppImage`
120
+ - From PyPI install: Run `ankigammon` in terminal
121
+ 2. **Add positions** (choose one or more methods):
122
+ - **Paste XG analysis**: Press Ctrl+N, paste pre-analyzed positions from eXtreme Gammon (Ctrl+C)
123
+ - **Paste position IDs**: Press Ctrl+N, paste XGID/OGID/GNUID strings (requires GNU Backgammon for analysis)
124
+ - **Import files**: Press Ctrl+O or drag-and-drop files (.xg, .mat, .sgf, .txt)
125
+ - For match files: Choose error threshold and which player's mistakes to import
126
+ 3. **Configure settings** - Choose color scheme, board orientation, and export method (Ctrl+,)
127
+ 4. **Generate cards** - Click "Generate Cards" (Ctrl+E) to create Anki flashcards
128
+
129
+ ### Keyboard Shortcuts
130
+
131
+ - **Ctrl+N** - Add positions
132
+ - **Ctrl+O** - Import file
133
+ - **Ctrl+E** - Export cards
134
+ - **Ctrl+,** - Settings
135
+ - **Ctrl+Q** - Quit
136
+ - **Delete/Backspace** - Remove selected positions
137
+
138
+ ### Position Analysis
139
+
140
+ Unanalyzed positions (position IDs, match files, SGF files) can be analyzed using GNU Backgammon if configured in Settings (see Customization Options below).
141
+
142
+ ## Supported Formats
143
+
144
+ AnkiGammon supports multiple input formats with automatic detection:
145
+
146
+ ### XG Text Export (Pre-Analyzed)
147
+
148
+ Import **pre-analyzed positions** directly from eXtreme Gammon:
149
+
150
+ 1. In eXtreme Gammon, analyze a position
151
+ 2. Press Ctrl+C to copy the full analysis
152
+ 3. Paste into AnkiGammon's input area
153
+
154
+ ### Position ID Formats (Unanalyzed)
155
+
156
+ Position IDs encode positions without move analysis. Configure GNU Backgammon in Settings to enable automatic analysis.
157
+
158
+ - **XGID (eXtreme Gammon ID)** - 26-character position string + metadata fields
159
+ - Example: `XGID=---BBBBAAA---Ac-bbccbAA-A-:1:1:-1:63:4:3:0:5:8`
160
+
161
+ - **OGID (OpenGammon Position ID)** - Base-26 position encoding with colon-separated fields
162
+ - Example: `cccccggggg:ddddiiiiii:N0N:63:W:IW:4:3:7:1:15`
163
+
164
+ - **GNUID (GNU Backgammon ID)** - Compact Base64 format (PositionID:MatchID)
165
+ - Example: `4HPwATDgc/ABMA:8IhuACAACAAE`
166
+
167
+ All formats fully support position encoding, cube state, dice, and match metadata.
168
+
169
+ ### File Formats
170
+
171
+ - **XG Binary files (.xg)** - eXtreme Gammon native format (includes pre-analysis from XG)
172
+ - **Match files (.mat, .txt)** - GNU Backgammon match exports (requires GNU Backgammon for analysis)
173
+ - **SGF files (.sgf)** - Smart Game Format for backgammon (requires GNU Backgammon for analysis)
174
+
175
+ Import via Ctrl+O or drag-and-drop directly onto the window.
176
+
177
+ ### Format Detection
178
+
179
+ The application **automatically detects** which format you're using. Just paste your position and AnkiGammon will handle it:
180
+ - XGID: Detected by `XGID=` prefix
181
+ - OGID: Detected by base-26 pattern with colons
182
+ - GNUID: Detected by base64 pattern
183
+
184
+ You can mix formats in the same input - each position can use a different format!
185
+
186
+ ## Export Methods
187
+
188
+ ### AnkiConnect (Recommended)
189
+
190
+ Push cards directly to running Anki through the GUI:
191
+ - Install [AnkiConnect addon](https://ankiweb.net/shared/info/2055492159)
192
+ - Keep Anki running while generating cards
193
+ - Cards appear instantly in your deck
194
+
195
+ ### APKG
196
+
197
+ Generate a package file for manual import:
198
+ - Select "APKG" in Settings
199
+ - Import into Anki: File → Import → Select the .apkg file
200
+ - Useful for offline card generation
201
+
202
+ ## Card Format
203
+
204
+ Each position becomes one Anki card:
205
+
206
+ **Front:**
207
+ - Board image showing the position
208
+ - Metadata: player on roll, dice, score, cube, match length
209
+ - Multiple choice: Candidate moves (configurable 2-10, labeled A-J, shuffled)
210
+ - Optional text move descriptions
211
+
212
+ **Back:**
213
+ - Position image and metadata
214
+ - Ranked table of moves with equity and error
215
+ - Correct answer highlighted
216
+ - Source position ID for reference
217
+ - Explanation (if added)
218
+ - Score matrix showing optimal cube actions across all match scores (if enabled)
219
+
220
+ ## Customization Options
221
+
222
+ Open Settings with **Ctrl+,** to configure:
223
+
224
+ **Appearance:**
225
+ - **Color Schemes**: Choose from 6 built-in themes (Classic, Forest, Ocean, Desert, Sunset, Midnight)
226
+ - **Board Orientation**: Counter-clockwise (default) or Clockwise orientation
227
+ - **Number of MCQ Options**: Configure how many moves to display (2-10, default: 5)
228
+
229
+ **Card Options:**
230
+ - **Show Move Options**: Toggle text move descriptions on card front
231
+ - **Interactive Moves**: Enable/disable animated move visualization
232
+
233
+ **Export:**
234
+ - **Deck Name**: Customize your Anki deck name
235
+ - **Export Method**: Choose between AnkiConnect or APKG output
236
+
237
+ **Analysis:**
238
+ - **GNU Backgammon Path**: Configure path to `gnubg-cli` executable for automatic position analysis
239
+ - **Analysis Ply**: Set depth (0-4, default: 3)
240
+ - **Score Matrix**: Generate cube decision matrix for all match scores (optional, time-consuming)
241
+
242
+ ## Troubleshooting
243
+
244
+ **"Cannot connect to Anki-Connect"**
245
+ - Install AnkiConnect addon: https://ankiweb.net/shared/info/2055492159
246
+ - Make sure Anki is running
247
+ - Check firewall isn't blocking localhost:8765
248
+
249
+ **"No decisions found in input"**
250
+ - Ensure input includes position ID lines (XGID, OGID, or GNUID format)
251
+ - Copy the full analyzed position from XG (press Ctrl+C)
252
+
253
+ **Application won't start**
254
+ - Windows: Click "More info" → "Run anyway" if SmartScreen blocks the app
255
+ - macOS: Right-click → Open on first run, or go to System Settings → Privacy & Security → "Open Anyway"
256
+ - Linux: Make the AppImage executable with `chmod +x AnkiGammon-x86_64.AppImage`
257
+ - Linux (Ubuntu 22.04+): Install FUSE 2 with `sudo apt install libfuse2` or `sudo apt install libfuse2t64` (Ubuntu 24.04)
258
+ - Linux (running from source): If you get `ImportError: libxkbcommon.so.0`, install Qt dependencies with `sudo apt install libxkbcommon0 libxcb1`
259
+
260
+ ## For Developers
261
+
262
+ ### Building the Executable
263
+
264
+ **Quick Build:**
265
+
266
+ Windows:
267
+ ```bash
268
+ build_executable.bat
269
+ ```
270
+
271
+ macOS/Linux:
272
+ ```bash
273
+ chmod +x build_executable.sh
274
+ ./build_executable.sh
275
+ ```
276
+
277
+ The executable will be in the `dist/` folder.
278
+
279
+ **Manual Build (if script doesn't work):**
280
+
281
+ Windows:
282
+ ```bash
283
+ # Install PyInstaller
284
+ pip install pyinstaller
285
+
286
+ # Clean previous builds
287
+ rmdir /s /q build dist
288
+
289
+ # Build
290
+ pyinstaller ankigammon.spec
291
+ ```
292
+
293
+ macOS/Linux:
294
+ ```bash
295
+ # Install PyInstaller
296
+ pip3 install pyinstaller
297
+
298
+ # Clean previous builds
299
+ rm -rf build dist
300
+
301
+ # Build
302
+ pyinstaller ankigammon.spec
303
+
304
+ # Remove quarantine attribute (macOS only)
305
+ xattr -cr dist/ankigammon
306
+ ```
307
+
308
+ ### Testing the Build
309
+
310
+ Windows:
311
+ ```bash
312
+ # Test the GUI launches
313
+ cd dist
314
+ ankigammon.exe
315
+ ```
316
+
317
+ macOS/Linux:
318
+ ```bash
319
+ # Test the GUI launches
320
+ cd dist
321
+ ./ankigammon
322
+ ```
323
+
324
+ ### Settings Storage
325
+
326
+ User preferences (color scheme, deck name, board orientation, etc.) are automatically saved to:
327
+ - Windows: `C:\Users\YourName\.ankigammon\config.json`
328
+ - macOS: `~/.ankigammon/config.json`
329
+ - Linux: `~/.ankigammon/config.json`
330
+
331
+ Settings persist across application restarts, even when using the standalone executable.
332
+
333
+ ### Troubleshooting Build Issues
334
+
335
+ **Missing modules in executable:**
336
+ - Add the module to `hiddenimports` in `ankigammon.spec`
337
+ - Or try: `pyinstaller --collect-all ankigammon ankigammon.spec`
338
+
339
+ **macOS code signing:**
340
+ - Remove quarantine for local testing: `xattr -cr dist/ankigammon`
341
+
342
+ ## Requirements
343
+
344
+ - Python 3.8+ (for development install only)
345
+ - Dependencies automatically installed via `pip install .`: genanki, requests, PySide6, qtawesome
346
+ - For standalone executable: No requirements - Python and all dependencies are bundled
347
+
348
+ ## License
349
+
350
+ AnkiGammon is licensed under the MIT License. See [LICENSE](LICENSE) for details.
351
+
352
+ For third-party licenses and attributions, see [THIRD-PARTY-LICENSES.md](THIRD-PARTY-LICENSES.md).
@@ -0,0 +1,319 @@
1
+ # AnkiGammon
2
+
3
+ A graphical application for converting backgammon positions into Anki flashcards. Analyze positions from eXtreme Gammon, OpenGammon, or GNU Backgammon and create smart study cards.
4
+
5
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/X8X31NIT0H)
6
+
7
+ ## Features
8
+
9
+ - **Modern GUI interface** - Easy-to-use graphical application with drag-and-drop support
10
+ - **Multiple input formats** - XGID/OGID/GNUID position IDs, XG binary files (.xg), match files (.mat), SGF files
11
+ - **Direct XG export support** - Copy/paste pre-analyzed positions from eXtreme Gammon
12
+ - **File import with filtering** - Drag-and-drop files with error threshold and player selection
13
+ - **GNU Backgammon integration** - Analyze unanalyzed positions automatically
14
+ - **Automatic format detection** - Paste any supported format, the app detects it automatically
15
+ - **Two export methods**:
16
+ - AnkiConnect: Push directly to Anki (recommended)
17
+ - APKG: Self-contained package for manual import
18
+ - **Customizable appearance** - 6 color schemes, board orientation, configurable MCQ options (2-10)
19
+ - **Position management** - Multi-select, add notes, preview positions before export
20
+
21
+ ## Installation
22
+
23
+ ### Standalone Executable (Recommended)
24
+
25
+ Download pre-built executables from [GitHub Releases](https://github.com/Deinonychus999/AnkiGammon/releases):
26
+
27
+ **Windows:**
28
+ 1. Download `ankigammon-windows.zip` from the latest release
29
+ 2. Extract the ZIP file
30
+ 3. Double-click `ankigammon.exe`
31
+ 4. **Windows SmartScreen Warning:** Click "More info" → "Run anyway"
32
+ - This warning appears because the app is not code-signed
33
+ - The application is safe and open-source
34
+
35
+ **macOS:**
36
+ 1. Download `AnkiGammon-macOS.dmg` from the latest release
37
+ 2. Open the DMG file
38
+ 3. Drag AnkiGammon to your Applications folder
39
+ 4. **First time only:** Right-click AnkiGammon → Open
40
+ - If blocked, go to System Settings → Privacy & Security
41
+ - Scroll down and click "Open Anyway"
42
+ - Enter your password when prompted
43
+ 5. After first run, you can open AnkiGammon normally
44
+
45
+ **Why do I see a security warning on macOS?**
46
+ AnkiGammon is not code-signed because that requires a $99/year Apple Developer account. The app is open-source and safe to use.
47
+
48
+ **Linux:**
49
+ 1. Download `AnkiGammon-x86_64.AppImage` from the latest release
50
+ 2. Make it executable:
51
+ - Right-click → Properties → Permissions → "Allow executing file as program"
52
+ - Or via terminal: `chmod +x AnkiGammon-x86_64.AppImage`
53
+ 3. Double-click to run!
54
+
55
+ **Note for Ubuntu 22.04+ users:** If the AppImage doesn't run, install FUSE 2:
56
+ - Ubuntu 22.04: `sudo apt install libfuse2`
57
+ - Ubuntu 24.04: `sudo apt install libfuse2t64`
58
+
59
+ ### Install via pip
60
+
61
+ [![PyPI version](https://badge.fury.io/py/ankigammon.svg)](https://pypi.org/project/ankigammon/)
62
+
63
+ If you have Python 3.8+ installed:
64
+
65
+ ```bash
66
+ pip install ankigammon
67
+ ankigammon # Launch the GUI
68
+ ```
69
+
70
+ ### Development Install
71
+
72
+ For developers who want to run from source:
73
+
74
+ ```bash
75
+ git clone https://github.com/Deinonychus999/AnkiGammon.git
76
+ cd AnkiGammon
77
+ pip install -e . # Install in editable mode
78
+ ankigammon # Launches the GUI
79
+ ```
80
+
81
+ ## Usage
82
+
83
+ 1. **Launch the application**:
84
+ - Windows: Double-click `ankigammon.exe`
85
+ - macOS: Open AnkiGammon from Applications folder
86
+ - Linux: Double-click `AnkiGammon-x86_64.AppImage`
87
+ - From PyPI install: Run `ankigammon` in terminal
88
+ 2. **Add positions** (choose one or more methods):
89
+ - **Paste XG analysis**: Press Ctrl+N, paste pre-analyzed positions from eXtreme Gammon (Ctrl+C)
90
+ - **Paste position IDs**: Press Ctrl+N, paste XGID/OGID/GNUID strings (requires GNU Backgammon for analysis)
91
+ - **Import files**: Press Ctrl+O or drag-and-drop files (.xg, .mat, .sgf, .txt)
92
+ - For match files: Choose error threshold and which player's mistakes to import
93
+ 3. **Configure settings** - Choose color scheme, board orientation, and export method (Ctrl+,)
94
+ 4. **Generate cards** - Click "Generate Cards" (Ctrl+E) to create Anki flashcards
95
+
96
+ ### Keyboard Shortcuts
97
+
98
+ - **Ctrl+N** - Add positions
99
+ - **Ctrl+O** - Import file
100
+ - **Ctrl+E** - Export cards
101
+ - **Ctrl+,** - Settings
102
+ - **Ctrl+Q** - Quit
103
+ - **Delete/Backspace** - Remove selected positions
104
+
105
+ ### Position Analysis
106
+
107
+ Unanalyzed positions (position IDs, match files, SGF files) can be analyzed using GNU Backgammon if configured in Settings (see Customization Options below).
108
+
109
+ ## Supported Formats
110
+
111
+ AnkiGammon supports multiple input formats with automatic detection:
112
+
113
+ ### XG Text Export (Pre-Analyzed)
114
+
115
+ Import **pre-analyzed positions** directly from eXtreme Gammon:
116
+
117
+ 1. In eXtreme Gammon, analyze a position
118
+ 2. Press Ctrl+C to copy the full analysis
119
+ 3. Paste into AnkiGammon's input area
120
+
121
+ ### Position ID Formats (Unanalyzed)
122
+
123
+ Position IDs encode positions without move analysis. Configure GNU Backgammon in Settings to enable automatic analysis.
124
+
125
+ - **XGID (eXtreme Gammon ID)** - 26-character position string + metadata fields
126
+ - Example: `XGID=---BBBBAAA---Ac-bbccbAA-A-:1:1:-1:63:4:3:0:5:8`
127
+
128
+ - **OGID (OpenGammon Position ID)** - Base-26 position encoding with colon-separated fields
129
+ - Example: `cccccggggg:ddddiiiiii:N0N:63:W:IW:4:3:7:1:15`
130
+
131
+ - **GNUID (GNU Backgammon ID)** - Compact Base64 format (PositionID:MatchID)
132
+ - Example: `4HPwATDgc/ABMA:8IhuACAACAAE`
133
+
134
+ All formats fully support position encoding, cube state, dice, and match metadata.
135
+
136
+ ### File Formats
137
+
138
+ - **XG Binary files (.xg)** - eXtreme Gammon native format (includes pre-analysis from XG)
139
+ - **Match files (.mat, .txt)** - GNU Backgammon match exports (requires GNU Backgammon for analysis)
140
+ - **SGF files (.sgf)** - Smart Game Format for backgammon (requires GNU Backgammon for analysis)
141
+
142
+ Import via Ctrl+O or drag-and-drop directly onto the window.
143
+
144
+ ### Format Detection
145
+
146
+ The application **automatically detects** which format you're using. Just paste your position and AnkiGammon will handle it:
147
+ - XGID: Detected by `XGID=` prefix
148
+ - OGID: Detected by base-26 pattern with colons
149
+ - GNUID: Detected by base64 pattern
150
+
151
+ You can mix formats in the same input - each position can use a different format!
152
+
153
+ ## Export Methods
154
+
155
+ ### AnkiConnect (Recommended)
156
+
157
+ Push cards directly to running Anki through the GUI:
158
+ - Install [AnkiConnect addon](https://ankiweb.net/shared/info/2055492159)
159
+ - Keep Anki running while generating cards
160
+ - Cards appear instantly in your deck
161
+
162
+ ### APKG
163
+
164
+ Generate a package file for manual import:
165
+ - Select "APKG" in Settings
166
+ - Import into Anki: File → Import → Select the .apkg file
167
+ - Useful for offline card generation
168
+
169
+ ## Card Format
170
+
171
+ Each position becomes one Anki card:
172
+
173
+ **Front:**
174
+ - Board image showing the position
175
+ - Metadata: player on roll, dice, score, cube, match length
176
+ - Multiple choice: Candidate moves (configurable 2-10, labeled A-J, shuffled)
177
+ - Optional text move descriptions
178
+
179
+ **Back:**
180
+ - Position image and metadata
181
+ - Ranked table of moves with equity and error
182
+ - Correct answer highlighted
183
+ - Source position ID for reference
184
+ - Explanation (if added)
185
+ - Score matrix showing optimal cube actions across all match scores (if enabled)
186
+
187
+ ## Customization Options
188
+
189
+ Open Settings with **Ctrl+,** to configure:
190
+
191
+ **Appearance:**
192
+ - **Color Schemes**: Choose from 6 built-in themes (Classic, Forest, Ocean, Desert, Sunset, Midnight)
193
+ - **Board Orientation**: Counter-clockwise (default) or Clockwise orientation
194
+ - **Number of MCQ Options**: Configure how many moves to display (2-10, default: 5)
195
+
196
+ **Card Options:**
197
+ - **Show Move Options**: Toggle text move descriptions on card front
198
+ - **Interactive Moves**: Enable/disable animated move visualization
199
+
200
+ **Export:**
201
+ - **Deck Name**: Customize your Anki deck name
202
+ - **Export Method**: Choose between AnkiConnect or APKG output
203
+
204
+ **Analysis:**
205
+ - **GNU Backgammon Path**: Configure path to `gnubg-cli` executable for automatic position analysis
206
+ - **Analysis Ply**: Set depth (0-4, default: 3)
207
+ - **Score Matrix**: Generate cube decision matrix for all match scores (optional, time-consuming)
208
+
209
+ ## Troubleshooting
210
+
211
+ **"Cannot connect to Anki-Connect"**
212
+ - Install AnkiConnect addon: https://ankiweb.net/shared/info/2055492159
213
+ - Make sure Anki is running
214
+ - Check firewall isn't blocking localhost:8765
215
+
216
+ **"No decisions found in input"**
217
+ - Ensure input includes position ID lines (XGID, OGID, or GNUID format)
218
+ - Copy the full analyzed position from XG (press Ctrl+C)
219
+
220
+ **Application won't start**
221
+ - Windows: Click "More info" → "Run anyway" if SmartScreen blocks the app
222
+ - macOS: Right-click → Open on first run, or go to System Settings → Privacy & Security → "Open Anyway"
223
+ - Linux: Make the AppImage executable with `chmod +x AnkiGammon-x86_64.AppImage`
224
+ - Linux (Ubuntu 22.04+): Install FUSE 2 with `sudo apt install libfuse2` or `sudo apt install libfuse2t64` (Ubuntu 24.04)
225
+ - Linux (running from source): If you get `ImportError: libxkbcommon.so.0`, install Qt dependencies with `sudo apt install libxkbcommon0 libxcb1`
226
+
227
+ ## For Developers
228
+
229
+ ### Building the Executable
230
+
231
+ **Quick Build:**
232
+
233
+ Windows:
234
+ ```bash
235
+ build_executable.bat
236
+ ```
237
+
238
+ macOS/Linux:
239
+ ```bash
240
+ chmod +x build_executable.sh
241
+ ./build_executable.sh
242
+ ```
243
+
244
+ The executable will be in the `dist/` folder.
245
+
246
+ **Manual Build (if script doesn't work):**
247
+
248
+ Windows:
249
+ ```bash
250
+ # Install PyInstaller
251
+ pip install pyinstaller
252
+
253
+ # Clean previous builds
254
+ rmdir /s /q build dist
255
+
256
+ # Build
257
+ pyinstaller ankigammon.spec
258
+ ```
259
+
260
+ macOS/Linux:
261
+ ```bash
262
+ # Install PyInstaller
263
+ pip3 install pyinstaller
264
+
265
+ # Clean previous builds
266
+ rm -rf build dist
267
+
268
+ # Build
269
+ pyinstaller ankigammon.spec
270
+
271
+ # Remove quarantine attribute (macOS only)
272
+ xattr -cr dist/ankigammon
273
+ ```
274
+
275
+ ### Testing the Build
276
+
277
+ Windows:
278
+ ```bash
279
+ # Test the GUI launches
280
+ cd dist
281
+ ankigammon.exe
282
+ ```
283
+
284
+ macOS/Linux:
285
+ ```bash
286
+ # Test the GUI launches
287
+ cd dist
288
+ ./ankigammon
289
+ ```
290
+
291
+ ### Settings Storage
292
+
293
+ User preferences (color scheme, deck name, board orientation, etc.) are automatically saved to:
294
+ - Windows: `C:\Users\YourName\.ankigammon\config.json`
295
+ - macOS: `~/.ankigammon/config.json`
296
+ - Linux: `~/.ankigammon/config.json`
297
+
298
+ Settings persist across application restarts, even when using the standalone executable.
299
+
300
+ ### Troubleshooting Build Issues
301
+
302
+ **Missing modules in executable:**
303
+ - Add the module to `hiddenimports` in `ankigammon.spec`
304
+ - Or try: `pyinstaller --collect-all ankigammon ankigammon.spec`
305
+
306
+ **macOS code signing:**
307
+ - Remove quarantine for local testing: `xattr -cr dist/ankigammon`
308
+
309
+ ## Requirements
310
+
311
+ - Python 3.8+ (for development install only)
312
+ - Dependencies automatically installed via `pip install .`: genanki, requests, PySide6, qtawesome
313
+ - For standalone executable: No requirements - Python and all dependencies are bundled
314
+
315
+ ## License
316
+
317
+ AnkiGammon is licensed under the MIT License. See [LICENSE](LICENSE) for details.
318
+
319
+ For third-party licenses and attributions, see [THIRD-PARTY-LICENSES.md](THIRD-PARTY-LICENSES.md).
@@ -0,0 +1,7 @@
1
+ """AnkiGammon: Convert eXtreme Gammon analysis into Anki flashcards."""
2
+
3
+ __version__ = "1.0.7"
4
+
5
+ from ankigammon.models import Decision, Move, Position, CubeState
6
+
7
+ __all__ = ["Decision", "Move", "Position", "CubeState"]