docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Struct Move

    Struct that encapsulates a swap of adjacent cells. A Move can be constructed from either a starting row, column, and direction, or from a "move index" between 0 and NumPotentialMoves()-1. Moves are enumerated as the internal edges of the game grid. Left/right moves come first. There are (maxCols - 1) * maxRows of these. Up/down moves are next. There are (maxRows - 1) * maxCols of these.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.MLAgents.Integrations.Match3
    Assembly: solution.dll
    Syntax
    public struct Move

    Fields

    Name Description
    Column

    Column of the cell that will be moved.

    Direction

    Direction that the cell will be moved.

    MoveIndex

    Index of the move, from 0 to NumPotentialMoves-1.

    Row

    Row of the cell that will be moved.

    Methods

    Name Description
    FromMoveIndex(int, BoardSize)

    Construct a Move from its move index and the board size. This is useful for iterating through all the Moves on a board, or constructing the Move corresponding to an Agent decision.

    FromPositionAndDirection(int, int, Direction, BoardSize)

    Construct a Move from the row, column, direction, and board size.

    InRangeForBoard(BoardSize)

    Check if the move is valid for the given board size. This will be passed the return value from AbstractBoard.GetCurrentBoardSize().

    Next(BoardSize)

    Increment the Move to the next MoveIndex, and update the Row, Column, and Direction accordingly.

    NumPotentialMoves(BoardSize)

    Return the number of potential moves for a board of the given size. This is equivalent to the number of internal edges in the board.

    OtherCell()

    Get the other row and column that correspond to this move.

    OtherDirection()

    Get the opposite direction of this move.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023