Last active
December 16, 2019 11:05
-
-
Save jjuliano/1525e6e8ff980ddbbd06426000bfdd33 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"sort" | |
) | |
func main() { | |
var script map[int]string | |
papaLines := [4]string{ | |
"Johnny, Johnny", | |
"Eating sugar?", | |
"Telling lies?", | |
"Open your mouth", | |
} | |
johnnyLines := [4]string{ | |
"Yes, papa!", | |
"No, papa!", | |
"No, papa!", | |
"Ha ha ha!", | |
} | |
script = make(map[int]string) | |
frames := cap(papaLines) + cap(johnnyLines) | |
for frame := 0; frame < frames; frame++ { | |
if frame < cap(papaLines) && frame < cap(johnnyLines) { | |
conversation := fmt.Sprintf("Papa says: %s\nJohnny says: %s\n", papaLines[frame], johnnyLines[frame]) | |
script[frame] = conversation | |
} | |
} | |
var keyframe []int | |
for k := range script { | |
keyframe = append(keyframe, k) | |
} | |
sort.Ints(keyframe) | |
for _, k := range keyframe { | |
fmt.Println(script[k]) | |
} | |
} | |
//Papa says: Johnny, Johnny | |
//Johnny says: Yes, papa! | |
// | |
//Papa says: Eating Sugar | |
//Johnny says: No, papa! | |
// | |
//Papa says: Telling Lies | |
//Johnny says: No, papa! | |
// | |
//Papa says: Open Your Mouth | |
//Johnny says: Ha ha ha! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment