trianglengin 2.0.2__cp312-cp312-musllinux_1_2_i686.whl → 2.0.3__cp312-cp312-musllinux_1_2_i686.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.
- trianglengin/game_interface.py +14 -0
- {trianglengin-2.0.2.dist-info → trianglengin-2.0.3.dist-info}/METADATA +4 -4
- {trianglengin-2.0.2.dist-info → trianglengin-2.0.3.dist-info}/RECORD +7 -7
- {trianglengin-2.0.2.dist-info → trianglengin-2.0.3.dist-info}/WHEEL +0 -0
- {trianglengin-2.0.2.dist-info → trianglengin-2.0.3.dist-info}/entry_points.txt +0 -0
- {trianglengin-2.0.2.dist-info → trianglengin-2.0.3.dist-info}/licenses/LICENSE +0 -0
- {trianglengin-2.0.2.dist-info → trianglengin-2.0.3.dist-info}/top_level.txt +0 -0
trianglengin/game_interface.py
CHANGED
@@ -8,6 +8,7 @@ import numpy as np
|
|
8
8
|
from .config import EnvConfig
|
9
9
|
|
10
10
|
try:
|
11
|
+
# Keep the alias for clarity within this file
|
11
12
|
import trianglengin.trianglengin_cpp as cpp_module
|
12
13
|
except ImportError as e:
|
13
14
|
raise ImportError(
|
@@ -127,6 +128,19 @@ class GameState:
|
|
127
128
|
# C++ returns double, cast might be redundant but safe for mypy
|
128
129
|
return cast("float", self._cpp_state.get_score())
|
129
130
|
|
131
|
+
def get_outcome(self) -> float:
|
132
|
+
"""
|
133
|
+
Returns the final outcome of the game if it's over, otherwise 0.0.
|
134
|
+
Required by MCTS implementations like trimcts.
|
135
|
+
"""
|
136
|
+
if self.is_over():
|
137
|
+
# In this game, the final score is the outcome.
|
138
|
+
# Adjust if a different outcome definition is needed (e.g., +1 win, -1 loss).
|
139
|
+
return self.game_score()
|
140
|
+
else:
|
141
|
+
# MCTS typically expects 0 for non-terminal states during simulation.
|
142
|
+
return 0.0
|
143
|
+
|
130
144
|
def valid_actions(self, force_recalculate: bool = False) -> set[int]:
|
131
145
|
"""
|
132
146
|
Returns a set of valid encoded action indices for the current state.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: trianglengin
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.3
|
4
4
|
Summary: High-performance C++/Python engine for a triangle puzzle game.
|
5
5
|
Author-email: "Luis Guilherme P. M." <lgpelin92@gmail.com>
|
6
6
|
License-Expression: MIT
|
@@ -40,7 +40,7 @@ Dynamic: license-file
|
|
40
40
|
[](https://opensource.org/licenses/MIT)
|
41
41
|
[](https://www.python.org/downloads/)
|
42
42
|
|
43
|
-
# Triangle Engine (`trianglengin`) v2
|
43
|
+
# Triangle Engine (`trianglengin`) v2.0.3
|
44
44
|
<img src="bitmap.png" alt="trianglengin logo" width="300"/>
|
45
45
|
|
46
46
|
**Version 2 introduces a high-performance C++ core for the game logic.**
|
@@ -78,7 +78,7 @@ The primary goal is to provide a self-contained, installable library with a high
|
|
78
78
|
|
79
79
|
```bash
|
80
80
|
# For standard use (once published or built):
|
81
|
-
pip install trianglengin
|
81
|
+
pip install trianglengin>=2.0.3
|
82
82
|
|
83
83
|
# Building from source (requires compiler and CMake):
|
84
84
|
git clone https://github.com/lguibr/trianglengin.git
|
@@ -233,7 +233,7 @@ trianglengin/
|
|
233
233
|
## Core Components (v2)
|
234
234
|
|
235
235
|
- **`trianglengin.cpp` (C++ Core)**: Implements the high-performance game logic (state, grid, shapes, rules). Not directly imported in Python.
|
236
|
-
- **`trianglengin.game_interface.GameState` (Python Wrapper)**: The primary Python class for interacting with the game engine. It holds a reference to the C++ game state object and provides methods like `step`, `reset`, `is_over`, `valid_actions`, `get_shapes`, `get_grid_data_np
|
236
|
+
- **`trianglengin.game_interface.GameState` (Python Wrapper)**: The primary Python class for interacting with the game engine. It holds a reference to the C++ game state object and provides methods like `step`, `reset`, `is_over`, `valid_actions`, `get_shapes`, `get_grid_data_np`, **`get_outcome`**.
|
237
237
|
- **`trianglengin.config.EnvConfig`**: Python Pydantic model for core environment configuration. Passed to C++ core during initialization.
|
238
238
|
- **`trianglengin.utils`**: General Python utility functions and types. ([`src/trianglengin/utils/README.md`](src/trianglengin/utils/README.md))
|
239
239
|
|
@@ -1,14 +1,8 @@
|
|
1
1
|
trianglengin.libs/libgcc_s-f3fb5a36.so.1,sha256=SrjjCCuY7RHj-T9JLrY9XFMgCCpYD9Qmezr4uoJGVEQ,168321
|
2
2
|
trianglengin.libs/libstdc++-d2a021ba.so.6.0.32,sha256=1zr_iwGwEBe95gyKdgiw7C4Y1RR9ijV40j66rk4elzg,3537349
|
3
|
-
trianglengin-2.0.2.dist-info/WHEEL,sha256=IhKWbtsq-l3R9sOvgRrkKQKD7QmvveE5Bp0bBRPFL1g,110
|
4
|
-
trianglengin-2.0.2.dist-info/RECORD,,
|
5
|
-
trianglengin-2.0.2.dist-info/top_level.txt,sha256=YsSWmp_2zM23wRc5TRERHpVCgQuVYieYHDTpnwVQC7Y,13
|
6
|
-
trianglengin-2.0.2.dist-info/entry_points.txt,sha256=kQEqO_U-MEpMEC0xwOPSucBzQIq2Ny7XwCtFSruZhvY,57
|
7
|
-
trianglengin-2.0.2.dist-info/METADATA,sha256=Io9O5zLlg5f3wzujuWaJaZWqkVP_6XyOQbj7xtDoiNw,12036
|
8
|
-
trianglengin-2.0.2.dist-info/licenses/LICENSE,sha256=So3rgoJp-HgoxkclxZLIBC3pmmTwshN4tUO8KiQ6akc,1077
|
9
3
|
trianglengin/trianglengin_cpp.cpython-312-i386-linux-musl.so,sha256=zrwcqsIcPbqjVwhv_B0ratwwNIZIPIT0piykSvlp9_I,310085
|
10
4
|
trianglengin/trianglengin_cpp.cpython-37m-i386-linux-gnu.so,sha256=zrwcqsIcPbqjVwhv_B0ratwwNIZIPIT0piykSvlp9_I,310085
|
11
|
-
trianglengin/game_interface.py,sha256=
|
5
|
+
trianglengin/game_interface.py,sha256=ijfBH08DU2sHyMH6XZmQbFQZDPGsKlkk3gk3AUt3fmU,9304
|
12
6
|
trianglengin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
7
|
trianglengin/__init__.py,sha256=4INnGvOYIjzOyCew7lhX6Irc8_H7QVxWc5jopt9TCZ4,919
|
14
8
|
trianglengin/config/README.md,sha256=PKm6HMVMZkA1KB22s2lP-jh5jwB7XIDiFgoShz_xj0s,1506
|
@@ -59,3 +53,9 @@ trianglengin/ui/visualization/core/__init__.py,sha256=26XCOn_jywwQ0YszGP6rEgFJIq
|
|
59
53
|
trianglengin/ui/visualization/core/fonts.py,sha256=d9kQqdilPK0pTvXhv2oVJAbVT4pmWfjKxXfEir7Avdg,2016
|
60
54
|
trianglengin/ui/visualization/core/visualizer.py,sha256=gWY4_vZGEzTokl6Z7xMeGvdrpJMl4YdZnfoT4bgBYW4,8860
|
61
55
|
trianglengin/core/__init__.py,sha256=zMo_rn4wzVGzrevzZM4u4rkLwicZQeDqmXbnk9fI008,460
|
56
|
+
trianglengin-2.0.3.dist-info/WHEEL,sha256=IhKWbtsq-l3R9sOvgRrkKQKD7QmvveE5Bp0bBRPFL1g,110
|
57
|
+
trianglengin-2.0.3.dist-info/RECORD,,
|
58
|
+
trianglengin-2.0.3.dist-info/top_level.txt,sha256=YsSWmp_2zM23wRc5TRERHpVCgQuVYieYHDTpnwVQC7Y,13
|
59
|
+
trianglengin-2.0.3.dist-info/entry_points.txt,sha256=kQEqO_U-MEpMEC0xwOPSucBzQIq2Ny7XwCtFSruZhvY,57
|
60
|
+
trianglengin-2.0.3.dist-info/METADATA,sha256=JQjjqC7xfHqrYAoSZx-07pFzVN4hb1SmyDFPvHG_Lvo,12066
|
61
|
+
trianglengin-2.0.3.dist-info/licenses/LICENSE,sha256=So3rgoJp-HgoxkclxZLIBC3pmmTwshN4tUO8KiQ6akc,1077
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|