cli-othello 1.0.3__tar.gz → 1.0.4__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.
- cli_othello-1.0.4/LICENSE +7 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/PKG-INFO +17 -3
- {cli_othello-1.0.3 → cli_othello-1.0.4}/README.md +14 -2
- {cli_othello-1.0.3 → cli_othello-1.0.4}/pyproject.toml +1 -1
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello/__init__.py +1 -1
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello/ui.py +26 -12
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello.egg-info/PKG-INFO +17 -3
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello.egg-info/SOURCES.txt +1 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/setup.cfg +0 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello/ai.py +0 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello/board.py +0 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello/cli.py +0 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello.egg-info/dependency_links.txt +0 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello.egg-info/entry_points.txt +0 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello.egg-info/requires.txt +0 -0
- {cli_othello-1.0.3 → cli_othello-1.0.4}/src/cli_othello.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
MITライセンス
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lapius7bot Technology Co.
|
|
4
|
+
|
|
5
|
+
本パッケージおよび関連するドキュメントファイル(以下「本パッケージ」)のコピーを取得したすべての人に対し、本パッケージを無制限に利用する権利を無償で付与します。これには、使用、複製、改変、統合、公開、配布、サブライセンス、および/または販売する権利が含まれますが、これらに限定されません。ただし、以下の条件を遵守することを条件とします。
|
|
6
|
+
上記の著作権表示および本許可通知は、本パッケージのすべてのコピーまたはその大部分に記載する必要があります。
|
|
7
|
+
本パッケージは「現状のまま」使用、その他の取り扱いに起因または関連して生じる請求、損害、その他の責任について、契約違反、不法行為、その他の理由にかかわらず、一切の責任を負いません。提供されるものであり、明示的または黙示的を問わず、商品性、特定目的への適合性、非侵害性に関する保証を含むいかなる保証も行いません。いかなる場合においても、著作者または著作権者は、本パッケージまたはその
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cli-othello
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: Play Othello (Reversi) in your terminal against a 5-level AI
|
|
5
5
|
Author-email: Lapius7 <20071209ryo@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -8,7 +8,9 @@ Project-URL: Homepage, https://github.com/Lapius7/cli-othello
|
|
|
8
8
|
Project-URL: Repository, https://github.com/Lapius7/cli-othello
|
|
9
9
|
Requires-Python: >=3.9
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
11
12
|
Requires-Dist: windows-curses; platform_system == "Windows"
|
|
13
|
+
Dynamic: license-file
|
|
12
14
|
|
|
13
15
|
# cli-othello
|
|
14
16
|
|
|
@@ -17,10 +19,22 @@ Requires-Dist: windows-curses; platform_system == "Windows"
|
|
|
17
19
|
|
|
18
20
|
## インストール
|
|
19
21
|
|
|
22
|
+
### npm(推奨)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm i -g @lapius/cli-othello
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`othello` コマンドが入ります(Node.js 18 以上と Python 3.9 以上が必要)。
|
|
29
|
+
|
|
30
|
+
### pip
|
|
31
|
+
|
|
20
32
|
```bash
|
|
21
33
|
pip install cli-othello
|
|
22
34
|
```
|
|
23
35
|
|
|
36
|
+
Windows では curses を使うために `windows-curses` が必要です。pip で入れた場合は自動で入ります。npm で入れた場合は `py -m pip install windows-curses` で入れてください。
|
|
37
|
+
|
|
24
38
|
## 使い方
|
|
25
39
|
|
|
26
40
|
```bash
|
|
@@ -58,8 +72,8 @@ othello --level 3
|
|
|
58
72
|
|
|
59
73
|
## 必要環境
|
|
60
74
|
|
|
61
|
-
- Python 3.9
|
|
62
|
-
-
|
|
75
|
+
- Python 3.9以上(npm で入れる場合は Node.js 18 以上も)
|
|
76
|
+
- 端末は 57列 x 36行 以上
|
|
63
77
|
|
|
64
78
|
## ライセンス
|
|
65
79
|
|
|
@@ -5,10 +5,22 @@
|
|
|
5
5
|
|
|
6
6
|
## インストール
|
|
7
7
|
|
|
8
|
+
### npm(推奨)
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm i -g @lapius/cli-othello
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`othello` コマンドが入ります(Node.js 18 以上と Python 3.9 以上が必要)。
|
|
15
|
+
|
|
16
|
+
### pip
|
|
17
|
+
|
|
8
18
|
```bash
|
|
9
19
|
pip install cli-othello
|
|
10
20
|
```
|
|
11
21
|
|
|
22
|
+
Windows では curses を使うために `windows-curses` が必要です。pip で入れた場合は自動で入ります。npm で入れた場合は `py -m pip install windows-curses` で入れてください。
|
|
23
|
+
|
|
12
24
|
## 使い方
|
|
13
25
|
|
|
14
26
|
```bash
|
|
@@ -46,8 +58,8 @@ othello --level 3
|
|
|
46
58
|
|
|
47
59
|
## 必要環境
|
|
48
60
|
|
|
49
|
-
- Python 3.9
|
|
50
|
-
-
|
|
61
|
+
- Python 3.9以上(npm で入れる場合は Node.js 18 以上も)
|
|
62
|
+
- 端末は 57列 x 36行 以上
|
|
51
63
|
|
|
52
64
|
## ライセンス
|
|
53
65
|
|
|
@@ -11,17 +11,30 @@ PLAYER_NAMES = {BLACK: "黒", WHITE: "白"}
|
|
|
11
11
|
|
|
12
12
|
# Each cell's interior is CELL_W columns x CELL_H rows, not counting the
|
|
13
13
|
# grid lines drawn around it, so it reads as roughly square in a terminal
|
|
14
|
-
# (chars are about twice as tall as wide).
|
|
15
|
-
# are plain ASCII: full-width characters (e.g. "●", "○") have ambiguous
|
|
16
|
-
# display width and end up misaligned in many terminals/fonts, so discs
|
|
17
|
-
# are shown as a colored background plus a half-width letter instead.
|
|
14
|
+
# (chars are about twice as tall as wide).
|
|
18
15
|
CELL_W = 5
|
|
19
16
|
CELL_H = 2
|
|
20
17
|
|
|
18
|
+
# Round glyphs such as "⬤"/"◯" have ambiguous display width: some
|
|
19
|
+
# terminal/font combinations render them as 1 column, others as 2, and
|
|
20
|
+
# this can't be reliably detected from Python (confirmed: wcwidth's
|
|
21
|
+
# reported width didn't match actual rendering in testing). Discs are
|
|
22
|
+
# therefore drawn as a half-width letter on a solid background instead,
|
|
23
|
+
# which always lines up with the surrounding grid.
|
|
21
24
|
DISC_BLACK = "@"
|
|
22
25
|
DISC_WHITE = "O"
|
|
26
|
+
DISC_WIDTH = 1
|
|
23
27
|
HINT_MARK = "+"
|
|
24
28
|
|
|
29
|
+
|
|
30
|
+
def _center_display(glyph: str, glyph_width: int, total_width: int) -> str:
|
|
31
|
+
"""Center `glyph` (which occupies `glyph_width` display columns) inside
|
|
32
|
+
a field of `total_width` columns, using plain spaces for padding."""
|
|
33
|
+
pad = total_width - glyph_width
|
|
34
|
+
left = pad // 2
|
|
35
|
+
right = pad - left
|
|
36
|
+
return " " * left + glyph + " " * right
|
|
37
|
+
|
|
25
38
|
# Box-drawing characters for the grid lines between cells.
|
|
26
39
|
_TL, _TR, _BL, _BR = "┌", "┐", "└", "┘"
|
|
27
40
|
_H, _V = "─", "│"
|
|
@@ -108,17 +121,18 @@ def _cell_fill_attr(cell: int, is_cursor: bool) -> int:
|
|
|
108
121
|
return curses.color_pair(COLOR_BOARD)
|
|
109
122
|
|
|
110
123
|
|
|
111
|
-
def _cell_center_attr(cell: int, is_cursor: bool, is_hint: bool) -> tuple[int, str]:
|
|
112
|
-
"""Return (attribute, character) for the center row of
|
|
124
|
+
def _cell_center_attr(cell: int, is_cursor: bool, is_hint: bool) -> tuple[int, str, int]:
|
|
125
|
+
"""Return (attribute, character, display_width) for the center row of
|
|
126
|
+
a cell."""
|
|
113
127
|
fill = _cell_fill_attr(cell, is_cursor)
|
|
114
128
|
if cell == BLACK:
|
|
115
|
-
return fill, DISC_BLACK
|
|
129
|
+
return fill, DISC_BLACK, DISC_WIDTH
|
|
116
130
|
if cell == WHITE:
|
|
117
|
-
return fill, DISC_WHITE
|
|
131
|
+
return fill, DISC_WHITE, DISC_WIDTH
|
|
118
132
|
if is_hint:
|
|
119
133
|
attr = curses.color_pair(COLOR_CURSOR_EMPTY if is_cursor else COLOR_HINT) | curses.A_BOLD
|
|
120
|
-
return attr, HINT_MARK
|
|
121
|
-
return fill, " "
|
|
134
|
+
return attr, HINT_MARK, 1
|
|
135
|
+
return fill, " ", 0
|
|
122
136
|
|
|
123
137
|
|
|
124
138
|
def _required_size() -> tuple[int, int]:
|
|
@@ -228,8 +242,8 @@ def _draw_board(
|
|
|
228
242
|
for line in range(CELL_H):
|
|
229
243
|
y = cell_top + line
|
|
230
244
|
if line == (CELL_H - 1) // 2:
|
|
231
|
-
attr, ch = _cell_center_attr(cell, is_cursor, is_hint)
|
|
232
|
-
text = ch
|
|
245
|
+
attr, ch, width = _cell_center_attr(cell, is_cursor, is_hint)
|
|
246
|
+
text = _center_display(ch, width, CELL_W)
|
|
233
247
|
else:
|
|
234
248
|
attr = _cell_fill_attr(cell, is_cursor)
|
|
235
249
|
text = " " * CELL_W
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cli-othello
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: Play Othello (Reversi) in your terminal against a 5-level AI
|
|
5
5
|
Author-email: Lapius7 <20071209ryo@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -8,7 +8,9 @@ Project-URL: Homepage, https://github.com/Lapius7/cli-othello
|
|
|
8
8
|
Project-URL: Repository, https://github.com/Lapius7/cli-othello
|
|
9
9
|
Requires-Python: >=3.9
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
11
12
|
Requires-Dist: windows-curses; platform_system == "Windows"
|
|
13
|
+
Dynamic: license-file
|
|
12
14
|
|
|
13
15
|
# cli-othello
|
|
14
16
|
|
|
@@ -17,10 +19,22 @@ Requires-Dist: windows-curses; platform_system == "Windows"
|
|
|
17
19
|
|
|
18
20
|
## インストール
|
|
19
21
|
|
|
22
|
+
### npm(推奨)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm i -g @lapius/cli-othello
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`othello` コマンドが入ります(Node.js 18 以上と Python 3.9 以上が必要)。
|
|
29
|
+
|
|
30
|
+
### pip
|
|
31
|
+
|
|
20
32
|
```bash
|
|
21
33
|
pip install cli-othello
|
|
22
34
|
```
|
|
23
35
|
|
|
36
|
+
Windows では curses を使うために `windows-curses` が必要です。pip で入れた場合は自動で入ります。npm で入れた場合は `py -m pip install windows-curses` で入れてください。
|
|
37
|
+
|
|
24
38
|
## 使い方
|
|
25
39
|
|
|
26
40
|
```bash
|
|
@@ -58,8 +72,8 @@ othello --level 3
|
|
|
58
72
|
|
|
59
73
|
## 必要環境
|
|
60
74
|
|
|
61
|
-
- Python 3.9
|
|
62
|
-
-
|
|
75
|
+
- Python 3.9以上(npm で入れる場合は Node.js 18 以上も)
|
|
76
|
+
- 端末は 57列 x 36行 以上
|
|
63
77
|
|
|
64
78
|
## ライセンス
|
|
65
79
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|