tanliyon / gym-xiangqi

This repo sets up the environment to play Xiang Qi (chinese chess) following the OpenAI Gym framework.
GNU Lesser General Public License v3.0
32 stars 6 forks source link

Add more Xiangqi rules to env #37

Closed hojoungjang closed 3 years ago

hojoungjang commented 3 years ago

Description

Mainly added more game rules:

  1. Flying General
    • Any move that result in flying general is rejected by the environment and consequently the agent is penalized for making such illegal move.
  2. Perpetual Check
    • An agent cannot make the same check or "jiang" consecutively for more than THREE times. After making more than three the same type of check (i.e. at 4th iteration of such move), the player loses for violating this rule.
  3. Jiang Reward
    • Awards the player for making jiang moves (though the environment does not warn the player under jiang)
    • You will notice that I have changed one of the existing test, test_env_step_reward. This is because I added jiang reward. I had to modify the moves so that they are only capturing without making jiang.

Type of change

How has this been tested?

CI (I added some basic unit tests for these new changes)