Skip to content

Python library for a Korean chess called Janggi with a set of classes along with the game logic.

License

Notifications You must be signed in to change notification settings

sungho-cho/pyjanggi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyJanggi

Screen Shot 2022-06-13 at 6 04 29 PM

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.

Documentation

Check out the GitHub Page for package documentation.

Getting Started

Using PyJanggi in Your Package

  1. Install package via pip: pip install janggi

  2. Import in your Python module: import janggi

    You can also import inner modules: from janggi import JanggiGame, generate_random_game

  3. 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.

Testing Functionality

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:

  1. Clone the repository:

    git clone https://github.com/sungho-cho/pyjanggi.git

  2. Install dependencies:

    pip install -r requirements.txt

  3. 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!

Releases

Check out the PyPi Package for releases.

License

This package is licensed under the MIT License.

About

Python library for a Korean chess called Janggi with a set of classes along with the game logic.

Topics

Resources

License

Stars

Watchers

Forks

Languages