C#使用迷宫地图来模拟新冠疫情的传播速度(一)

news2024/9/28 23:24:01

国家开始发布疫情放开政策,本人于2022-12-21开始感染并发高烧。

最近才康复。有感于此

我们用初始感染源来影响九宫网格来查看新冠的传播速度

小游戏规则如下:

一个感染源 可以传播附近相邻的8个网格【类似于扫雷】,假如每个感染源一天只能感染相邻的8个网格,问:一个感染源多久可以感染所有N*M网格

初始所有单元格都是绿色的,初始当前红色的单元格可以感染8个最近的单元格【九宫格】,

并将其他8个单元格设置为红色。

迷宫的单元格没有障碍和阻塞

病毒传染源居于中心将达到最快速度,

新建Windows窗体应用程序NovelCoronavirusDemo,

将默认的Form1重命名为FormNovelVirusSpread,窗体FormNovelVirusSpread设计如图:

 为窗体绑定Paint事件FormNovelVirusSpread_Paint,

按钮Init绑定Click事件btnInit_Click,按钮Spread绑定Click事件btnSpread_Click

窗体设计代码如下【FormNovelVirusSpread.Designer.cs】:


namespace NovelCoronavirusDemo
{
    partial class FormNovelVirusSpread
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.panel1 = new System.Windows.Forms.Panel();
            this.rtxbDisplay = new System.Windows.Forms.RichTextBox();
            this.btnSpread = new System.Windows.Forms.Button();
            this.btnInit = new System.Windows.Forms.Button();
            this.txbColumnCount = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.txbRowCount = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.panel1.SuspendLayout();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.Controls.Add(this.rtxbDisplay);
            this.panel1.Controls.Add(this.btnSpread);
            this.panel1.Controls.Add(this.btnInit);
            this.panel1.Controls.Add(this.txbColumnCount);
            this.panel1.Controls.Add(this.label2);
            this.panel1.Controls.Add(this.txbRowCount);
            this.panel1.Controls.Add(this.label1);
            this.panel1.Location = new System.Drawing.Point(652, 12);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(320, 618);
            this.panel1.TabIndex = 11;
            // 
            // rtxbDisplay
            // 
            this.rtxbDisplay.Location = new System.Drawing.Point(3, 88);
            this.rtxbDisplay.Name = "rtxbDisplay";
            this.rtxbDisplay.ReadOnly = true;
            this.rtxbDisplay.Size = new System.Drawing.Size(311, 527);
            this.rtxbDisplay.TabIndex = 9;
            this.rtxbDisplay.Text = "";
            // 
            // btnSpread
            // 
            this.btnSpread.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold);
            this.btnSpread.Location = new System.Drawing.Point(209, 3);
            this.btnSpread.Name = "btnSpread";
            this.btnSpread.Size = new System.Drawing.Size(80, 80);
            this.btnSpread.TabIndex = 0;
            this.btnSpread.Text = "Spread";
            this.btnSpread.UseVisualStyleBackColor = true;
            this.btnSpread.Click += new System.EventHandler(this.btnSpread_Click);
            // 
            // btnInit
            // 
            this.btnInit.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold);
            this.btnInit.Location = new System.Drawing.Point(113, 3);
            this.btnInit.Name = "btnInit";
            this.btnInit.Size = new System.Drawing.Size(80, 80);
            this.btnInit.TabIndex = 8;
            this.btnInit.Text = "Init";
            this.btnInit.UseVisualStyleBackColor = true;
            this.btnInit.Click += new System.EventHandler(this.btnInit_Click);
            // 
            // txbColumnCount
            // 
            this.txbColumnCount.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold);
            this.txbColumnCount.Location = new System.Drawing.Point(57, 42);
            this.txbColumnCount.Name = "txbColumnCount";
            this.txbColumnCount.Size = new System.Drawing.Size(38, 27);
            this.txbColumnCount.TabIndex = 7;
            this.txbColumnCount.Text = "6";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold);
            this.label2.Location = new System.Drawing.Point(7, 45);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(46, 18);
            this.label2.TabIndex = 6;
            this.label2.Text = "列数";
            // 
            // txbRowCount
            // 
            this.txbRowCount.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold);
            this.txbRowCount.Location = new System.Drawing.Point(57, 9);
            this.txbRowCount.Name = "txbRowCount";
            this.txbRowCount.Size = new System.Drawing.Size(38, 27);
            this.txbRowCount.TabIndex = 5;
            this.txbRowCount.Text = "5";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold);
            this.label1.Location = new System.Drawing.Point(7, 12);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(46, 18);
            this.label1.TabIndex = 4;
            this.label1.Text = "行数";
            // 
            // FormNovelVirusSpread
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(984, 642);
            this.Controls.Add(this.panel1);
            this.Name = "FormNovelVirusSpread";
            this.Text = "新冠病毒传播演示";
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.FormNovelVirusSpread_Paint);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.RichTextBox rtxbDisplay;
        private System.Windows.Forms.Button btnSpread;
        private System.Windows.Forms.Button btnInit;
        private System.Windows.Forms.TextBox txbColumnCount;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txbRowCount;
        private System.Windows.Forms.Label label1;
    }
}

新建网格对象实体类Grid,Grid类的源代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NovelCoronavirusDemo
{
    /// <summary>
    /// 一个单元格,由行索引,列索引,是否已被感染等属性组成
    /// </summary>
    public class Grid
    {
        /// <summary>
        /// 网格所在的行的索引
        /// </summary>
        public int RowIndex { get; set; }

        /// <summary>
        /// 网格所在的列的索引
        /// </summary>
        public int ColumnIndex { get; set; }

        /// <summary>
        /// 是否已被感染新冠
        /// </summary>
        public bool IsInfected { get; set; }

        /// <summary>
        /// 是否已访问
        /// </summary>
        public bool IsVisited { get; set; }

        /// <summary>
        /// 打印该网格对象
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return $"{{Row={RowIndex},Column={ColumnIndex},IsInfected={IsInfected}}}";
        }
    }
}

新建操作类MazeGridUtil,MazeGridUtil类的源代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NovelCoronavirusDemo
{
    /// <summary>
    /// 网格地图可以认为是一个N*M的行列式,也可以认为是一个二维数组,每个元素都是一个单元格Grid
    /// </summary>
    public class MazeGridUtil
    {
        /// <summary>
        /// 行数
        /// </summary>
        public int RowCount { get; set; }
        /// <summary>
        /// 列数
        /// </summary>
        public int ColumnCount { get; set; }
        /// <summary>
        /// 网格行列式
        /// </summary>
        public Grid[,] GridArray { get; set; }
        /// <summary>
        /// 初始化网格地图:需指定行数和列数
        /// </summary>
        /// <param name="rowCount">行数</param>
        /// <param name="columnCount">列数</param>
        public MazeGridUtil(int rowCount, int columnCount) 
        {
            RowCount = rowCount;
            ColumnCount = columnCount;
            GridArray = new Grid[RowCount, ColumnCount];
            for (int i = 0; i < RowCount; i++)
            {
                for (int j = 0; j < ColumnCount; j++)
                {
                    GridArray[i, j] = new Grid()
                    {
                        RowIndex = i,
                        ColumnIndex = j,
                        IsInfected = false,
                        IsVisited = false
                    };
                }
            }
        }

        /// <summary>
        /// 获取所有已感染的并且未访问的单元格
        /// </summary>
        /// <returns></returns>
        public static List<Grid> GetAllInfectedAndUnvisited(MazeGridUtil mazeGridUtil)
        {
            List<Grid> mazeGrids = new List<Grid>();
            for (int i = 0; i < mazeGridUtil.RowCount; i++)
            {
                for (int j = 0; j < mazeGridUtil.ColumnCount; j++)
                {
                    if (mazeGridUtil.GridArray[i, j].IsInfected && !mazeGridUtil.GridArray[i, j].IsVisited)
                    {
                        //考虑到可能会重复,这里过滤掉重复的
                        if (!mazeGrids.Contains(mazeGridUtil.GridArray[i, j]))
                        {
                            mazeGrids.Add(mazeGridUtil.GridArray[i, j]);
                        }
                    }
                }
            }
            return mazeGrids;
        }

        /// <summary>
        /// 将当前已感染的单元格的相邻的8个九宫格设置为已感染新冠状态
        /// </summary>
        /// <param name="mazeGrids">所有已感染的并且未访问的单元格</param>
        /// <param name="mazeGridUtil"></param>
        public static void InfectEightGrid(List<Grid> mazeGrids, MazeGridUtil mazeGridUtil) 
        {
            for (int index = 0; index < mazeGrids.Count; index++)
            {
                int i = mazeGrids[index].RowIndex;//i对应行Row
                int j = mazeGrids[index].ColumnIndex;//j对应列Column
                mazeGridUtil.GridArray[i, j].IsVisited = true;
                //将当前已感染的单元格的相邻的8个九宫格设置为感染
                if (i - 1 >= 0 && j - 1 >= 0)
                {
                    if (!mazeGridUtil.GridArray[i - 1, j - 1].IsInfected)
                    {
                        mazeGridUtil.GridArray[i - 1, j - 1].IsInfected = true;
                    }
                }
                if (i - 1 >= 0)
                {
                    if (!mazeGridUtil.GridArray[i - 1, j].IsInfected)
                    {
                        mazeGridUtil.GridArray[i - 1, j].IsInfected = true;
                    }
                }
                if (j + 1 < mazeGridUtil.ColumnCount && i - 1 >= 0)
                {
                    if (!mazeGridUtil.GridArray[i - 1, j + 1].IsInfected)
                    {
                        mazeGridUtil.GridArray[i - 1, j + 1].IsInfected = true;
                    }
                }

                if (j - 1 >= 0)
                {
                    if (!mazeGridUtil.GridArray[i, j - 1].IsInfected)
                    {
                        mazeGridUtil.GridArray[i, j - 1].IsInfected = true;
                    }
                }
                if (j + 1 < mazeGridUtil.ColumnCount)
                {
                    if (!mazeGridUtil.GridArray[i, j + 1].IsInfected)
                    {
                        mazeGridUtil.GridArray[i, j + 1].IsInfected = true;
                    }
                }

                if (j - 1 >= 0 && i + 1 < mazeGridUtil.RowCount)
                {
                    if (!mazeGridUtil.GridArray[i + 1, j - 1].IsInfected)
                    {
                        mazeGridUtil.GridArray[i + 1, j - 1].IsInfected = true;
                    }
                }
                if (i + 1 < mazeGridUtil.RowCount)
                {
                    if (!mazeGridUtil.GridArray[i + 1, j].IsInfected)
                    {
                        mazeGridUtil.GridArray[i + 1, j].IsInfected = true;
                    }
                }
                if (i + 1 < mazeGridUtil.RowCount && j + 1 < mazeGridUtil.ColumnCount)
                {
                    if (!mazeGridUtil.GridArray[i + 1, j + 1].IsInfected)
                    {
                        mazeGridUtil.GridArray[i + 1, j + 1].IsInfected = true;
                    }
                }
            }
        }

        /// <summary>
        /// 是否已全部感染
        /// </summary>
        /// <returns></returns>
        public static bool IsAllSpread(MazeGridUtil mazeGridUtil)
        {
            bool isAce = true;//是否全部感染
            for (int i = 0; i < mazeGridUtil.RowCount; i++)
            {
                bool existOK = false;//是否存在未感染
                for (int j = 0; j < mazeGridUtil.ColumnCount; j++)
                {
                    if (!mazeGridUtil.GridArray[i, j].IsInfected)
                    {
                        isAce = false;
                        existOK = true;
                        break;
                    }
                }
                if (existOK)
                {
                    break;
                }
            }
            return isAce;
        }
    }
}

