2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ズンドコキヨシ with Objective-C 今風

Last updated at Posted at 2016-03-16

今はやりのズンドコキヨシのObjective-C での実装がすでにあったのですが、今風ではないなぁと思ったので
http://qiita.com/takezou621@github/items/84fc84645fcb94af2524
この方の実装を参考に僕が今風だと思う実装に書き換えてみました


void zundokokiyosi() {
    NSString *zun = @"ズン";
    NSString *doko = @"ドコ";
    NSArray<NSString *> *zundoko = @[zun, doko];
    NSArray<NSString *> *expected = @[zun,zun,zun,zun,doko];
    NSArray<NSString *> *list = @[@"", @"", @"", @"", @""];
    
    while (![list isEqualToArray:expected]) {
        NSUInteger val = arc4random_uniform(2);
        NSLog(@"%@", zundoko[val]);
        list = @[list[1], list[2], list[3], list[4], zundoko[val]];
    }

    NSLog(@"キ・ヨ・シ!");
}

ジェネリクスを使ったが意味がない...

3/18:
テストして修正

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?