Skip to content
/ Chess Public

A simple Chinese Chess game based on Cocos2d-x 3.x and c++ 11, which contains some implement of AI and Network. (一个基于cocos2d-x 3.x和c++ 11的中国象棋小游戏,实现了一些简单的人工智能和网络功能)

Notifications You must be signed in to change notification settings

leemoncn/Chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

一个基于Cocos2d-x 3.8和c++ 11的简单的象棋小游戏。

该游戏主要实现了:

1.象棋游戏的UI界面和象棋对战的规则的逻辑。

    其中包括每一个棋子的步法规则,悔棋,重新开始等。

2.单机版的象棋游戏实现了简单的AI。

    分别实现了简单的暴力搜索法的单步智能和多步智能,及AlphaBeta搜索算法。具体实现为AI类。

3.网络版的象棋游戏实现了简单的socket网络编程。可以实现本机(127.0.0.1)的两个游戏实例的相互连接对战。

    具体实现为NetBattle类,在SceneGame类中调用自定义的网络接口。


注意:
    一、本工程最终的代码为网络版的象棋。如果要恢复单机版的象棋,需要对:

   	 1.棋子的步法进行修改:把SceneGame.cpp中的IS_NET置1;

   	 2.将网络接口调用改为AI接口调用:把SceneGame.cpp中的网络相关函数调用,恢复为ComputerMove()调用。

    二、如果要编译成apk,需要对棋子的Sprite大小进行调整。
    
    三、本游戏没有实现Win/Lose的Layer,仅在console中log出将面临danger的信息。

About

A simple Chinese Chess game based on Cocos2d-x 3.x and c++ 11, which contains some implement of AI and Network. (一个基于cocos2d-x 3.x和c++ 11的中国象棋小游戏,实现了一些简单的人工智能和网络功能)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published