Created
May 6, 2016 07:35
-
-
Save wuman/2914d83c92a163d973156a60a9defa79 to your computer and use it in GitHub Desktop.
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
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