Skip to content

Person & Caeser Cipher#35

Open
ddistant wants to merge 3 commits intoaccesscode-2-2:masterfrom
ddistant:master
Open

Person & Caeser Cipher#35
ddistant wants to merge 3 commits intoaccesscode-2-2:masterfrom
ddistant:master

Conversation

@ddistant
Copy link

No description provided.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion. This method would read a bit better without the result variable:

- (BOOL)codeBreaker:(NSString *)string1 withStrings:(NSString *)string2 {

    for (int i = 1; i <= 25; i++) {        
        NSString * decodedString = [self decode:string1 offset:i];

        for (int j = 1; j <= 25; j++) {
            NSString * decodedString2 = [self decode:string2 offset:j];

            if ([decodedString isEqualToString:decodedString2]) {
                NSLog(@"%@ decoded is %@ using offset %d", string1, decodedString, i);
                NSLog(@"%@ decoded is %@ using offset %d", string2, decodedString2, j);

                return YES;
            }
        }
    }

    return NO;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants