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.180 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.179 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.178 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.177 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.176 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.175 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.174 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.173 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.172 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.171 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.170 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.169 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.167 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.166 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.165 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.164 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.163 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.162 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.161 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m
trackler-2.2.1.160 tracks/objective-c/exercises/secret-handshake/SecretHandshakeExample.m