Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static method: IEnumerable<int> KnightsMoves(int, int, int, bool)

Declaration

public static IEnumerable<int> KnightsMoves(
    int cell,
    int gridWidth,
    int gridHeight,
    bool toroidal
)

Summary

Returns the set of cells that are a knight’s move away from the specified cell.

Parameters

intcell The cell from which to generate knight’s moves.
intgridWidth Width of the grid.
intgridHeight Height of the grid.
booltoroidal If true, the grid is considered to be toroidal, i.e., the knight’s move can leave the grid and reenter on the opposite edge.