jGames – display various games using jQuery

jGames is a collection of functions written in jQuery to display static states of various class board games, including Checkers, Chess, Go, XiangQi, Shogi, Othello, Tic Tac Toe, Cards, and Dice.

It also supports display of a series of states (i.e. an animation). This is useful when you want to show a series of moves for demonstration purposes. The time between transitions is also configurable.

As this is the first release be wary of any bugs and also keep in mind that I will be updating it continuously.
jGame links
1. jChess
2. jCheckers
3. jGo
4. jXiangQi
5. jShogi
6. jOthello
7. jTicTacToe

Below is a simple demo of some of the games supported.

Clone from GitHub!

Usage
First include the following lines to your webpage

1
2
    <script type="text/javascript" src="js/jgames/jquery.jgames.js"></script>
    <link href="js/jgames/css/style.css" rel="stylesheet" type="text/css" />

Create an empty div tag and give it an ID, i.e. “chess”. This is where the chess board will be rendered to.

1
<div id="chess"></div>

Next, create the state of the chess board using Javascript. Depending on the game you want to display will depend on the exact configuration. More documentation can be found on each of the modules pages (Coming Soon). For Demo purposes, we are going to create the static Chess board that was displayed above

1
2
3
4
5
6
7
8
9
10
        var board_chess = [
            ["br", "bn", "bb", "bk", "bq", "bb", "bn", "br"],
            ["bp", "bp", "bp", "bp", "bp", "bp", "bp", "bp"],
            [" ", " ", " ", " ", " ", " ", " ", " "],
            [" ", " ", " ", " ", " ", " ", " ", " "],
            [" ", " ", " ", " ", " ", " ", " ", " "],
            [" ", " ", " ", " ", " ", " ", " ", " "],
            ["wp", "wp", "wp", "wp", "wp", "wp", "wp", "wp"],
            ["wr", "wn", "wb", "wk", "wq", "wb", "wn", "wr"]];
       $("#chess").chess(board_chess);

That’s it!

You can leave a response, or trackback from your own site.

6 Responses to “jGames – display various games using jQuery”

  1. [...] is one module within the jGames suite used to display Chess game states, as well as animations. jGames can be downloaded from the [...]

  2. [...] is one module within the jGames suite used to display Go game states, as well as animations. jGames can be downloaded from the [...]

  3. [...] is one module within the jGames suite used to display Chess game states, as well as animations. jGames can be downloaded from the [...]

  4. [...] is one module within the jGames suite used to display Shogi game states, as well as animations. jGames can be downloaded from the [...]

  5. [...] is one module within the jGames suite used to display Othello game states, as well as animations. jGames can be downloaded from the [...]

  6. [...] is one module within the jGames suite used to display Tic Tac Toe game states, as well as animations. jGames can be downloaded from [...]

Leave a Reply

Powered by WordPress | Designed by: WordPress Themes | Thanks to best wordpress themes, Find WordPress Themes and Themes Directory