元编程参考文档

网格

12 个节点

本页内容 12

统计格子

函数

How many cells hold a value.

签名
统计格子(网格: Value Grid, 值: 整数) -> 整数
int CountCells(ValueGrid grid, int value)

参数

名称类型默认值说明
网格Value Grid—The grid.
值整数—The value.

返回

数量整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

查找格子

函数

The cells holding a value, row by row from the top.

签名
查找格子 -> (数量: 整数, 列: 整数数组, 行: 整数数组)
    网格: Value Grid
    值: 整数
int FindCells(
    ValueGrid grid,
    int value,
    out int[] xs,
    out int[] ys)

参数

名称类型默认值说明
网格Value Grid—The grid.
值整数—The value.

返回

数量整数
列整数数组
行整数数组
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

查找网格路径

函数

The cheapest path between two cells, moving four ways through cells holding the open value; the two ends may hold anything. Steps and turns each cost what they are given, a turn limit can be set, and a margin lets the path run round the outside of the grid. The corners are the start, each turn and the end - enough to draw the path as straight lines - and may lie in the margin.

签名
查找网格路径 -> (找到: 真否, 拐点列: 整数数组, 拐点行: 整数数组, 拐弯数: 整数)
    网格: Value Grid
    起点列: 整数
    起点行: 整数
    终点列: 整数
    终点行: 整数
    可通行值: 整数
    外围格数: 整数
    每步代价: 整数
    拐弯代价: 整数
    最多拐弯数: 整数
bool FindPath(
    ValueGrid grid,
    int fromX,
    int fromY,
    int toX,
    int toY,
    out int[] xs,
    out int[] ys,
    out int turns,
    int open = 0,
    int margin = 0,
    int stepCost = 1,
    int turnCost = 0,
    int maxTurns = -1)

参数

名称类型默认值说明
网格Value Grid—The grid.
起点列整数—Start column.
起点行整数—Start row.
终点列整数—End column.
终点行整数—End row.
可通行值整数0The value of a cell the path may cross.
外围格数整数0How many cells beyond each edge the path may use.
每步代价整数1What each step costs.
拐弯代价整数0What each turn costs.
最多拐弯数整数-1The most turns allowed; -1 for no limit.

返回

找到真否
拐点列整数数组
拐点行整数数组
拐弯数整数

备注

With the defaults it is the shortest walk. A tile-matching link - straight runs through empty cells with at most two turns, round the outside if need be - is open 0, margin 1, step cost 0, turn cost 1, max turns 2.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

由数值生成网格

函数

A grid holding the given values, row by row from the top.

签名
由数值生成网格 -> Value Grid
    宽度: 整数
    高度: 整数
    数值: 整数数组
ValueGrid FromValues(int width, int height, int[] values)

参数

名称类型默认值说明
宽度整数—Cells across.
高度整数—Cells down.
数值整数数组—Width × height of them.

返回

网格Value Grid
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

读取格子

函数

What a cell holds; the grid's outside value for a cell beyond it.

签名
读取格子(网格: Value Grid, 列: 整数, 行: 整数) -> 整数
int GetCell(ValueGrid grid, int x, int y)

参数

名称类型默认值说明
网格Value Grid—The grid.
列整数—Column.
行整数—Row.

返回

值整数
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

创建网格

函数

A grid with every cell holding one value.

签名
创建网格(宽度: 整数, 高度: 整数, 填充值: 整数) -> Value Grid
ValueGrid Make(int width = 8, int height = 8, int fill = 0)

参数

名称类型默认值说明
宽度整数8Cells across.
高度整数8Cells down.
填充值整数0What every cell holds.

返回

网格Value Grid
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

相邻格子配对

函数

As many pairs of side-by-side cells holding a value as can be made with no cell used twice: a tiling by dominoes. The nth pair is (first xs, first ys) and (second xs, second ys) at n.

签名
相邻格子配对 -> (对数: 整数, 第一格列: 整数数组, 第一格行: 整数数组, 第二格列: 整数数组, 第二格行: 整数数组)
    网格: Value Grid
    值: 整数
    种子: 整数
int PairNeighbours(
    ValueGrid grid,
    int value,
    out int[] firstXs,
    out int[] firstYs,
    out int[] secondXs,
    out int[] secondYs,
    int seed = 0)

参数

名称类型默认值说明
网格Value Grid—The grid.
值整数—Which cells to pair.
种子整数0Different seeds give different tilings; 0 gives the same one every time.

返回

对数整数
第一格列整数数组
第一格行整数数组
第二格列整数数组
第二格行整数数组
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

网格区域

函数

The cells holding the same value as a starting cell and joined to it four ways: what a paint bucket fills.

签名
网格区域 -> (数量: 整数, 列: 整数数组, 行: 整数数组)
    网格: Value Grid
    起点列: 整数
    起点行: 整数
int Region(
    ValueGrid grid,
    int x,
    int y,
    out int[] xs,
    out int[] ys)

参数

名称类型默认值说明
网格Value Grid—The grid.
起点列整数—Start column.
起点行整数—Start row.

返回

数量整数
列整数数组
行整数数组
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

设置格子

函数

The grid with one cell holding a new value.

签名
设置格子 -> Value Grid
    网格: Value Grid
    列: 整数
    行: 整数
    值: 整数
ValueGrid SetCell(ValueGrid grid, int x, int y, int value)

参数

名称类型默认值说明
网格Value Grid—The grid.
列整数—Column.
行整数—Row.
值整数—What it holds now.

返回

网格Value Grid
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

设置多个格子

函数

The grid with several cells set at once, the nth cell to the nth value - or every cell to the one value when only one is given.

签名
设置多个格子 -> Value Grid
    网格: Value Grid
    列: 整数数组
    行: 整数数组
    值: 整数数组
ValueGrid SetCells(
    ValueGrid grid,
    int[] xs,
    int[] ys,
    int[] values)

参数

名称类型默认值说明
网格Value Grid—The grid.
列整数数组—Columns.
行整数数组—Rows, as many as columns.
值整数数组—One value for all, or one for each cell.

返回

网格Value Grid
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

打乱网格格子

函数

The grid with what its cells hold shuffled among them, leaving every cell that holds the kept value where it is.

签名
打乱网格格子 -> Value Grid
    网格: Value Grid
    保留值: 整数
    种子: 整数
ValueGrid ShuffleCells(
    ValueGrid grid,
    int keep = 0,
    int seed = 1)

参数

名称类型默认值说明
网格Value Grid—The grid.
保留值整数0The value that stays put; 0 keeps the empty cells empty.
种子整数1The same seed shuffles the same way.

返回

网格Value Grid
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎

网格数值

函数

Every cell's value, row by row from the top.

签名
网格数值(网格: Value Grid) -> 整数数组
int[] Values(ValueGrid grid)

参数

名称类型默认值说明
网格Value Grid—The grid.

返回

数值整数数组
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
网格
所属包
罪案引擎