Code Monkey home page Code Monkey logo

chinesechess's Introduction

ChineseChess


Introduction


English | 简体中文

macos-badge win-badge ubuntu-badge

The Chinese chess online battle platform (including communication function) developed based on Qt5 realizes the function of chess game in a single or networked state, no matter whether it is single or multiple players, regardless of whether the system is the same.


characteristic

The main functional modules of the project are divided into:

ⅰ Players play against themselves

ⅱ Play against the computer AI

ⅲ Multiplayer network battle (can cross different systems)

ⅳ Battle timing

ⅴ Repent (multiple moves possible)

ⅵ track of chess moves

ⅵ About the work information


Run the demo

Video presentation: ChineseChess QT-based cross-platform online chess game demonstration


Win10 running example:


Linux running example:


MacOS running example:


Examples of cross-platform battles: MacOS 10.14 vs Win10


About the program: 


Update (2022-2024 v6.x)

Features

  • Add regret function, unlimited regret
  • Show move track, current move
  • Restart game, click to restart
  • Code logic optimization, new comments
  • Update chess interface, use ancient chess characters
  • Update about program, add contributor name
  • Linux ARM Raspberry Pi support: apt.raspbian-addons.org, both 32 and 64-bit

Show


Development tutorial


In addition, the source code summary is accompanied by detailed code comments for easy understanding.


Build

  1. Install Qt (Qt >= 5.12.11)and other dependencies

    For Debian and Ubuntu, run:

    $ sudo apt install cmake qtbase5-dev qt5-default libqt5svg5-dev qtmultimedia5-dev qttools5-dev libqt5x11extras5-dev
  2. Run the command::

    $ git clone https://github.com/XMuli/ChineseChess.git
    $ cd ChineseChess
    $ mkdir build && cd build
    $ cmake .. # or qmake
    $ make

Or you can skip the second step and use Qt Creator to compile and run.


Contributor

Thanks for the contributions submitted by the friends 🥳🥳:



XMuli

Bruce-Ch

BlueArvin

Ubuntuser2012

kirayamatoo

hmsjy2017

ryanfortner

zjuyk

If it helps you, or find it useful, you can click on the item's ⭐Star 🍴 Fork  of the two icons, conveniently lift the hand between, said a point of praise the hand, There is a fragrance in your hand;The next best thing is to buy me a cold Coke.


Author

alt text alt text alt text


Tutorial Series

QtExamples Welcome to star ⭐ and fork 🍴 This series of C++ / QT / DTK studies, where you can learn how to write this kind of software yourself, is a complete series of tutorials. And FREE!

chinesechess's People

Contributors

bruce-ch avatar hmsjy2017 avatar kira-yamatoo avatar ryanfortner avatar ubuntuser2012 avatar xmuli avatar zjuyk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chinesechess's Issues

使用包管理器安装 ChineseChess

目前此方法仅支持 Debian/Ubuntu 的 arm/arm64 架构。

  1. 首先安装脚本所需的依赖 curlpython3
sudo apt install -y curl python3
  1. 添加 Raspbian Addons apt 存储库。
python3 <(curl -fSsL https://cdn.jsdelivr.net/gh/raspbian-addons/scripts@master/utils/repo.py)

根据提示选择一个离你最近的镜像站。

  1. 安装 ChineseChess
sudo apt install chinesechess

如果需要卸载,请执行以下命令:

sudo apt remove chinesechess

高分辨率下界面显示问题

高分辨率下的界面显示如下图。建议在>=5.6的qt上开启高dpi适配。

int main(int argc, char *argv[])
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
    //....
}

chooseGUI
ChessBoard

【功能请求】libp2p 联机

libp2p 不协议公网IP 就可以和全世界玩象棋的人联机!

为什么是libp2p
考虑使用 libp2p 作为网络层来创建健壮的 P2P 应用程序有几个原因:

模块化:libp2p 被设计为模块化,允许开发人员混合和匹配不同的组件以满足他们特定应用程序的需要。这使得定制网络堆栈变得容易,以满足任何 P2P 应用程序的特定要求。

广泛的传输可配置性:libp2p 提供了一组可以适应支持各种传输协议的规范,允许 libp2p 应用程序在各种运行时和网络环境中运行,因为丰富的传输协议选择使得在各种场景中使用 libp2p 成为可能。

多功能性:除了支持广泛的传输之外,libp2p 还提供了一系列的发现机制、数据存储和检索模式,并且还以多种编程语言实现,为开发人员在构建 P2P 应用程序时提供了极大的灵活性。

安全性:libp2p 包括几个安全特性,例如使用公钥加密的对等身份验证和使用现代密码算法的对等点之间的加密通信

健壮性:libp2p 是一种健壮可靠的网络协议,旨在承受压力、干扰和变化。它的特性和设计选择确保它能够在广泛的环境中有效和高效地运行,并且能够从中断或故障中快速恢复。它还通过使用缓解技术提供针对网络攻击的保护。

弹性:P2P 网络通常比传统的客户端-服务器网络更具弹性,因为没有单点故障。libp2p 包括对等点发现内容路由等功能,这些功能有助于确保网络保持可用和可访问性,即使某些对等点离线或无法访问也是如此。

效率:P2P 网络可以更有效地利用资源,因为数据分布在多个对等点而不是存储在**服务器上。libp2p 包括各种存储和检索模式,允许开发人员在网络上有效地分发数据,从而可以以经济高效且可扩展的方式存储和检索数据。

穿透 NAT 障碍:libp2p 配备了NAT 遍历功能,即使在 NAT 设备或防火墙后面,也允许对等点之间进行 P2P 通信。这有助于保持网络的连通性,并确保尽管存在这些障碍,网络仍可访问。

消息分发和传播:libp2p 使用的一种模式是发布/订阅 (pubsub),它允许发送者(发布者)向多个接收者(订阅者)发送消息,而发布者不必知道订阅者是谁。libp2p 通过使用像gossipsub这样的协议来实现 pubsub ,为开发人员提供了一种在其 P2P 应用程序中交换数据和消息的灵活有效的方法。

互操作性:不同编程语言中的 libp2p 实现和跨版本的 libp2p 版本旨在相互互操作。这使得来自不同语言生态系统的应用程序能够无缝通信。这有助于促进健康、互联的 P2P 应用生态系统。

去中心化:P2P 网络的主要优势之一是它们的去中心化性质,允许它们在没有**授权的情况下运行。libp2p 旨在促进对等点之间的去中心化通信,从而可以构建 P2P 应用程序以抵抗审查并在面对网络中断时更具弹性。

其他联机协议

devp2p
hyper://
gemini://
Earthstar
Pigeon
Yggdrasil
QUIC 协议

需求

支持和朋友对战嘛?

添加 Linux ARM 构建

chineseChess 不支持 armhf/arm64,有点可惜,树莓派等 arm 设备无法使用,望支持。

对将的情况并没有考虑进去

ChessBoard类的:bool canMoveJIANG(int moveId, int killId, int row, int col)函数需要考虑对将的情况

bool ChessBoard::canMoveJIANG(int moveId, int killId, int row, int col)
{
    //对将的情况
    if (killId != -1 && m_ChessPieces[killId].m_emType == m_ChessPieces->JIANG)
        return canMoveCHE(moveId, killId, row, col );
    //请加上这一段

    if(m_ChessPieces[moveId].m_bRed) //红 将
    {
        if(row < 7 || col < 3 || col > 5)
            return false;
    }
    else  //黑 将
    {
        if(row > 2 || col < 3 || col > 5)
            return false;
    }

    int dr = m_ChessPieces[moveId].m_nRow - row;
    int dc = m_ChessPieces[moveId].m_nCol - col;
    int d = abs(dr)*10 + abs(dc);
   
    if(d== 1 || d == 10)
        return true;

    return false;
}

接受外部PR吗

发现项目里有些影响使用体验的小bug 自己练习的时候顺便改了一些 考虑开个分支接受其他人的pull request吗

AI无效

用Qt6编译后玩家和AI对战模式下, AI不会自动走子, 效果和玩家自己对战一样.

【功能请求】pc象棋AI,自我深度学习

可以加入AI训练吗?
我们可以训练AI
我们需要最新的AI棋谱
https://katagotraining.org/ 这是一个非常成功的AI训练例子,你可以参考看看。虽然它是围棋的,它现在已经拥有2千万张棋谱,还在不断的增长。
象棋很多人还用那些古谱来练习象棋,那些已经过时了,象棋比围棋更有优势,象棋可以马上让人进入深度计算思维。

仙女鳕鱼 象棋AI引擎
https://github.com/ianfab/Fairy-Stockfish

这里有一个象棋的例子,
https://medium.com/applied-data-science/how-to-build-your-own-muzero-in-python-f77d5718061a https://github.com/chengstone/cchess-zero

佳佳象棋 Ai
https://github.com/leedavid/leela-chess-to-Chinese-Chess
http://www.ggzero.cn/
http://www.ttyes.com/

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.