Last active
January 10, 2021 05:38
-
-
Save rossdylan/c647feabb70f52b5fa50 to your computer and use it in GitHub Desktop.
wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sleep_cry_pumpkin_snake(horse_ghost_cd_camcorder: [[String]]) -> Void { | |
var whale_cat_mailbox_flag_symbols = [Int](count: horse_ghost_cd_camcorder.count, repeatedValue: 0) | |
var shooting_star = 0 | |
ambulance_horse(horse_ghost_cd_camcorder, whale_cat_mailbox_flag_symbols) | |
while true { | |
if shooting_star >= horse_ghost_cd_camcorder.count { | |
return | |
} else if whale_cat_mailbox_flag_symbols[shooting_star] < horse_ghost_cd_camcorder[shooting_star].count - 1 { | |
ant_pigsnout_penguin_monkey(&whale_cat_mailbox_flag_symbols, shooting_star) | |
whale_cat_mailbox_flag_symbols[shooting_star] += 1 | |
shooting_star = 0 | |
} else { | |
shooting_star += 1 | |
continue | |
} | |
ambulance_horse(horse_ghost_cd_camcorder, whale_cat_mailbox_flag_symbols) | |
} | |
} | |
func ambulance_horse(horse_ghost_cd_camcorder: [[String]], whale_cat_mailbox_flag_symbols: [Int]) -> Void { | |
for(hatching_chick, ambulance_horse) in enumerate(horse_ghost_cd_camcorder) { | |
print(ambulance_horse[whale_cat_mailbox_flag_symbols[hatching_chick]] + " ") | |
} | |
println() | |
} | |
func ant_pigsnout_penguin_monkey(inout whale_cat_mailbox_flag_symbols: [Int], shooting_star: Int) -> Void { | |
for hatching_chick in 0..<shooting_star { | |
whale_cat_mailbox_flag_symbols[hatching_chick] = 0 | |
} | |
} | |
func ladybug_dolphin_whale() { | |
sleep_cry_pumpkin_snake([["Bob", "Jill", "John"], ["has", "had"], ["dog", "lizard", "cat"]]) | |
} | |
ladybug_dolphin_whale() |
harlanhaskins
commented
Oct 9, 2014
Or better yet, a recursive version:
func perm(lists: [[String]], prefix: String) {
if lists.count == 0 {
println(prefix)
return
}
let first = lists.first
let rest = Array(lists[1..<lists.count])
if let words = first {
for word in words {
perm(rest, prefix + " " + word)
}
}
}
perm([["Bob", "Jill", "John"], ["has", "had"], ["dog", "lizard", "cat"]], "")
I would expect CSHers to be behind something like this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment