ORKSpatialSpanGame Class Reference
Inherits from | NSObject |
---|---|
Declared in | ORKSpatialSpanGame.h ORKSpatialSpanGame.m |
Overview
The ORKSpatialSpanGame
class represents a model object that represents one game-like experience in a spatial span memory task.
A game consists of a subset of a permutation of the integers [0 .. gameSize - 1], which represent the sequence of targets that should be tapped.
– initWithGameSize:sequenceLength:seed:
Returns an initialized spatial span game using the specified game size, sequence length, and seed.
- (instancetype)initWithGameSize:(NSInteger)gameSize sequenceLength:(NSInteger)sequenceLength seed:(uint32_t)seed
Parameters
gameSize |
The number of tiles in the game. |
---|---|
sequenceLength |
The number of elements in the sequence that the user has to remember. |
seed |
The generator that should be used for generating the sequence. A value of 0 means that a random seed is used. |
Discussion
This method is the designated initializer.
Declared In
ORKSpatialSpanGame.h
gameSize
The number of tiles in the game.
@property (nonatomic, readonly) NSInteger gameSize
Declared In
ORKSpatialSpanGame.h
sequenceLength
The length of the sequence. A sequence is a sub-array of a random permutation of integers (0..gameSize-1) that has a length of sequenceLength
.
@property (nonatomic, readonly) NSInteger sequenceLength
Declared In
ORKSpatialSpanGame.h
seed
The seed to use to generate the sequence. Note that if you pass seed
to another game, you get the same game.
@property (nonatomic, readonly) uint32_t seed
Declared In
ORKSpatialSpanGame.h
– enumerateSequenceWithHandler:
Enumerates the sequence, calling the block once for each element.
- (void)enumerateSequenceWithHandler:(void ( ^ ) ( NSInteger step , NSInteger tileIndex , BOOL isLastStep , BOOL *stop ))handler
Parameters
handler |
The block to be called for each element in the sequence. The
|
---|
Declared In
ORKSpatialSpanGame.h
– tileIndexForStep:
Returns the value of the specified step in the sequence.
- (NSInteger)tileIndexForStep:(NSInteger)step
Declared In
ORKSpatialSpanGame.h