Code covered by the BSD License  

Highlights from
Chess with "Greedy Edi"

image thumbnail

Chess with "Greedy Edi"

by

 

07 Nov 2009 (Updated )

Play chess against "Greedy Edi".

findPos

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:

  • from ... array of positions
  • pos ... the position to find

Outputs:

  • p ... returns the first index, where 'pos' was found in 'from'

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

  • Copyright 2006 W.Garn

Contact us