All Projects → bupticybee → elephantfish

bupticybee / elephantfish

Licence: other
elephantfish: 一个只有124行的中国象棋引擎

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to elephantfish

stockfish-chess-web-gui
Responsive chess web GUI to play against the Stockfish 10 chess engine. Multiple web GUI implementations have also been included.
Stars: ✭ 21 (-83.72%)
Mutual labels:  chess-engine, chess
uci
A thin wrapper on a uci chess engine
Stars: ✭ 33 (-74.42%)
Mutual labels:  chess-engine, chess
liground
A free, open-source and modern Chess Variant Analysis GUI for the 21st century
Stars: ✭ 41 (-68.22%)
Mutual labels:  chess-engine, chess
Realtime-OpenCV-Chess
♔ Chess-playing with Open-CV [Human vs AI (Stockfish engine)]
Stars: ✭ 18 (-86.05%)
Mutual labels:  chess-engine, chess
ConvChess
Convolutional Neural Networks learns to play chess moves
Stars: ✭ 14 (-89.15%)
Mutual labels:  chess-engine, chess
magic-bits
A C++ header-only library for efficient move generation in Chess using "magic bitboards" technique
Stars: ✭ 26 (-79.84%)
Mutual labels:  chess-engine, chess
zahak
A UCI compatible chess AI in Go
Stars: ✭ 20 (-84.5%)
Mutual labels:  chess-engine, chess
MyChess
中国象棋pygame
Stars: ✭ 30 (-76.74%)
Mutual labels:  chess, chinese-chess
Sunfish
Sunfish: a Python Chess Engine in 111 lines of code
Stars: ✭ 2,254 (+1647.29%)
Mutual labels:  chess-engine, chess
Walleye
A chess engine written from scratch in Rust ♞
Stars: ✭ 82 (-36.43%)
Mutual labels:  chess-engine, chess
renpy-chess
A chess GUI built with Ren'Py, python-chess, and Stockfish. Version 2.0 of https://github.com/RuolinZheng08/renpy-chess-engine
Stars: ✭ 36 (-72.09%)
Mutual labels:  chess-engine, chess
fastchess
Predicts the best chess move with 27.5% accuracy by a single matrix multiplication
Stars: ✭ 75 (-41.86%)
Mutual labels:  chess-engine, chess
OpenChess
A cross-platform chess game.
Stars: ✭ 18 (-86.05%)
Mutual labels:  chess-engine, chess
littlewing
Chess engine written in Rust ♛
Stars: ✭ 27 (-79.07%)
Mutual labels:  chess-engine, chess
rustic
Rustic is a chess engine. It is written from scratch, in the Rust programming language.
Stars: ✭ 68 (-47.29%)
Mutual labels:  chess-engine, chess
bot-o-tron
Try out lichess' bot interface
Stars: ✭ 36 (-72.09%)
Mutual labels:  chess-engine, chess
Bit-Genie
UCI chess engine in C++
Stars: ✭ 19 (-85.27%)
Mutual labels:  chess-engine, chess
Zerofish
An implementation of the AlphaZero algorithm for chess
Stars: ✭ 34 (-73.64%)
Mutual labels:  chess-engine, chess
Demolito
UCI Chess Engine
Stars: ✭ 41 (-68.22%)
Mutual labels:  chess-engine, chess
chess graph
A program that will produce a graphical sunburst chart of chess openings from the PGN that is provided to it
Stars: ✭ 35 (-72.87%)
Mutual labels:  chess

Elephantfish

介绍

elephantfish 是受到 sunfish 启发而撰写的纯python的中国象棋引擎, 整个象棋引擎核心代码只有124行(见compressed.py),棋力方面我仅进行过其与象棋小巫师傻瓜难度的一场对局,在我测试的对剧中,elephantfish赢得了比赛。

在几天前看到了sunfish这个项目(是一个国际象棋引擎,只有111行),觉得很有意思,于是做了一个类似中国象棋版本,中国象棋和国际象棋略有不同,我仅仅单独完成了棋规部分,子力价值表直接的参考了 象眼 ,mtd search部分的代码由于原版sunfish写的非常通用,我也就一行未改。

如果你对于程序中的mtd search看不懂建议先看一些对弈基础理论,比如articles下的几篇文章,如对弈程序基本技术,其官方网址:https://www.xqbase.com/computer/outline.htm

elephantfish默认会进行5秒钟的思考,当然实际一般会比5秒多一些,如果你想要它进行更长时间搜索以获得更好的性能可以对源码相应位置进行更改。

如同sunfish一样,我认为elephantfish会是一个很好的平台,由于其代码非常少,可以很方便的进行各种实验,希望各位感兴趣的同学可以尝试对其进行优化. 如果在优化后想要评估和目前版本的棋力差别,可以使用test.py中的self_arena来将你的代码和elephantfish进行对弈。

运行截图

Think depth: 6 My move: b9c7

  9 俥.象士将士象傌俥
  8 .........
  7 .砲傌....砲.
  6 卒.卒.卒.卒.卒
  5 .........
  4 .........
  3 兵.兵.兵.兵.兵
  2 .炮..炮....
  1 .........
  0 车马相仕帅仕相马车
    abcdefghi
    
Your move:

运行elephantfish!

elephahtfish 自包含在 elephantfish.py 文件中,只是用了python的自带操作而没有使用任何第三方库. 建议使用 pypy 或者 pypy3 来获得更好的性能表现.

简单的使用命令python elephantfish.py 或者pypy elephantfish.py 就可以运行象棋程序,程序会利用自带一个命令行工具进行对局.

特性

  1. 使用简单而高效的 MTD 二分搜索算法(见对弈程序基本技术).
  2. 使用众所周知的现代象棋引擎trick 比如空着裁剪.
  3. 通过简单的子力价值表进行局面评估.
  4. 使用python标准数据结构.

License

GNU GPL v3

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].