Sha256: 4f78c71954ecd15310178899f3a724ee23b26548d3c134f897cacc7175188524

Contents?: true

Size: 846 Bytes

Versions: 363

Compression:

Stored size: 846 Bytes

Contents

#import "SecretHandshakeExample.h"

@implementation SecretHandshake

- (instancetype)initWithNumber:(int)number {
    if (self = [super init]) {
        _commands = [[self class] commandsForNumber:number];
    }
    
    return self;
}

+ (NSArray<NSString *> *)commandsForNumber:(int)number {
    NSMutableArray *result = [[NSMutableArray alloc] init];
    
    if (number & 1 << 0) { //!OCLINT
        [result addObject:@"wink"];
    }
    
    if (number & 1 << 1) { //!OCLINT
        [result addObject:@"double blink"];
    }
    
    if (number & 1 << 2) { //!OCLINT
        [result addObject:@"close your eyes"];
    }
    
    if (number & 1 << 3) { //!OCLINT
        [result addObject:@"jump"];
    }
    
    if (number & 1 << 4) { //!OCLINT
        return [[result reverseObjectEnumerator] allObjects];
    }
    return result;
}

@end

Version data entries

363 entries across 363 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.97 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.96 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.95 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.94 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.93 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.92 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.91 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.90 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.89 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.88 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.87 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.86 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.85 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.84 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.83 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.82 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.81 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.80 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.79 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m