findPos returns the first index, where 'pos' was found in 'from'
p = findPos(from, pos)
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.
- from ... array of positions
- pos ... the position to find
- p ... returns the first index, where 'pos' was found in 'from'
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])
King, Queen, Knight, Bishop, Rook, Pawn