A simple API for playing games that use an 8x8 checkerboard
Report Bug
·
Request Feature
- About the Project
- Getting Started
- How To Play
- Customization and Options
- Roadmap
- Contributing
- License
- Contact
openchess is a simple api that takes http requests and returns svg images representing the current state of the game being played.
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.
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:
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 size is changed with the bsize
attribute.
curl oc.justinboehnen.com/new?bsize=400
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)
Piece margin (the spacing between pieces) is changed with the pmargin
attribute.
curl oc.justinboehnen.com/new?pmargin=10
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.