# connect_four **Repository Path**: firfe/connect_four ## Basic Information - **Project Name**: connect_four - **Description**: 双人在线立体四子棋 原项目 https://github.com/kenrick95/c4 - **Primary Language**: TypeScript - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-14 - **Last Updated**: 2025-09-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # c4 ![Test](https://github.com/kenrick95/c4/workflows/Test/badge.svg) ![Deploy](https://github.com/kenrick95/c4/workflows/Deploy/badge.svg) **c4**, stands for **Connect Four**, is a browser game written in TypeScript and utilizes HTML's `canvas`. Player is playing against an AI that uses Minimax algorithm and alpha-beta pruning. The evaluation function is hard-coded, and hence the AI may not be moving using the most optimal move. **c4**,全称为 **Connect Four**,是一款用 TypeScript 编写的浏览器游戏,使用了 HTML 的 `canvas` 元素。玩家将与一个采用 Minimax 算法和 alpha-beta 剪枝技术的 AI 对战。评估函数是硬编码实现的,因此 AI 可能不会总是选择最优的落子位置。 ## 汉化&修改 当前汉化版本: 首先感谢原作者的开源。[原项目地址](https://github.com/kenrick95/c4) 具体汉化了那些内容,请参考 `翻译说明.md`。 只做了汉化和简单修改,有问题,请到原作者仓库处反馈。 欢迎关注我B站账号 [秦曱凧](https://space.bilibili.com/17547201) 有需要帮忙部署这个项目的朋友,一杯奶茶,即可程远程帮你部署,需要可联系。 微信号 `E-0_0-` 闲鱼搜索用户 `明月人间` 或者邮箱 `firfe163@163.com` 如果这个项目有帮到你。欢迎start。 有其他的项目的汉化需求,欢迎提issue。或其他方式联系通知。 ### 镜像 从阿里云或华为云镜像仓库拉取镜像,注意填写镜像标签,镜像仓库中没有`latest`标签 容器内部端口`5125`,可通过设置环境变量`PORT`的值来指定监听端口。 ```bash swr.cn-north-4.myhuaweicloud.com/firfe/connect_four:2025.06.29 ``` ### docker run 命令部署 ```bash docker run -d \ --name connect_four \ --network bridge \ --restart always \ --log-opt max-size=1m \ --log-opt max-file=1 \ -p 5125:5125 \ swr.cn-north-4.myhuaweicloud.com/firfe/connect_four:2025.06.29 ``` ### compose 文件部署 👍推荐 ```yaml #version: '3' services: connect_four: container_name: connect_four image: swr.cn-north-4.myhuaweicloud.com/firfe/connect_four:2025.06.29 network_mode: bridge restart: always logging: options: max-size: 1m max-file: '1' ports: - 5125:5125 ``` ### 修改说明 这里对除了汉化之外的代码修改的说明。 增加修改部分具体见 [修改说明](./修改说明.md)。 `./README.md` 文件翻译,增加 `## 汉化&修改` 增加目录 `./图片` 新增文件 `./.dockerignore`、`./Dockerfile`、`./本地调试命令记录.md`、`翻译说明.md`、`修改说明.md` ### 效果截图 | ![玩法](图片/玩法.png) | ![对局](图片/对局.png) | |-|-| ## Play - [kenrick95.github.io/c4](https://kenrick95.github.io/c4/) ## Gameplay ![Screenshot 2024-03-07 202120](https://github.com/kenrick95/c4/assets/3090380/6cc9e901-83d8-4daf-b535-8cab72a56a4e) ### Objective _Connect four_ of your game pieces vertically, horizontally, or diagonally before the other player do so. ### How to move? At each turn, player will drop a game piece in one of the seven columns by clicking on the chosen column. ### More info Read [Wikipedia page on Connect Four](https://en.wikipedia.org/wiki/Connect_Four) ## Browser compatibility Should be good in latest Firefox, Edge, Chrome, and Safari. ## Contributing Contributions are welcome! I'm happy to accept any kind of contributions, pull requests, or bug reports. ### Developing 1. Fork and clone this repository 2. Install dependencies ``` yarn install ``` 3. Start local development server ``` yarn start ``` 4. Make your changes at either `browser/`, `core/`, or `server/` 5. Test it out at http://localhost:5173/ 6. After you are happy with your changes, please submit your Pull Request! ## License This work is licensed under MIT License.