Skip to content

This is a custom made OpenAI gym environment for a boardgame I invented.

Notifications You must be signed in to change notification settings

RajGhugare19/gym-OctaKing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

OctaKing

This is a custom made OpenAI gym environment.Most games like chess, Go have a very large branching factor and are difficult to solve with limited rescources. While games like Tic-Tac-Toe are very trivially solved because of a very small game-tree. OctaKing is a board game which might help you fetch the best of both these worlds.

Summary

Rules

  1. Each player will start the game with four kings on a 4 cross 4 board, with the black and white kings on the fourth and the first rank respectively.
  2. Kings can move in the same way they do in chess, excpet they cannot take a move in the backward direction, i.e of the 8 cardinal and inter-cardinal directions, the king can move only in five.The following image shows all 5 legal moves that a king can choose from.

  1. If there is a black king on any of these marked squares then the white king can capture it and vice versa.
  2. A player wins if any one of his kings reaches the other end of the board or all of the pieces of the opponent player have been captured.
  3. If 16 half-moves are played without any capture then the game ends in a draw.

How to install

Dependencies:

Setup:

  • To setup the OctaKing package
pip install -e .

Imports:

To import the environment in python

import gym
import gym_OctaKing
env = gym.make('OctaKing-v0')

About Environment

State:

numpy array of shape (2,4,4)

state[0] = contains the position of player 0's pieces.
state[1] = contains the position of player 1's pieces.

state[player,x,y] = 1, indicates the presence of king at square (x,y)
state[player,x,y] = 0, indicates an empty square at (x,y)

Action:

List of size 3

action[0] = contains the from square of a move
action[1] = contains the to square of the move
action[2] = if the move was a capture(1) or not(0)

The squares are denoted in the following way:

 0   1  2   3                       
 4   5  6   7                                 
 8   9  10  11                            
 12  13 14  15                        

About

This is a custom made OpenAI gym environment for a boardgame I invented.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages