Skip to content

mengistristen/openchess

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

openchess

A simple API for playing games that use an 8x8 checkerboard

Report Bug · Request Feature

Table of Contents

About The Project

openchess is a simple api that takes http requests and returns svg images representing the current state of the game being played.

Built With

Getting Started

openchess is a public REST API. That means no authorization is needed.

There are endless ways to use openchess, we encourage you experiment, just remember to report any issues you come across!

Before you can send commands and recieve svgs you must start a game, do so with a GET request to the following URI:

If successful, you will get a json object with your new game key. This key will be used in all request that involve this game, so make sure to save it. You can start as many games as you like, just keep in mind that latency may be introduced if we recieve too much traffic.

The above request is the most straightforward way to begin a game of chess. But what if you don't want to play chess? Here's how you change the game type.

How To Play

Moving Pieces

Manually Ending A Game

openchess games automatically expire after 1 hour of inactivity. However, if you feel so inclined to remove a game earlier you may do so with a GET request to the following URI:

Customization and Options

Game Type

Despite the name, openchess actually supports playing any game that uses an 8x8 checkerboard (that we've implemented). Here's how you do it:

Here is the list of all supported games:

Game game_id
Chess chess
Checkers/Draughts checkers
Breakthrough breakthrough

We are always looking to add new games to openchess, if you have a suggestion for one please leave it here or better yet, do it yourself by contributing.

Board Options

Size

Board size is changed with the bsize attribute.

curl oc.justinboehnen.com/new?bsize=400

Color

Board color is changed with the blight and bdark attributes, representing the light and dark tones of the board respectively.

curl oc.justinboehnen.com/new?blight=%23ecf0f1&bdark=rgb(66,66,66)

Hex color codes and RGB values are both valid inputs.

  • The hash (#) in hex codes must be encoded as %23.
  • RGB values must be sent in the format rgb(R,G,B)

Frame

Piece Options

Style

Margin

Piece margin (the spacing between pieces) is changed with the pmargin attribute.

curl oc.justinboehnen.com/new?pmargin=10

Coordinates

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Tristen Mengis - LinkedIn - @thetmeng - email

Justin Boehnen - LinkedIn - @boehnenj - email - website

About

Simple API for 8x8 board games

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published