belote-cli 0.9.0__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.
- belote/__init__.py +0 -0
- belote/ai.py +412 -0
- belote/ansi.py +141 -0
- belote/bidding.py +68 -0
- belote/deck.py +156 -0
- belote/game.py +537 -0
- belote/input.py +151 -0
- belote/main.py +352 -0
- belote/rules.py +104 -0
- belote/scoring.py +488 -0
- belote/ui.py +825 -0
- belote_cli-0.9.0.dist-info/METADATA +177 -0
- belote_cli-0.9.0.dist-info/RECORD +16 -0
- belote_cli-0.9.0.dist-info/WHEEL +4 -0
- belote_cli-0.9.0.dist-info/entry_points.txt +2 -0
- belote_cli-0.9.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: belote-cli
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: A 4-player terminal card game
|
|
5
|
+
Project-URL: Homepage, https://github.com/ElysiumDisc/belote
|
|
6
|
+
Project-URL: Repository, https://github.com/ElysiumDisc/belote
|
|
7
|
+
Project-URL: Issues, https://github.com/ElysiumDisc/belote/issues
|
|
8
|
+
Author-email: Benjamin <benjamin@example.com>
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 Benjamin
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Classifier: Environment :: Console
|
|
32
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
33
|
+
Classifier: Operating System :: OS Independent
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Requires-Python: >=3.10
|
|
36
|
+
Provides-Extra: test
|
|
37
|
+
Requires-Dist: pytest; extra == 'test'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# Belote – 4-Player Terminal Card Game
|
|
41
|
+
|
|
42
|
+
Complete implementation of the French card game Belote for the terminal, with a full-screen green felt table and full card graphics at compass positions (N/W/E/S).
|
|
43
|
+
|
|
44
|
+
## Showcase
|
|
45
|
+
|
|
46
|
+
### Main Menu
|
|
47
|
+
```text
|
|
48
|
+
⢠⣴⣶⣶⣶⣄
|
|
49
|
+
⣿⣿⣿⣿⣿⣿⣦
|
|
50
|
+
⢰⣿⣿⣿⣿⡿⠟⠁⣠⣴⣶⣦⠄
|
|
51
|
+
⢸⣿⣿⠟⠉⣠⣴⣿⣿⣿⠟⠁⣠⣾⣿⣦⡀
|
|
52
|
+
⠉⣀⣴⣾⣿⣿⣿⠟⢁⣤⣾⣿⣿⣿⣿⣿⡆
|
|
53
|
+
⢀⣤⣾⣿⣿⣿⡿⠛⢁⣴⣿⣿⣿⣿⣿⣿⣿⠟⠁⡀
|
|
54
|
+
⢼⣿⣿⣿⡿⠋⣀⣴⣿⣿⣿⣿⣿⣿⣿⡿⠉⣠⣾⣿⡆
|
|
55
|
+
⠘⢿⡿⠋⣠⣾⣿⣿⣿⠟⠁⣿⣿⣿⣿⣿⠟⢁⣀
|
|
56
|
+
⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣴⣿⣿⣿⠋⢠⣾⣿⣷⣦⡀
|
|
57
|
+
⢻⣿⣿⣿⣿⣿⣿⣿⠟⢁⣴⣿⣿⣿⡿⠁⣰⣿⣿⣿⣿⣿⣿
|
|
58
|
+
⠹⢿⣿⣿⣿⡿⠋⣠⣾⣿⣿⣿⠟⢀⣼⣿⣿⣿⣿⣿⣿⡟
|
|
59
|
+
⠉⠉⠉⠀⢾⣿⣿⣿⣿⠋⠀⠚⠛⠛⠛⠛⠛⠛⠁
|
|
60
|
+
|
|
61
|
+
(
|
|
62
|
+
) (
|
|
63
|
+
___...(-------)-....___
|
|
64
|
+
.-'' ) ( ''-.
|
|
65
|
+
.-'``'|-._ ) _.-|
|
|
66
|
+
/ .--.| `''---...........---''` |
|
|
67
|
+
/ / | > Start Game < |
|
|
68
|
+
| | | Difficulty: Medium |
|
|
69
|
+
\ \ | Target Score: 1000 |
|
|
70
|
+
`\ `\ | Speed: Normal |
|
|
71
|
+
`\ `| Rules & History |
|
|
72
|
+
_/ /\ Quit /
|
|
73
|
+
(__/ \ /
|
|
74
|
+
_..---''` \ /`''---.._
|
|
75
|
+
.-' \ / '-.
|
|
76
|
+
: `-.__ __.-' :
|
|
77
|
+
: ) ''---...---'' ( :
|
|
78
|
+
'._ `''...___...--''` _.'
|
|
79
|
+
jgs \''--..__ __..--''/
|
|
80
|
+
'._ '''----.....______.....----''' _.'
|
|
81
|
+
`''--..,,_____ _____,,..--''`
|
|
82
|
+
`'''----'''`
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Card Graphics
|
|
86
|
+
```text
|
|
87
|
+
┌────┐ ┌────┐ ┌────┐ ┌────┐
|
|
88
|
+
│J ♠ │ │Q ♦ │ │K ♥ │ │A ♣ │
|
|
89
|
+
│ ⚔ │ │ ♕ │ │ ♔ │ │ ★ │
|
|
90
|
+
│ J ♠│ │ Q ♦│ │ K ♥│ │ A ♣│
|
|
91
|
+
└────┘ └────┘ └────┘ └────┘
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Requirements
|
|
95
|
+
|
|
96
|
+
- Python >= 3.10
|
|
97
|
+
- No third-party dependencies (stdlib only)
|
|
98
|
+
- Terminal with >= 100 columns x 40 rows
|
|
99
|
+
- UTF-8 support (for card symbols: ♠♥♦♣)
|
|
100
|
+
|
|
101
|
+
## Quick Start
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Install in editable mode (recommended for development)
|
|
105
|
+
pip install -e .
|
|
106
|
+
|
|
107
|
+
# Or install from PyPI (once uploaded)
|
|
108
|
+
pip install belote-cli
|
|
109
|
+
|
|
110
|
+
# Play using the belote command
|
|
111
|
+
belote
|
|
112
|
+
|
|
113
|
+
# Custom settings
|
|
114
|
+
belote --difficulty hard --target 500
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Controls
|
|
118
|
+
|
|
119
|
+
**Main Menu:**
|
|
120
|
+
- `↑` `↓`: Navigate options
|
|
121
|
+
- `Enter`: Select option
|
|
122
|
+
- `Q`: Quit application
|
|
123
|
+
|
|
124
|
+
**Gameplay:**
|
|
125
|
+
- `←` `→` or `↑` `↓`: Move selection
|
|
126
|
+
- `Enter`: Confirm action
|
|
127
|
+
- `1`-`8`: Direct card/bid selection
|
|
128
|
+
- `Q`: Return to main menu during gameplay
|
|
129
|
+
|
|
130
|
+
## Features
|
|
131
|
+
|
|
132
|
+
- **Rich Terminal UI:** Full-screen green felt table with detailed card graphics, face card art (Roi ♔, Dame ♕, Valet ⚔), and distinct color palettes.
|
|
133
|
+
- **Main Menu:** Configure Difficulty, Target Score, and Game Speed, and access **Rules & History** (EN/FR) without restarting the app.
|
|
134
|
+
- **Live HUD:** Real-time round scoring displays points won during the current round, with a smooth "rolling" numerical animation for total scores.
|
|
135
|
+
- **Trick History:** Visual "Last Trick" panel helps track the flow of the game.
|
|
136
|
+
- **High Fidelity:** Full implementation of French Belote rules including a two-round bidding system, "Dix de Der", and "Capot" (250 pts) announcements.
|
|
137
|
+
- **Rules & History Viewer:** A scrollable, bilingual (English/French) in-game reference for the game's heritage and mechanics.
|
|
138
|
+
- **Robust Input:** High-performance unbuffered key reading for responsive navigation and 'q' to quit functionality.
|
|
139
|
+
|
|
140
|
+
## AI
|
|
141
|
+
|
|
142
|
+
Three difficulty levels:
|
|
143
|
+
- **Easy**: Random legal moves, bids on 2+ honors
|
|
144
|
+
- **Medium**: Heuristic suit scoring, strategic play (cover/duck/duck)
|
|
145
|
+
- **Hard**: Void inference, 1-ply lookahead, Monte-Carlo bidding
|
|
146
|
+
|
|
147
|
+
## Project Structure
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
belote/
|
|
151
|
+
├── src/belote/
|
|
152
|
+
│ ├── main.py # Entry point, game loop, CLI args
|
|
153
|
+
│ ├── deck.py # Card, Suit, Rank, deck operations, points
|
|
154
|
+
│ ├── game.py # GameState, phases, pure transitions, legal moves
|
|
155
|
+
│ ├── bidding.py # Bidding phase state machine
|
|
156
|
+
│ ├── scoring.py # Declarations, round scoring, capot
|
|
157
|
+
│ ├── ai.py # Three-tier AI (easy/medium/hard)
|
|
158
|
+
│ ├── ansi.py # ANSI escape helpers (colors, cursor)
|
|
159
|
+
│ ├── input.py # Platform-dispatched key reader
|
|
160
|
+
│ ├── ui.py # Render, prompts, full-screen layout
|
|
161
|
+
│ └── rules.py # Game rules content
|
|
162
|
+
├── tests/
|
|
163
|
+
│ └── test_belote.py # 36 pytest tests
|
|
164
|
+
├── pyproject.toml # Build system configuration
|
|
165
|
+
├── LICENSE # MIT License
|
|
166
|
+
└── DEVELOPMENT.md # Detailed setup and dev guide
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Running Tests
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
PYTHONPATH=src pytest
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Terminal Hygiene
|
|
176
|
+
|
|
177
|
+
Signal handlers (SIGINT, SIGTERM) and atexit hooks ensure the terminal is always restored — cursor visible, colors reset, alt-screen off — even after Ctrl+C or crashes.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
belote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
belote/ai.py,sha256=l7Pg71bkzR4F-zQhXQaMF37Flt1rIOaZWCMCCUWbWFU,14425
|
|
3
|
+
belote/ansi.py,sha256=EYb5VfYaELpdiKPTf44PUmYx04QaEH9E31TDT1AV7JQ,2373
|
|
4
|
+
belote/bidding.py,sha256=qsIbAUbfNJAUXfEEJSPA8nNMRvDfdSLhLIeF4Zues34,1942
|
|
5
|
+
belote/deck.py,sha256=EHF3c8yWx1nPV5S3aMGRWBMaf_YI8aVaNLmrs-95Wwg,3760
|
|
6
|
+
belote/game.py,sha256=OHeVrs-9trTZI2thXH0KZgHxySCcrRfY-rS4ijU12Xc,17744
|
|
7
|
+
belote/input.py,sha256=WqyUTzxzve6GUUr8z-GpjgBUL-Lr-Yw0nu0HdCt00qU,4616
|
|
8
|
+
belote/main.py,sha256=gYjYf513w9x-yv3HeNs63GCFRNyKkPR8jVaGwv9xl2s,12641
|
|
9
|
+
belote/rules.py,sha256=lptOpEz6-ZrEM2m3VROtVPNYObot3vIs6gvpeikevOg,5024
|
|
10
|
+
belote/scoring.py,sha256=KEFBLyQd9MSSrYdk3EYSrYbp1SHF3GgL5NhGDo2uArA,15811
|
|
11
|
+
belote/ui.py,sha256=9Bj6e-GIobkQqFAHTAHPhO69dGHHztxJxKwn3tinbiU,32717
|
|
12
|
+
belote_cli-0.9.0.dist-info/METADATA,sha256=n7jyCDsDO4cxLwKXZVL4M4PdnwG21n4VSSG6_EK7BXg,7278
|
|
13
|
+
belote_cli-0.9.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
14
|
+
belote_cli-0.9.0.dist-info/entry_points.txt,sha256=esgrdQxQ1fUE51FQN1plA7LJxSioQh7PXuKC5wi87ZQ,44
|
|
15
|
+
belote_cli-0.9.0.dist-info/licenses/LICENSE,sha256=-nl_OZ7bTOL-iWDw4DK3QIYJKwucZa_zV0uGW94TEvM,1065
|
|
16
|
+
belote_cli-0.9.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Benjamin
|
|
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.
|