Play chess with Go, HTML5, WebSockets and random strangers!

ChessBuddy

Play chess with Go, HTML5, WebSockets and random strangers!

Hint: Open the page in two different tabs, if there aren't any other visitors around.

Quick Start

ChessBuddy is compatible with Go 1. Use the go tool to install the latest version of ChessBuddy with the following command:

go get github.com/tux21b/ChessBuddy

This will install a new command ChessBuddy in your path (usually $GOPATH/bin/ChessBuddy). Start the HTTP server with the default arguments:

ChessBuddy -http=:8000 -time=5m

Visit http://localhost:8000/, wait for a friend and start playing a game of chess.

You can use go get -u github.com/tux21b/ChessBuddy to update ChessBuddy.

Features

  • web service connects all visitors in pairs and maintains the chess games
  • JavaScript client displays the chess board using the HTML 5 canvas API
  • Time control: 5 minutes (configurable) per side, sudden death
  • move history displays all moves using standard algebraic notation (SAN)

Missing / Planned Features

  • support for underpomotion (currently pawns are always promoted to queens)
  • add some animations to the javascript interface
  • add a couple of AI players (maybe by connecting another engine such as gnuchess or crafty) which can be selected if no other visitors are available
  • starting new games without refreshing the page

License

ChessBuddy is distributed under the Simplified BSD License:

Copyright © 2012 Christoph Hack. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the copyright holder.

Similar Resources

Blunder is an open-source UCI compatible chess engine.

A UCI compatible chess engine written in Golang

Dec 30, 2022

A small go program that solves the Queen's Gambit chess puzzle.

Queen's Gambit Solver This program attempts to solve the Queen's Gambit each time it is run. The Queen's Gambit is a chess-based puzzle where eight qu

Jun 27, 2022

A simple chess engine for experiment, made in Golang

chess-engine A simple chess engine for experiment, made in Golang Build the engine Run the command make or make build Run the engine Run the command f

Dec 26, 2021

chess.com api wrapper for go

Chessdotcom-go An unofficial, simple, lighweight API wrapper for chess.com written in go Usage go get -u "github.com/ATTron/chessdotcom-go" im

Dec 31, 2021

A chess server built with Temporal.

A chess server built with Temporal.

chesstempo A chess server built with Temporal. Dependencies The activity worker runs Stockfish in the background. In Debian-based distros, you can ins

Nov 21, 2022

Awesome 2D Maze-based games to play with kids in family and with friends on rich console UI. developed into Go.

Awesome 2D Maze-based games to play with kids in family and with friends on rich console UI. developed into Go.

gomazes Have fun time with kids and family and friends at playing awesome 2D maze-based games while feeling like a programmer on the computer console/

Dec 23, 2021

Vote, play, and chill.

GoDiscordBot Template GoDiscordBot is a Discord bot template repository that helps you quickly get started builing a Discord bot in go. Get GoDiscordB

Jan 17, 2022

lets play a game

Flashbots is a research and development organization formed to mitigate the negative externalities and existential risks posed by miner-extractable value (MEV) to smart-contract blockchains.

Jul 9, 2021

Golang RISC-V emulator that can play DOOM

Golang RISC-V emulator that can play DOOM

RISC-V Emulator A toy Golang RISC-V emulator that can play DOOM For now it uses smunaut bootloader and riscv_doom from the ICE40 project. But since th

Dec 12, 2022
Comments
  • Project Structure?

    Project Structure?

    Hey, I'm interested in Go, and trying to figure out standard project structure. I noticed that your main.go code includes itself via its github address (see https://github.com/tux21b/ChessBuddy/blob/master/main.go#L13). Is that standard?

    This could just be a question or it could be an actual issue.

  • Black pawns capture forward

    Black pawns capture forward

    Have a look at these steps:

    1. a2-a4 h7-h5
    2. d2-d4 d7-d5
    3. e2-e3 c7-c6
    4. f2-f4 f7-f5
    5. b2-b4 b7-b5
    6. a4xb5 a7-a6
    7. b5xa6 Nb8xa6
    8. h2-h4 Na6-b8
    9. Bf1-b5 c6-c5
    10. c2-c3 d5xd4
    11. c3xd4 c5-c4
    12. f4xf5 h5xh4

    As you can see, the pawns (black an white) can capture other figures that are straight ahead (step 12). But as far as I know, they are only allowed to capture on a diagonal position. The white player is able to capture diagonal as well (11.1), but the black one is not able.

  • Error when running go get

    Error when running go get

    When I run "go get github.com/tux21b/ChessBuddy" I get this error:

    package code.google.com/p/go.net/websocket: unable to detect version control system for code.google.com/ path

  • defeated AI hangs

    defeated AI hangs

    I finally managed to nudge the AI into an inescapable corner, but the AI refused to make its only available move, and after waiting four minutes or so for the timer to run down, nothing happened.

    Screenshot: http://zephyrtronium.us/snapshot1.png 19. Kd2 Ne4# :c

Chesscode - Chesscode: a way of encoding messages using a chess board and the starting set of chess pieces
Chesscode - Chesscode: a way of encoding messages using a chess board and the starting set of chess pieces

chesscode Are you a spy that needs to leave an urgent top secret message for an

Jan 1, 2022
♛♔ Play chess against UCI engines in your terminal.
♛♔ Play chess against UCI engines in your terminal.

uchess ♛♔ Play chess in your terminal. Introduction uchess is an interactive terminal chess client designed to allow gameplay and move analysis in con

Nov 17, 2022
Play chess in your terminal
Play chess in your terminal

Gambit Chess board in your terminal. Warning gambit does not have many features at the moment. I plan on adding a chess engine, mouse support, timers,

Dec 21, 2022
A cli to play chess against an an UCI engine of your choice, written in go
A cli to play chess against an an UCI engine of your choice, written in go

chess-cli chess-cli is a cli for playing chess against an UCI compatible engine written in go Note: Chess pieces are in unicode, so the color may seem

Mar 1, 2022
A cli to play chess against an an UCI engine of your choice, written in go
A cli to play chess against an an UCI engine of your choice, written in go

chess-cli chess-cli is a cli for playing chess against an UCI compatible engine written in go Note: Chess pieces are in unicode, so the color may seem

Dec 24, 2021
Online multiplayer board game server written in Go, using WebSockets.

BfH Server The Battle for Hermannia is a board game created as a gift by the father of hermannm, a developer of this project. This digital edition of

Nov 7, 2022
A chess engine written in golang
A chess engine written in golang

Weasel Art graciously provided by Alex Table of Contents: About Installing and Compiling from Source Contributing License About Weasel is an 0x88 and

Dec 30, 2022
Currently in beta testing. A chess engine written in golang
Currently in beta testing. A chess engine written in golang

Weasel Art graciously provided by Alex Table of Contents: About Installing and Compiling from Source Contributing License About Weasel is an 0x88 and

Dec 30, 2022
chess package for go
chess package for go

chess Introduction chess is a set of go packages which provide common chess utilities such as move generation, turn management, checkmate detection, P

Dec 26, 2022
A chess GUI build using the Fyne toolkit.
A chess GUI build using the Fyne toolkit.

Chess The subject of my current live stream series. A simple chess UI built with Fyne. Thanks to: Chess Go library by Logan Spears github.com/notnil/c

Dec 20, 2022