Skip to content

Instantly share code, notes, and snippets.

@wuman
Created May 6, 2016 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wuman/2914d83c92a163d973156a60a9defa79 to your computer and use it in GitHub Desktop.
Save wuman/2914d83c92a163d973156a60a9defa79 to your computer and use it in GitHub Desktop.
package main
import "fmt"
// chars is a map for characters indexed by number of strokes.
var chars = map[int][]string{
6: {"向", "宇", "安"},
7: {"均", "言", "彤"},
8: {"弦", "尚", "亞", "孟"},
10: {"容", "軒", "宸", "庭"},
15: {"賢", "誼", "緹", "墨", "德", "儀"},
16: {"潔", "儒"},
}
// combs lists all combinations of characters that are considered lucky.
var combs = [][2]int{
{8, 10},
{8, 16},
{8, 17},
{10, 7},
{9, 7},
{9, 15},
{9, 16},
{10, 6},
{18, 6},
{18, 7},
{22, 10},
{6, 10},
}
func main() {
count := 0
for _, comb := range combs {
firstChars, ok := chars[comb[0]]
if !ok {
continue
}
secondChars, ok := chars[comb[1]]
if !ok {
continue
}
for _, firstChar := range firstChars {
for _, secondChar := range secondChars {
if count >= 80 { // skip to next line if too long
fmt.Println()
count = 0
}
fmt.Printf("吳%s%s\t", firstChar, secondChar)
count += 8
}
}
}
fmt.Println()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment