findPos

findPos returns the first index, where 'pos' was found in 'from'

Contents

Syntax

p = findPos(from, pos)

Description

The first index of "pos" within "from" is returned. Note: this function was originally designed to return the index set.

This function is central to all chess figures. It helps identifying the instance within the figure class.

Inputs:

Outputs:

Example

Given are four positions, we want to know the first occurence of [3 4].

 p = findPos([[1 2];[3 4]; [4 4]; [3 4]],  [3 4])
p =

     2

See also

King, Queen, Knight, Bishop, Rook, Pawn

Signature