元編程參考文件

網格

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.

返回

數值整數陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格
所屬包
罪案引擎