Skip to content

Jeff-Tian/tic-tac-toe-ai

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
doc
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

English | 简体中文

tic-tac-toe-ai (三子棋版阿尔法狗)

能够学习的三子棋程序。

Build Status Maintainability Test Coverage Git commit with emojis! FOSSA Status

Tic Tac Toe AI - tictactoe, AI, machine learning | Product Hunt Embed

这是我写的第一个 AI 程序。起源于在学习完 react js 的 tic-tac-toe 教程后,我对自己说,为什么不把它升级成一个 AI 版本呢?

截图

在线访问:

https://tictactoe.js.org

谁在玩?

本地运行:

git clone https://github.com/Jeff-Tian/tic-tac-toe-ai.git
npm install -g create-react-app
npm install
npm start

测试:

npm test
npm run coverage

原理:

本程序应用了一般的机器学习方法,如果你对此原理感兴趣,可以查看本文

发布历史

  • 2.0.0

    • 改动:引入新的考量因子:在走子时,确保不让自己的赢面被对手堵住时,不会同时给对手造成机会。
    • 改进:使用 ant-d mobile 布局。
  • 1.0.0

    • 改动:实现了一个比较好的评估函数,能够使机器在处于后走子的劣势下,确保不输棋。但是如果启用学习,那么这个评估函数会变动,有可能被人为诱导进入蜜罐,被连续的胜利冲昏头脑,突然一下子变笨,但是会在输棋之后很快恢复。
    • 可以防御同时设置两个方向上的赢面的对手。
    • 在与随机走子的机器对手下棋时,胜率可达 93%,剩下 7% 为平局,也就是说,随机走子对手无法取胜了。
  • 0.1.0

    • 实现了一个粗糙的评估函数,在输掉前 6 个回合之后变得聪明,但是如果人使用更高级的走法,同时设置两个方向上的赢面时,机器总是会输。
    • 在与随机走子的机器对手下棋的话,胜率可达 84%。

关于我

Jeff Tian 在 Stackoverflow

Jeff Tian 在 Github

贡献指南

  1. Fork 这个项目(https://github.com/Jeff-Tian/tic-tac-toe-ai
  2. 创建你自己的特性分支(git checkout -b feature/fooBar
  3. 提交你的改动(git commit -am '添加了 fooBar 功能'
  4. 推送代码到分支(git push origin feature/fooBar
  5. 提交新的合并请求

打赏

如果你觉得这个项目有有用,欢迎向我打赏。推荐使用支付宝,先领取红包再打赏。

领红包 打赏
支付宝红包码 支付宝收钱码

License

FOSSA Status

Sponsor this project

Packages

No packages published

Languages