{"id":15372189,"url":"https://github.com/selflocking/dotsandboxes","last_synced_at":"2025-09-04T09:40:56.038Z","repository":{"id":217667444,"uuid":"561737892","full_name":"Selflocking/DotsAndBoxes","owner":"Selflocking","description":"a dots and boxes game, build with SFML.","archived":false,"fork":false,"pushed_at":"2022-11-04T11:34:28.000Z","size":20645,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T16:01:06.730Z","etag":null,"topics":["dots-and-boxes","sfml","sfml-game"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Selflocking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-04T11:31:28.000Z","updated_at":"2024-03-25T09:02:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"adde3e71-8584-4e55-8607-ac5ae42da7c0","html_url":"https://github.com/Selflocking/DotsAndBoxes","commit_stats":{"total_commits":57,"total_committers":6,"mean_commits":9.5,"dds":"0.17543859649122806","last_synced_commit":"0dcc772f7ea344f2275320e2e4cc766d559b5b86"},"previous_names":["selflocking/dotsandboxes"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Selflocking%2FDotsAndBoxes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Selflocking%2FDotsAndBoxes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Selflocking%2FDotsAndBoxes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Selflocking%2FDotsAndBoxes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Selflocking","download_url":"https://codeload.github.com/Selflocking/DotsAndBoxes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240404758,"owners_count":19796064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dots-and-boxes","sfml","sfml-game"],"created_at":"2024-10-01T13:49:44.526Z","updated_at":"2025-02-24T02:14:59.722Z","avatar_url":"https://github.com/Selflocking.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Heap Overflow DotsAndBoxes\n\n## 使用方法\n首先确保你的MinGW使用MSVCRT，gcc版本最好为11.2。如果不确定，请使用这个[MinGW-w64](https://ysod.azurewebsites.net/%E5%BC%80%E5%8F%91/MinGW/winlibs-x86_64-posix-seh-gcc-11.2.0-mingw-w64msvcrt-10.0.0-r1.zip)或从群文件下载\n\n使用方法: \n1. 将MinGW解压到某个地方，进入`/bin`目录，复制路径。\n2. 打开设置，进入系统-系统信息-高级系统设置，选择环境变量，在打开的窗口中双击用户变量里的`Path`,点击新建，把复制的路径粘贴进去，并把它上移到顶部。\n3. `win`+`r`输入`cmd`打开命令行，输入`gcc -v`，如果输出的信息中`COLLECT_LTO_WRAPPER=`大致为你复制的路径即为成功。\n### 不使用CMake\n#### VS Code\n1. git clone https://gitee.com/YunShu007/dots-and-boxes.git\n2. 进入项目目录，新建`build`文件夹，将`3rdparty/SFML/bin`文件夹中的`dll`文件复制到刚刚新建的`build`文件夹中, 将`res`目录复制进`build`目录中\n3. 使用VS Code打开项目，请保证VSCode仅打开项目文件夹，而不是打开项目文件夹的父文件夹\n4. 新建`.vscode`文件夹,在`.vscode`里新建文件`tasks.json`和`launch.json`.\n\ntasks.json:\n```json\n{\n    \"version\": \"2.0.0\",\n    \"tasks\": [\n        {\n            \"label\": \"build\",\n            \"type\": \"shell\",\n            \"command\": \"g++ src/*.cpp src/AI/*.cpp -o build/game.exe -I ./3rdparty/SFML/include -L./3rdparty/SFML/lib -lsfml-graphics -lsfml-window -lsfml-system\"\n        }\n    ]\n}\n```\n如果你使用的是官方C++插件，launch.json:\n```json\n{\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"name\": \"(gdb) 启动\",\n      \"type\": \"cppdbg\",\n      \"request\": \"launch\",\n      \"program\": \"${workspaceFolder}\\\\build\\\\game.exe\",\n      \"cwd\": \"${workspaceFolder}\\\\build\",\n      \"externalConsole\": false,\n      \"MIMode\": \"gdb\",\n      \"miDebuggerPath\": \"gdb.exe\",\n      \"preLaunchTask\": \"build\"\n    }\n  ]\n}\n```\n#### 命令行编译\n1. git clone https://gitee.com/YunShu007/dots-and-boxes.git\n2. 进入项目目录，新建`build`文件夹，将`3rdparty/SFML/bin`文件夹中的`dll`文件复制到刚刚新建的`build`文件夹中，将`res`目录复制进`build`目录中\n3. 回到项目目录，打开命令行执行\n```bash\ng++ src/*.cpp src/AI/*.cpp src/element/*.cpp src/CJSON/*.cpp src/CJSON/*.h src/CJSON/*.c -o build/game.exe -I ./3rdparty/SFML/include -L./3rdparty/SFML/lib -lsfml-graphics -lsfml-window -lsfml-system\n```\n\n4. 进入`build`文件夹，即可看到`game.exe`, 执行即可。\n### 使用CMake (推荐)\n首先安装[CMake](https://github.com/Kitware/CMake/releases/download/v3.24.0-rc4/cmake-3.24.0-rc4-windows-x86_64.msi)\n#### VS Code\n1. git clone https://gitee.com/YunShu007/dots-and-boxes.git\n2. 安装[CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools)插件\n3. 重启VS Code\n4. 重新打开会让你选择工具,选择`GCC 11.2.0 X86_64-w64-mingw32-make`\n5. 如果上一步不小心选错，按`Ctrl`+`Shift`+`P`打开指令栏，输入kit,点击`CMake: 选择工具包`重新选择\n6. 成功后点击VS Code下方状态栏上的运行按钮即可运行，如需调试请安装官方插件[C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)\n\ntasks.json:\n```json\n{\n\t\"version\": \"2.0.0\",\n\t\"tasks\": [\n\t\t{\n\t\t\t\"type\": \"cmake\",\n\t\t\t\"label\": \"CMake: build\",\n\t\t\t\"command\": \"build\",\n\t\t\t\"targets\": [\n\t\t\t\t\"dots_and_boxes\"\n\t\t\t],\n\t\t\t\"group\": {\n\t\t\t\t\"kind\": \"build\",\n\t\t\t\t\"isDefault\": true\n\t\t\t},\n\t\t\t\"problemMatcher\": [],\n\t\t\t\"detail\": \"CMake template build task\"\n\t\t}\n\t]\n}\n```\n\nlaunch.json:\n```json\n{\n    // 使用 IntelliSense 了解相关属性。 \n    // 悬停以查看现有属性的描述。\n    // 欲了解更多信息，请访问: https://go.microsoft.com/fwlink/?linkid=830387\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"(gdb) 启动\",\n            \"type\": \"cppdbg\",\n            \"request\": \"launch\",\n            \"program\": \"${workspaceFolder}/build/dots_and_boxes.exe\",\n            \"args\": [],\n            \"stopAtEntry\": false,\n            \"cwd\": \"${workspaceFolder}/build/\",\n            \"environment\": [],\n            \"externalConsole\": false,\n            \"MIMode\": \"gdb\",\n            \"setupCommands\": [\n                {\n                    \"description\": \"为 gdb 启用整齐打印\",\n                    \"text\": \"-enable-pretty-printing\",\n                    \"ignoreFailures\": true\n                },\n                {\n                    \"description\":  \"将反汇编风格设置为 Intel\",\n                    \"text\": \"-gdb-set disassembly-flavor intel\",\n                    \"ignoreFailures\": true\n                }\n            ],\n            \"preLaunchTask\": \"CMake: build\"\n        },\n    ]\n}\n```\n\n#### Clion\n1. 打开Clion，选择从VCS导入，输入https://gitee.com/YunShu007/dots-and-boxes.git\n2. 等待加载，完成后会弹出配置cmake的窗口，直接点确定即可。\n\n\u003e Clion自带Cmake和符合要求的MinGW,所以可以开箱即用\n## 开发指南\n### AI设计\n入口函数为`void UCT(Board *board, int player)`,在此函数中更改AI逻辑\n\n### 棋盘\n棋盘是11x11大小,有点(DOT),横线(HENG),竖线(SHU),被占据的线(OCCLINE),格子(BOX),先手黑方格子(BLACK_BOX),后手白方格子(WHITE_BOX).\n\n棋盘使用二位数组int8_t map[11][11]储存，横纵坐标皆为偶数时点，皆为奇数时格子，横偶竖奇是横线，横奇竖偶是竖线。\n\n判定一个坐标是否为未被占据的线可以使用if(map[i][j]!=OCCLINE)或者if(map[i][j]==HENG||map[i][j]==SHU)\n\n判定一个格子是否被占可以使用if(map[i][j]==BOX)\n\n\n### 坐标\n坐标LOC定义为`std::pair\u003cint,int\u003e`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselflocking%2Fdotsandboxes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselflocking%2Fdotsandboxes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselflocking%2Fdotsandboxes/lists"}