定制 kolibri/chessphp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kolibri/chessphp

Composer 安装命令:

composer require kolibri/chessphp

包简介

Utils for handling pgns in php

README 文档

README

(This repo is still in development)

This is a wrapper around ryanhs/chess.php to provide a more easy interface to get information of a chess game, that was imported via a PGN string.

Installation

composer require kolibri/chessphp

Usage

<?php

use Kolibri\ChessGame;

$emptyGame = new ChessGame(); // Create an empty game (not so useful right now)

$pgnString = <<<EOF
[Event "Simultaneous"]
[Site "Budapest HUN"]
[Date "1934.??.??"]
[EventDate "?"]
[Round "?"]
[Result "1-0"]
[White "Esteban Canal"]
[Black "NN"]
[ECO "B01"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "27"]

1. e4 d5 2. exd5 Qxd5 3. Nc3 Qa5 4. d4 c6 5. Nf3 Bg4 6. Bf4 e6 7. h3 
Bxf3 8. Qxf3 Bb4 9. Be2 Nd7 10. a3 O-O-O 11. axb4 Qxa1+ 12. Kd2 Qxh1 
13. Qxc6+ bxc6 14. Ba6#
EOF;

// Load Game from PGN string
$gameFromPgn = new ChessGame($pgnString); 

echo $gameFromPgn->getPgn(); // get the pgn string
echo $gameFromPgn->getFen(); // get the FEN of the board at the last move
echo $gameFromPgn->getAsciiBoard(); // get an ascii version of the board
echo $gameFromPgn->getWhitePlayerName(); // get the name of the white player
echo $gameFromPgn->getBlackPlayerName(); // get the name of the black player

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固