窗体FormNovelVirusSpread.cs源代码如下:

using MazeDemo;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NovelCoronavirusDemo
{
    public partial class FormNovelVirusSpread : Form
    {
        /// <summary>
        /// 是否已描绘病毒源,确保只描绘病毒源一次
        /// </summary>
        bool isDrawVirusSource = false;
        /// <summary>
        /// 病毒感染全部网格所需天数
        /// </summary>
        int spreadDays = 0;
        MazeGridUtil mazeGridUtil = null;
        public FormNovelVirusSpread()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 显示文本框内容
        /// </summary>
        /// <param name="message"></param>
        private void DisplayContent(string message)
        {
            this.BeginInvoke(new Action(() =>
            {
                if (rtxbDisplay.TextLength > 10240)
                {
                    rtxbDisplay.Clear();
                }
                rtxbDisplay.AppendText(message + "\n");
                rtxbDisplay.ScrollToCaret();
            }));
        }

        /// <summary>
        /// 检查输入
        /// </summary>
        /// <param name="txb"></param>
        /// <param name="commentStr"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        private bool CheckInputCount(TextBox txb, string commentStr, out int count)
        {
            if (!int.TryParse(txb.Text, out count))
            {
                MessageBox.Show($"[{commentStr}]请输入正整数", "错误");
                txb.Focus();
                return false;
            }
            if (count <= 0 || count >= 100)
            {
                MessageBox.Show($"[{commentStr}]范围是【1~99】,请重新输入", "错误");
                txb.Focus();
                return false;
            }
            return true;
        }

        /// <summary>
        /// 窗体的重绘事件,调用Invalidate()会触发重绘事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormNovelVirusSpread_Paint(object sender, PaintEventArgs e)
        {
            if (mazeGridUtil == null) 
            {
                return;
            }
            int sideLength = 50;//正方形【迷宫的一个网格MazeGrid】的边长。
            float fontSize = 13;//打印的起点、终点文字的字体大小
            //以边长为50为例:因当前窗体的高度为606,去除窗体顶部和底部的高度【约56】,只能正常显示11行。因Panel控件的横坐标为705,因此只能显示14列。
            if (mazeGridUtil.RowCount <= 11 && mazeGridUtil.ColumnCount <= 14)
            {
                sideLength = 50;
                fontSize = 13;
            }
            else if (mazeGridUtil.RowCount <= 22 && mazeGridUtil.ColumnCount <= 28)
            {
                //如果行数在22行之内,列数在28列之内,则将网格的边长设置25
                sideLength = 25;
                fontSize = 8;
            }
            else
            {
                //如果行数、列数过大(行数大于22,列数大于28)。则应该将界面变大,并增加滚动条
                sideLength = 25;
                fontSize = 8;
                if (mazeGridUtil.RowCount > 22)
                {
                    this.Height = this.Height + (mazeGridUtil.RowCount - 22) * sideLength;
                }
                if (mazeGridUtil.ColumnCount > 28)
                {
                    this.Width = this.Width + (mazeGridUtil.ColumnCount - 28) * sideLength;
                    //Panel操作面板要整体向右移动,即X坐标增加
                    panel1.Location = new Point(panel1.Location.X + (mazeGridUtil.ColumnCount - 28) * sideLength, panel1.Location.Y);
                }
            }
            Graphics graphics = e.Graphics;
            for (int i = 0; i < mazeGridUtil.RowCount; i++)
            {
                for (int j = 0; j < mazeGridUtil.ColumnCount; j++)
                {
                    //注意:第一行是Y坐标没变,X坐标在变化。因此i是纵坐标 j是横坐标
                    Rectangle rect = new Rectangle(sideLength * j, sideLength * i, sideLength, sideLength);
                    graphics.DrawRectangle(new Pen(Color.Red), rect);
                    if (mazeGridUtil.GridArray[i, j].IsInfected)
                    {
                        graphics.FillRectangle(new SolidBrush(Color.Red), rect);//如果已感染
                    }
                    else
                    {
                        graphics.FillRectangle(Brushes.SpringGreen, rect);
                    }
                    //绘制网格的(行索引,列索引)
                    AddTextAlignCenter(graphics, $"({i},{j})", new Font("宋体", fontSize), rect);
                }
            }
            //画横线
            for (int i = 0; i < mazeGridUtil.RowCount + 1; i++)
            {
                graphics.DrawLine(Pens.Black, 0, sideLength * i, sideLength * mazeGridUtil.ColumnCount, sideLength * i);
            }
            //画纵线
            for (int j = 0; j < mazeGridUtil.ColumnCount + 1; j++)
            {
                graphics.DrawLine(Pens.Black, sideLength * j, 0, sideLength * j, sideLength * mazeGridUtil.RowCount);
            }
            if (!isDrawVirusSource)
            {
                isDrawVirusSource = true;
                //设置新冠病毒源为红色,居中显示
                Rectangle rectEnd = new Rectangle(sideLength * ((mazeGridUtil.ColumnCount - 1) / 2), sideLength * ((mazeGridUtil.RowCount - 1) / 2), sideLength, sideLength);
                graphics.FillRectangle(new SolidBrush(Color.Red), rectEnd);
                AddTextAlignCenter(graphics, "病毒源", new Font("宋体", fontSize), rectEnd);
                mazeGridUtil.GridArray[(mazeGridUtil.RowCount - 1) / 2, (mazeGridUtil.ColumnCount - 1) / 2].IsInfected = true;
                DisplayContent($"新冠传播的病毒源为【({(mazeGridUtil.RowCount - 1) / 2},{(mazeGridUtil.ColumnCount - 1) / 2})】...");
            }
        }

        /// <summary>
        /// 将显示的文字放在矩形的中间
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="text"></param>
        /// <param name="font"></param>
        /// <param name="rect"></param>
        private void AddTextAlignCenter(Graphics graphics, string text, Font font, Rectangle rect)
        {
            SizeF sizeF = graphics.MeasureString(text, font);
            float destX = rect.X + (rect.Width - sizeF.Width) / 2;
            float destY = rect.Y + (rect.Height - sizeF.Height) / 2;
            graphics.DrawString(text, font, Brushes.Black, destX, destY);
        }

        private void btnInit_Click(object sender, EventArgs e)
        {
            int rowCount;//行数
            int columnCount;//列数
            if (!CheckInputCount(txbRowCount, "行数", out rowCount))
            {
                return;
            }
            if (!CheckInputCount(txbColumnCount, "列数", out columnCount))
            {
                return;
            }
            isDrawVirusSource = false;
            spreadDays = 0;
            DisplayContent($"正在生成新冠传播网格地图【{rowCount}行{columnCount}列】,请稍候...");

            mazeGridUtil = new MazeGridUtil(rowCount, columnCount);
            //重绘迷宫,新的开始
            this.Invalidate();
        }

        /// <summary>
        /// 新冠病毒感染附近的8个单元格
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSpread_Click(object sender, EventArgs e)
        {
            spreadDays++;
            //获取所有已感染的并且未访问的单元格
            List<Grid> mazeGrids = MazeGridUtil.GetAllInfectedAndUnvisited(mazeGridUtil);
            MazeGridUtil.InfectEightGrid(mazeGrids, mazeGridUtil);
            
            this.Invalidate();//触发paint事件
            //重新获取已感染的单元格
            mazeGrids = MazeGridUtil.GetAllInfectedAndUnvisited(mazeGridUtil);
            DisplayContent($"第【{spreadDays}】天,新冠传播已感染网格个数【{mazeGrids.Count}】,分别为【{string.Join(";", mazeGrids.Select(grid => $"({grid.RowIndex},{grid.ColumnIndex})"))}】");
            bool isAce = MazeGridUtil.IsAllSpread(mazeGridUtil);//是否全部感染
            if (isAce)
            {
                DisplayContent($"已全部感染新冠病毒,网格地图已被病毒沦陷,所需天数【{spreadDays}】");
                MessageBox.Show($"已全部感染新冠病毒,网格地图已被病毒沦陷,所需天数【{spreadDays}】", "Ace");
            }
        }
    }
}

运行测试如图:

 

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/139350.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Vue--》setup、ref、reactive函数使用讲解

目录 setup ref函数 reactive函数 Vue3中的响应式原理 setup Vue3中的一个新的配置项&#xff0c;值为一个函数。组件中所用到的数据、方法等等&#xff0c;均要配置在setup中。setup函数的两种返回值&#xff0c;如下&#xff1a; 若返回一个对象&#xff0c;则对象中的…

使用Docker快速搭建Hfish蜜罐

HFish简介 HFish是一款社区型免费蜜罐&#xff0c;侧重企业安全场景&#xff0c;从内网失陷检测、外网威胁感知、威胁情报生产三个场景出发&#xff0c;为用户提供可独立操作且实用的功能&#xff0c;通过安全、敏捷、可靠的中低交互蜜罐增加用户在失陷感知和威胁情报领域的能…

源码讲解ThreadLocal父子线程通信问题(图+文+源码)

1 缘起 在复习ThreadLocal相关应用的知识&#xff0c; 有一个老生常谈的问题&#xff1a;父子线程通信&#xff0c; 起初&#xff0c;对于父子线程通信&#xff0c;仅了解ThreadLocal无法通过子线程获取线程数据&#xff0c; 并不了解为什么会这样&#xff1f;以及为什么Inher…

