GoBang/FrMain.cs

(开头部分) 44KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.Threading;

namespace GoBang
{
    public partial class FrMain : Form
    {
        #region 变量

        /// <summary>
        ///记录回合数 
        /// </summary>
        public int huihe = 0;

        //临时变量,(x,y)表示鼠标所指位置(像素表示)
        //(l1max_x, l1max_y)和(l2max_x, l2max_y)是加分算法用到的临时变量
        private int x, y, l1max_x, l1max_y, l2max_x, l2max_y;

        //[i,j]分别表示棋盘的横、纵坐标
        //lines2max表示当前查询的player2lines[x,y]中分数最大值
        //lines1max表示当前查询的player1lines[x,y]中分数最大值
        //[m, n]加分算法中电脑选取下棋的坐标
        private int lines2max, lines1max, m, k, n, i, j;

        //player1sum, player2sum表示下棋双方各走的总步数
        private int player1sum, player2sum;

        /// <summary>
        /// 可能获胜情况总和数,由于采用15*15棋盘,应有572种可能
        /// </summary>
        private int count;

        /// <summary>
        /// shifouxiazi[i,j]=2表示此处无子,shifouxiazi[i,j]=1表示此处为黑子,shifouxiazi[i,j]=0表示此处为白子
        /// </summary>
        private int[,] shifouxiazi = new int[15, 15];

        //player1lines[x,y],player2lines[x,y]加分算法中[x,y]点分数总和
        private int[,] player2lines = new int[15, 15];
        private int[,] player1lines = new int[15, 15];

        //tableplayer[x,y,count]表示一方所有可能的获胜组合
        // 前两维表示下棋位置(x,y),后一维表示获胜组合情况
        // 比如count=0时,即第一种获胜情况,对应有tableplayer[0,0,0],tableplayer[1,0,0],
        //                  tableplayer[2,0,0],tableplayer[3,0,0],tableplayer[4,0,0]
        //所以满足[0,0],[1,0],[2,0],[3,0],[4,0]时第一种获胜情况成立

        /// <summary>
        /// 白棋获胜表
        /// </summary>
        private bool[, ,] tableplayer1 = new bool[15, 15, 572];
        /// <summary>
        /// 黑棋获胜表
后面还有 1193 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。