Giter Site home page Giter Site logo

animalshogiserver's Introduction

どうぶつしょうぎ対局サーバー概要

通信

TCP/IPを用い対局の開始、指し手のやりとり、対局の終了検知を仲介する。

プロトコル

サーバー側のポートは1919とする。

ログインとログアウト

クライアント側は対象アドレスの対象ポートにTCPで繋げばログインされる(Telnetなどでも可)

対局条件と対局の開始

サーバーは以下の形でクライアントに対局条件の通知を行う

BEGIN Game_Summary

Game_ID:20180910-001

Your_Turn:+ (後手番なら-)

END Game_Summary

盤面の表示

初期局面からのスタートとする

対局の合意

対局条件を確認したクライアントはサーバに対して以下のように合意のメッセージを送信する

AGREE

その後、サーバーから以下の通り対局開始のメッセージにより対局が始まる。

START

指し手の送信

駒の表記

h : ひよこ

z : ぞう

k : きりん

棋譜表記

  1   2   3
+---+---+---+
|   |   |   | a
+---+---+---+
|   |   |   | b
+---+---+---+
|   |   |   | c
+---+---+---+
|   |   |   | d
+---+---+---+

手番側のクライアントは自身の指し手を以下のようにサーバーに送る

+2c2b (後手番なら -2b2c など)

サーバーはこの手が合法なら両クライアントに

+2c2b,OKと送る。 駒打ちの場合は、h*2bなど 投了など対局が終了、中断した場合は'#'で始まる文字列を2行続けて送信し、何らかの事象の発生を通知する。 事象発生後、双方のクライアントはログアウトする。

対局終了

Ex. 引き分けで対局終了の場合

#GAME_OVER

#DRAW

Ex. 勝った時

#GAME_OVER

#WIN

Ex. 負けた時

#GAME_OVER

#LOSE

Ex. 反則手で負けた時

#ILLEGAL_MOVE

#LOSE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.