Skip to content

Commit 750df47

Browse files
author
Chris Elion
committed
docstrings
1 parent e78a632 commit 750df47

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

com.unity.ml-agents.extensions/Documentation~/Match3.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ We provide some utilities to integrate ML-Agents with Match-3 games.
55
## AbstractBoard class
66
The `AbstractBoard` is the bridge between ML-Agents and your game. It allows ML-Agents to
77
* ask your game what the "color" of a cell is
8+
* ask whether the cell is a "special" piece type or not
89
* ask your game whether a move is allowed
910
* request that your game make a move
1011

@@ -17,6 +18,11 @@ Returns the "color" of piece at the given row and column.
1718
This should be between 0 and NumCellTypes-1 (inclusive).
1819
The actual order of the values doesn't matter.
1920

21+
#### `public abstract int GetSpecialType(int row, int col)`
22+
Returns the special type of the piece at the given row and column.
23+
This should be between 0 and NumSpecialTypes (inclusive).
24+
The actual order of the values doesn't matter.
25+
2026
#### `public abstract bool IsMoveValid(Move m)`
2127
Check whether the particular `Move` is valid for the game.
2228
The actual results will depend on the rules of the game, but we provide the `SimpleIsMoveValid()` method

com.unity.ml-agents.extensions/Runtime/Match3/AbstractBoard.cs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,29 @@ namespace Unity.MLAgents.Extensions.Match3
55
{
66
public abstract class AbstractBoard : MonoBehaviour
77
{
8+
/// <summary>
9+
/// Number of rows on the board
10+
/// </summary>
811
public int Rows;
12+
13+
/// <summary>
14+
/// Number of columns on the board
15+
/// </summary>
916
public int Columns;
17+
18+
/// <summary>
19+
/// Maximum number of different types of cells (colors, pieces, etc).
20+
/// </summary>
1021
public int NumCellTypes;
11-
public int NumSpecialTypes;
1222

23+
/// <summary>
24+
/// Maximum number of special types. This can be zero, in which case
25+
/// all cells of the same type are assumed to be equivalent.
26+
/// </summary>
27+
public int NumSpecialTypes;
1328

1429
/// <summary>
15-
/// Returns the "color" of piece at the given row and column.
30+
/// Returns the "color" of the piece at the given row and column.
1631
/// This should be between 0 and NumCellTypes-1 (inclusive).
1732
/// The actual order of the values doesn't matter.
1833
/// </summary>
@@ -21,6 +36,14 @@ public abstract class AbstractBoard : MonoBehaviour
2136
/// <returns></returns>
2237
public abstract int GetCellType(int row, int col);
2338

39+
/// <summary>
40+
/// Returns the special type of the piece at the given row and column.
41+
/// This should be between 0 and NumSpecialTypes (inclusive).
42+
/// The actual order of the values doesn't matter.
43+
/// </summary>
44+
/// <param name="row"></param>
45+
/// <param name="col"></param>
46+
/// <returns></returns>
2447
public abstract int GetSpecialType(int row, int col);
2548

2649
/// <summary>
@@ -41,8 +64,6 @@ public abstract class AbstractBoard : MonoBehaviour
4164
/// <returns></returns>
4265
public abstract bool MakeMove(Move m);
4366

44-
// TODO handle "special" cell types?
45-
4667
public IEnumerable<Move> AllMoves()
4768
{
4869
var currentMove = Move.FromMoveIndex(0, Rows, Columns);

0 commit comments

Comments
 (0)