File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -499,6 +499,20 @@ class PlayerSequences:
499499 def __len__(self ) -> int:
500500 return self.game.deref().GetSequences(self.player ).size()
501501
502+ def __getitem__(self , index: int ) -> Sequence:
503+ length = self .__len__ ()
504+ if (index<0):
505+ index+= length
506+ if (index< 0 or index>= length):
507+ raise IndexError (" index out of range" )
508+ cdef int current_idx = 0
509+ cdef stdvector[c_GameSequence].const_iterator it = (
510+ self .game.deref().GetSequences(self .player).begin())
511+ while current_idx != index:
512+ current_idx += 1
513+ it += 1
514+ return Sequence.wrap(deref(it))
515+
502516 def __iter__ (self ):
503517 cdef stdvector[c_GameSequence].const_iterator it = (
504518 self .game.deref().GetSequences(self .player).begin())
You can’t perform that action at this time.
0 commit comments