15.4 宏任务和微任务

宏任务和微任务 start 如果彻底理解了事件循环&#xff0c;其实大多数 JS 执行的逻辑都能理解了但是在 ES6 中引入了 Promise, 就引出了两个新概念&#xff0c;宏任务和微任务。 1.宏任务和微任务 1.1 名词 宏任务&#xff1a;macrotask 微任务&#xff1a;microtask 在 E…

异构操作系统的“融合计算”

这些年&#xff0c;由随着应用场景日益丰富和多样化&#xff0c;计算工作越来越复杂&#xff0c;传统的计算方式&#xff08;单机计算/分布式计算&#xff09;已经不能满足&#xff0c;需要一种新的更强大的计算模式来解决这些问题&#xff0c;这是融合计算产生的背景。 …

117.(leaflet之家)leaflet空间判断-点与geojson面图层的空间关系(turf实现)

听老人家说:多看美女会长寿 地图之家总目录(订阅之前建议先查看该博客) 文章末尾处提供保证可运行完整代码包,运行如有问题,可“私信”博主。 效果如下所示: 下面献上完整代码,代码重要位置会做相应解释 <!DOCTYPE html> <html>

Linux系统下的服务管理

文章目录Linux系统下的服务管理1.基本介绍2.service管理指令3.chkconfig指令4.systemctl管理指今4.1.基本语法4.2.systemctl设置服务的自启动状态4.3.防火墙实验案例4.4.防火墙Linux系统下的服务管理 1.基本介绍 服务(service) 本质就是进程&#xff0c;但是是运行在后台的&a…

