PyJanggi is a Python library for a Korean chess called Janggi. It provides functionalities to simulate a game, maintain a game board, list all possible moves, make a move, and validate a move.
Check out the GitHub Page for package documentation.
-
Install package via pip:
pip install janggi
-
Import in your Python module:
import janggi
You can also import inner modules:
from janggi import JanggiGame, generate_random_game
-
Call methods to the
JanggiGame
class instance to play the game.3 public methods are:
make_action(self, origin: Location, dest: Location) -> Tuple[float, bool]
get_all_actions(self) -> List[Tuple[Location, Location]]
get_all_destinations(self, origin: Location) -> List[Location]
Check out the Documentation section for more details
You can also check out the gym-janggi repository to learn how PyJanggi package can be utilized.
PyJanggi is originally designed to be imported by other packages and provide Janggi game logic and classes, but if you want to check if the PyJanggi package is working, you can follow these steps:
-
Clone the repository:
git clone https://github.com/sungho-cho/pyjanggi.git
-
Install dependencies:
pip install -r requirements.txt
-
Run
main.py
:python janggi/main.py
If you see the UI window and can navigate with left and right arrow keys, your PyJanggi package is working!
Check out the PyPi Package for releases.
This package is licensed under the MIT License.