├── AL五子棋 ├── AL五子棋.sln ├── AL五子棋.vcxproj ├── AL五子棋.vcxproj.filters ├── AL五子棋.vcxproj.user ├── Chess.cpp ├── Chess.h ├── Class.h ├── Release │ ├── AI五子棋.exe │ ├── AI五子棋.exe.recipe │ ├── AI五子棋.iobj │ ├── AI五子棋.ipdb │ ├── AI五子棋.pdb │ ├── AI五子棋.tlog │ │ ├── AI五子棋.lastbuildstate │ │ ├── AI五子棋.write.1u.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ └── link.write.1.tlog │ ├── AL五子棋.exe.recipe │ ├── AL五子棋.iobj │ ├── AL五子棋.ipdb │ ├── AL五子棋.log │ ├── AL五子棋.pdb │ ├── AL五子棋.tlog │ │ ├── AL五子棋.lastbuildstate │ │ ├── AL五子棋.write.1u.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ └── link.write.1.tlog │ ├── AL五子棋.vcxproj.FileListAbsolute.txt │ ├── Chess.obj │ ├── Show.obj │ ├── Users.obj │ ├── defet.mp3 │ ├── setChs.wav │ ├── users.dat │ ├── vc142.pdb │ ├── win.wav │ └── 源.obj ├── Show.cpp ├── Show.h ├── Users.cpp ├── Users.h ├── defet.mp3 ├── setChs.wav ├── users.dat ├── win.wav ├── x64 │ └── Debug │ │ ├── AI五子棋.exe │ │ ├── AI五子棋.exe.recipe │ │ ├── AI五子棋.ilk │ │ ├── AI五子棋.pdb │ │ ├── AI五子棋.tlog │ │ ├── AI五子棋.lastbuildstate │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ └── link.write.1.tlog │ │ ├── AL五子棋.log │ │ ├── AL五子棋.vcxproj.FileListAbsolute.txt │ │ ├── Chess.obj │ │ ├── Show.obj │ │ ├── Users.obj │ │ ├── vc142.idb │ │ ├── vc142.pdb │ │ └── 源.obj ├── 源.cpp └── 源.exe └── README.md /AL五子棋/AL五子棋.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31005.135 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AL五子棋", "AL五子棋.vcxproj", "{45B0B08E-B795-48CA-9CF3-F08B55D6BD58}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {45B0B08E-B795-48CA-9CF3-F08B55D6BD58}.Debug|x64.ActiveCfg = Debug|x64 17 | {45B0B08E-B795-48CA-9CF3-F08B55D6BD58}.Debug|x64.Build.0 = Debug|x64 18 | {45B0B08E-B795-48CA-9CF3-F08B55D6BD58}.Debug|x86.ActiveCfg = Debug|Win32 19 | {45B0B08E-B795-48CA-9CF3-F08B55D6BD58}.Debug|x86.Build.0 = Debug|Win32 20 | {45B0B08E-B795-48CA-9CF3-F08B55D6BD58}.Release|x64.ActiveCfg = Release|x64 21 | {45B0B08E-B795-48CA-9CF3-F08B55D6BD58}.Release|x64.Build.0 = Release|x64 22 | {45B0B08E-B795-48CA-9CF3-F08B55D6BD58}.Release|x86.ActiveCfg = Release|Win32 23 | {45B0B08E-B795-48CA-9CF3-F08B55D6BD58}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {19317EBA-C896-401A-BC4B-F0650BFDCC20} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /AL五子棋/AL五子棋.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {45b0b08e-b795-48ca-9cf3-f08b55d6bd58} 25 | AL五子棋 26 | 10.0 27 | AI五子棋 28 | 29 | 30 | 31 | Application 32 | true 33 | v142 34 | Unicode 35 | 36 | 37 | Application 38 | false 39 | v142 40 | true 41 | Unicode 42 | 43 | 44 | Application 45 | true 46 | v142 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v142 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | true 76 | 77 | 78 | false 79 | 80 | 81 | true 82 | 83 | 84 | false 85 | 86 | 87 | 88 | Level3 89 | true 90 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 91 | true 92 | 93 | 94 | Console 95 | true 96 | 97 | 98 | 99 | 100 | Level3 101 | true 102 | true 103 | true 104 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 105 | true 106 | MultiThreaded 107 | 108 | 109 | Console 110 | true 111 | true 112 | true 113 | 114 | 115 | 116 | 117 | Level3 118 | true 119 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 120 | true 121 | 122 | 123 | Console 124 | true 125 | 126 | 127 | 128 | 129 | Level3 130 | true 131 | true 132 | true 133 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 134 | true 135 | 136 | 137 | Console 138 | true 139 | true 140 | true 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /AL五子棋/AL五子棋.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 32 | 33 | 头文件 34 | 35 | 36 | 头文件 37 | 38 | 39 | 头文件 40 | 41 | 42 | 头文件 43 | 44 | 45 | -------------------------------------------------------------------------------- /AL五子棋/AL五子棋.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /AL五子棋/Chess.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Chess.cpp -------------------------------------------------------------------------------- /AL五子棋/Chess.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Chess.h -------------------------------------------------------------------------------- /AL五子棋/Class.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef CLASS_H 3 | #define CLASS_H 4 | #include 5 | #include 6 | #include 7 | class Show; 8 | class Chess; 9 | class MyChess; 10 | class AiChess; 11 | class Users; 12 | #endif // ! CLASS_H 13 | 14 | -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.exe -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | E:\project\AL五子棋\Release\AI五子棋.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.iobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.iobj -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.ipdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.ipdb -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.pdb -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.tlog/AI五子棋.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.18362.0: 2 | Release|Win32|E:\project\AL五子棋\| 3 | -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.tlog/AI五子棋.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.tlog/AI五子棋.write.1u.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AI五子棋.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AI五子棋.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | E:\project\AL五子棋\Release\AL五子棋.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.iobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.iobj -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.ipdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.ipdb -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.log: -------------------------------------------------------------------------------- 1 | C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(491,5): warning MSB8028: 中间目录(Release\)包含从另一个项目(AL五子棋.vcxproj)共享的文件。 这会导致错误的清除和重新生成行为。 2 | Chess.cpp 3 | 正在生成代码 4 | 1 of 621 functions ( 0.2%) were compiled, the rest were copied from previous compilation. 5 | 0 functions were new in current compilation 6 | 1 functions had inline decision re-evaluated but remain unchanged 7 | 已完成代码的生成 8 | AL五子棋.vcxproj -> E:\project\AL五子棋\Release\AI五子棋.exe 9 | -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.pdb -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.tlog/AL五子棋.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.18362.0: 2 | Release|Win32|E:\project\AL五子棋\| 3 | -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.tlog/AL五子棋.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.tlog/AL五子棋.write.1u.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/AL五子棋.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /AL五子棋/Release/AL五子棋.vcxproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | E:\project\AL五子棋\Release\AI五子棋.exe 2 | -------------------------------------------------------------------------------- /AL五子棋/Release/Chess.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/Chess.obj -------------------------------------------------------------------------------- /AL五子棋/Release/Show.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/Show.obj -------------------------------------------------------------------------------- /AL五子棋/Release/Users.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/Users.obj -------------------------------------------------------------------------------- /AL五子棋/Release/defet.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/defet.mp3 -------------------------------------------------------------------------------- /AL五子棋/Release/setChs.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/setChs.wav -------------------------------------------------------------------------------- /AL五子棋/Release/users.dat: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /AL五子棋/Release/vc142.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/vc142.pdb -------------------------------------------------------------------------------- /AL五子棋/Release/win.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/win.wav -------------------------------------------------------------------------------- /AL五子棋/Release/源.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Release/源.obj -------------------------------------------------------------------------------- /AL五子棋/Show.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Show.cpp -------------------------------------------------------------------------------- /AL五子棋/Show.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Show.h -------------------------------------------------------------------------------- /AL五子棋/Users.cpp: -------------------------------------------------------------------------------- 1 | #include "Users.h" 2 | using namespace std; 3 | void Users::Read(void) 4 | { 5 | ifstream in("users.dat", ios::binary | ios::in); 6 | if (!in.is_open()) return; 7 | in.read((char*)&wincnt, sizeof(int)); 8 | in.read((char*)&failcnt, sizeof(int)); 9 | in.read((char*)&drawcnt, sizeof(int)); 10 | in.read((char*)&minsteps, sizeof(int)); 11 | in.read((char*)&restcnt, sizeof(int)); 12 | in.close(); 13 | } 14 | 15 | void Users::Write(void) 16 | { 17 | ofstream out("users.dat", ios::binary); 18 | if (!out.is_open()) exit(0); 19 | out.write((char*)&wincnt, sizeof(int)); 20 | out.write((char*)&failcnt, sizeof(int)); 21 | out.write((char*)&drawcnt, sizeof(int)); 22 | out.write((char*)&minsteps, sizeof(int)); 23 | out.write((char*)&restcnt, sizeof(int)); 24 | out.close(); 25 | } 26 | -------------------------------------------------------------------------------- /AL五子棋/Users.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/Users.h -------------------------------------------------------------------------------- /AL五子棋/defet.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/defet.mp3 -------------------------------------------------------------------------------- /AL五子棋/setChs.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/setChs.wav -------------------------------------------------------------------------------- /AL五子棋/users.dat: -------------------------------------------------------------------------------- 1 | = -------------------------------------------------------------------------------- /AL五子棋/win.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/win.wav -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.exe -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.exe.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | E:\GithubRepositories\Gobang\AL五子棋\x64\Debug\AI五子棋.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.ilk -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.pdb -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.tlog/AI五子棋.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30037:VCServicingVersionATL=14.29.30038:VCServicingVersionCrtHeaders=14.29.30038:VCServicingVersionCompilers=14.29.30038:TargetPlatformVersion=10.0.18362.0: 2 | Debug|x64|E:\GithubRepositories\Gobang\AL五子棋\| 3 | -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AI五子棋.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/AI五子棋.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AL五子棋.log: -------------------------------------------------------------------------------- 1 |  源.cpp 2 | E:\GithubRepositories\Gobang\AL五子棋\源.cpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 3 | AL五子棋.vcxproj -> E:\GithubRepositories\Gobang\AL五子棋\x64\Debug\AI五子棋.exe 4 | -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/AL五子棋.vcxproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | E:\GithubRepositories\Gobang\AL五子棋\x64\Debug\AI五子棋.exe 2 | -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/Chess.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/Chess.obj -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/Show.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/Show.obj -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/Users.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/Users.obj -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/vc142.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/vc142.idb -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/vc142.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/vc142.pdb -------------------------------------------------------------------------------- /AL五子棋/x64/Debug/源.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/x64/Debug/源.obj -------------------------------------------------------------------------------- /AL五子棋/源.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "Show.h" 7 | #include "Chess.h" 8 | #include "Users.h" 9 | #pragma comment(lib,"Winmm.lib") 10 | using namespace std; 11 | constexpr int Width = 800; 12 | constexpr int High = 640; 13 | vector> map(18, vector(18, -1)), cop(map); //map是棋盘,-1空,0电脑,1友方 14 | stack> stk; //用以控制悔棋 15 | double myPos = 0, aiPos = 0; //我方和电脑棋局得分 16 | int aiset; //记录电脑上一步下的位置 17 | 18 | int main() { 19 | MyChess mychs; 20 | Show s; 21 | AiChess ai; 22 | Users user; 23 | std::mutex mt; 24 | user.Read(); 25 | Start: 26 | map = cop; 27 | mychs.steps = 0; 28 | initgraph(Width, High); 29 | while (1) { 30 | ai.Get_key_Setchess(mychs); //Al first set chess 31 | s.show(mychs, user); //show the map 32 | if (ai.gameOver(s, user)) goto Start; 33 | mychs.now = true; // now is you 34 | s.Mouse(mychs, user); // you secondly set the chess,set now = false 35 | s.show(mychs, user); 36 | if (mychs.gameOver(s, user)) goto Start; 37 | } 38 | } -------------------------------------------------------------------------------- /AL五子棋/源.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happysnaker/Gobang/ec07e7f9eb73e70fe3f55857b556a92eafbd1c34/AL五子棋/源.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # C-project-practice---intelligent-man-machine-gobang-fight 2 | C++新手项目实践 — 智能人机五子棋对战(利用Easyx的基础函数) 3 | ## 项目说明 4 | **项目开发环境为 Windows10,Vs2019** 5 | 6 | **该项目使用语言为c++,利用了easyx辅助画图,并未涉及easyx的高级使用,稍加学习即可掌握,项目涉及三大类,分别是 :** 7 | 8 | **1.Class Show。这个类包含了绘图的主要函数,以及鼠标调用的函数。** 9 | 10 | **2.Class Users。这个类包含了用户的基本信息,以及二进制读写文件函数。** 11 | 12 | **3.Class Chess。这个类是个抽象类,包含了获取该位置得分以及判定胜负等函数。这个类派生了AiChess和MyChess两个子类,顾名思义,分别是与人机棋局和我方棋局的评定有关。** 13 | 14 | 项目根据胜负场和胜率设定了段位,根据当前棋局得分进行评估,并利用辅助栈实现了悔棋功能,初始时有十步悔棋步数,每赢一局加十步,增加了项目的创意。电脑下棋是随机遍历棋局的,意味着电脑并不是一成不变的,避免了同一套路无限用的可能。 15 | 16 | 下面我将讲解核心的算法。 17 | 18 | ## 体验 19 | Windows 平台可下载 exe 程序运行:[下载地址](https://github.com/happysnaker/Gobang/raw/master/AL%E4%BA%94%E5%AD%90%E6%A3%8B/Release/AI%E4%BA%94%E5%AD%90%E6%A3%8B.exe) 20 | 21 | ## 项目算法思想 22 | 23 | 首先假定白棋为玩家的棋子,黑棋为电脑的棋子。项目五子棋算法没有采用标准的博弈树算法,这对新手来说并不友好,我采用的是五元组算法,这个算法最初是在一个外国友人的博客中看到的,大概的思想是(站在AI的角度): 24 | 25 | 对于五子棋而言,我们最终的目的就是找到一个五元组(五个连着的位置)使得电脑五子连珠,而一旦这个五元组有一个白棋,那么这个五元组对于电脑而言就算无效五元组(进攻方面),因为它永远也不可能连起来。 26 | 27 | 具体而言,我们枚举每一个可能的落子点,根据这一个点为起点,向四个方向扩展,枚举所有包含这个点的五元组(记住是所有包含这个点的五元组),根据黑棋和白棋的数量,为每一个可能的五元组判分,最后在把所有包含该点的五元组得分累加,就是该点的总得分,枚举到最高得分的点,就是我们电脑需要下棋的位置。 28 | 29 | 如何判定得分呢?如果该五元组既有黑棋又有白棋,那么这个五元组是完全报废的,它绝不可能五子连珠(对于双方都是这样);如果仅有黑棋,那么这个五元组对电脑就是有意义的,我们根据黑棋的数量拟定一个进攻得分;如果仅有白棋,这个五元组对于玩家而言是有益的,那么电脑落子在这个五元组内可以有效的防守,我们需要拟定一个防守得分。这个得分规范不是一定的,可以根据实验来调整,我给出我总结出的方案: 30 | ``` 31 | /*g是电脑一方的棋, b是玩家一方的棋*/ 32 | if (g == 0 && b == 0) return 10; 33 | else if (g == 1 && b == 0) return 35; 34 | else if (g == 2 && b == 0) return 1500; 35 | else if (g == 3 && b == 0) return 18000; 36 | else if (g == 4 && b == 0) return 1000000; 37 | else if (g == 0 && b == 1) return 15; 38 | else if (g == 0 && b == 2) return 400; 39 | else if (g == 0 && b == 3) return 6000; 40 | else if (g == 0 && b == 4) return 150000; 41 | else if (g != 0 && b != 0) return 0; 42 | return 0; 43 | 44 | /*四个接口,用于获取包含x,y点四个方向的五元组情况,返回敌我棋的数量*/ 45 | vector Get_Nums1(int x, int y); 46 | vector Get_Nums2(int x, int y); 47 | vector Get_Nums3(int x, int y); 48 | vector Get_Nums4(int x, int y); 49 | int Get_Points(int x, int y, int ch); /*获取该点的得分,ch 参数表示是评估电脑的还是用户的*/ 50 | int x_Points(vector nums, int ch); /*一个五元组内,根据敌我棋的数量获取得分*/ 51 | ``` 52 | 53 | ## 项目演示视频以及完整项目下载 54 | **项目演示视频** 55 | 56 | [智能五子棋项目视频](https://www.zhihu.com/zvideo/1365346584163643393) 57 | 58 | 59 | **网盘下载:** 60 | 61 | 链接:[Vs2019项目下载](https://pan.baidu.com/s/1hxAxJnbA9Ue66vWO3CQICA) 62 | 63 | 提取码:gbau 64 | 65 | --------------------------------------------------------------------------------