软考高项(信息系统项目管理师)经验分享

文章目录前言考试过程第一步&#xff1a;日常刷选择题第二步&#xff1a;考前一个月之前刷完精讲课第三步&#xff1a;计算题统一学习第四步&#xff1a;论文早准备第五步&#xff1a;反复刷冲刺视频第六步&#xff1a;刷近几年真题第七步&#xff1a;准备几份考试当天复习资料…

vue组件之间的数据传递和组件的生命周期

一、组件之间的通信1、组件之间的关系&#xff1a;父子关系、兄弟关系、跨级关系2、父子组件之间的通信&#xff08;数据传递&#xff09;&#xff1a;&#xff08;1&#xff09;父组件 ——-> 子组件&#xff1a;使用propsA、第一步&#xff1a;在父组件中使用子组件时&…

【K哥爬虫普法】大数据风控第一案:从魔蝎科技案件判决,看爬虫技术刑事边界

我国目前并未出台专门针对网络爬虫技术的法律规范&#xff0c;但在司法实践中&#xff0c;相关判决已屡见不鲜&#xff0c;K 哥特设了“K哥爬虫普法”专栏&#xff0c;本栏目通过对真实案例的分析&#xff0c;旨在提高广大爬虫工程师的法律意识&#xff0c;知晓如何合法合规利用…

线段树 - 从入门到入土

普通线段树 线段树是什么 我们要学习线段树&#xff0c;首先要了解线段树的结构长什么样。 线段树是一颗二叉树&#xff0c;树上的节点储存数据&#xff08;可以是值、字符串、数组、多个值&#xff09;。 作用 一般来说&#xff0c;线段树是用来维护一个数组的。 数据储…

手写RPC框架02-路由模块设计与实现

源码地址&#xff1a;https://github.com/lhj502819/IRpc/tree/v3 系列文章&#xff1a; 注册中心模块实现路由模块实现序列化模块实现过滤器模块实现 为什么需要路由模块&#xff1f; 在当今互联网日益发展的情况下&#xff0c;我们一个服务一般都会部署多个&#xff0c;一方…

Python绘制表白代码,又是一个表白神器

前言 嗨呀&#xff0c;又是我&#xff0c;又给你们带来了表白的代码 之前发了那些 照片里面加文字的…还有烟花…还有跳动爱心…emm你们也可以去看看哦 今天带来的这个&#xff0c;也是很不错哦 只不过它出来的有些慢&#xff0c;我这里先给你们看看这个效果图吧 效果展示…

大数据基础平台搭建-(三)Hadoop集群HA+Zookeeper搭建

大数据基础平台搭建-&#xff08;三&#xff09;Hadoop集群HAZookeeper搭建 大数据平台系列文章&#xff1a; 1、大数据基础平台搭建-&#xff08;一&#xff09;基础环境准备 2、大数据基础平台搭建-&#xff08;二&#xff09;Hadoop集群搭建 3、大数据基础平台搭建-&#xf…

如何让小型云台机械手实现按颜色分拣物品?

1. 功能说明 在小型云台机械手附近设置一个工作台&#xff0c;并安装一个TCS3200颜色识别传感器。将红色、蓝色工件分别放置在传感器上&#xff0c;如果检测的物料的颜色为红色&#xff0c;机械臂将物体放在机械臂的左侧&#xff0c;如果检测的物料的颜色为蓝色&#xff0c;机械…

数据结构与算法-希尔排序、归并排序

目录​​​​​​​ 希尔排序 1.算法描述 2.算法的实现 归并排序 4.1算法描述 2.算法实现 希尔排序 1.算法描述 1959年shell发明&#xff0c;第一批突破O&#xff08;n2&#xff09;时间复杂度的排序算法&#xff0c;是简单插入排序的改进版。它与插入之处在于&#xff0…

Android 深入系统完全讲解(二)

操作系统 操作系统是一套软件&#xff0c;它的任务就是为上层开发的用户&#xff0c;提供一个更方便的开发环境&#xff0c;同时 让硬件连接到系统中&#xff0c;能够非常方便&#xff0c;从而提高开发速度&#xff0c;以及稳定可靠。 操作系统就是这么存在的。 我们理解它&am…

基于低代码平台构筑金融行业IT运维服务体系

我今天分享题目是《基于低代码平台&#xff0c;构筑金融行业的IT运维服务体系》。这是一个大家不太熟悉的领域&#xff0c;首先它的行业是金融&#xff0c;其次它做的事情是IT运维。 关于金科信息 我先介绍一下金科信息。金科信息在1993年成立&#xff0c;到明年我们就整整30…

前端开发技术栈(插件篇):datatables

一、Datatables介绍 官网地址&#xff1a;https://datatables.net/ DataTables中文网&#xff1a;http://datatables.club/ 1、Datatables是一款jquery表格插件。它是一个高度灵活的工具&#xff0c;可以将任何HTML表格添加高级的交互功能。 2、分页&#xff0c;即时搜索和排序…

【Bootstrap】可复用的组件

目录 一、字体图标 二、下拉菜单 1. 步骤 2. 对齐 3. 分割线 4. 禁用的菜单项 三、按钮组 1. 按钮组 2. 按钮工具栏 3. 尺寸 4. 嵌套 5. 垂直排列 四、输入框组 1. 输入框组 2. 尺寸 3. 作为额外元素的按钮 4. 作为额外元素的按钮式下拉菜单 一、字体图标 组件…