Skip to content

Instantly share code, notes, and snippets.

@max-power
Last active February 23, 2025 17:44
Show Gist options
  • Save max-power/d576d70e6f97440d3684fe44bbc6e8b2 to your computer and use it in GitHub Desktop.
Save max-power/d576d70e6f97440d3684fe44bbc6e8b2 to your computer and use it in GitHub Desktop.
Chinese Zodiac Animals
ZodiacAnimal = Data.define(:icon, :name, :chinese_name, :earthly_branch, :element, :trine, :yin) do
def self.all
[
new( icon: "🐭", name: "Rat", chinese_name: "鼠", earthly_branch: "子", element: "Water", trine: 1, yin: false ),
new( icon: "πŸ‚", name: "Ox", chinese_name: "牛", earthly_branch: "δΈ‘", element: "Earth", trine: 2, yin: true ),
new( icon: "πŸ…", name: "Tiger", chinese_name: "θ™Ž", earthly_branch: "ε―…", element: "Wood" , trine: 3, yin: false ),
new( icon: "πŸ‡", name: "Rabbit", chinese_name: "ε…”", earthly_branch: "卯", element: "Wood" , trine: 4, yin: true ),
new( icon: "πŸ‰", name: "Dragon", chinese_name: "ιΎ™", earthly_branch: "θΎ°", element: "Earth", trine: 1, yin: false),
new( icon: "🐍", name: "Snake", chinese_name: "蛇", earthly_branch: "ε·³", element: "Fire" , trine: 2, yin: true ),
new( icon: "🐎", name: "Horse", chinese_name: "马", earthly_branch: "午", element: "Fire" , trine: 3, yin: false),
new( icon: "🐐", name: "Goat", chinese_name: "羊", earthly_branch: "ζœͺ", element: "Earth", trine: 4, yin: true ),
new( icon: "πŸ’", name: "Monkey", chinese_name: "猴", earthly_branch: "η”³", element: "Metal", trine: 1, yin: false),
new( icon: "πŸ“", name: "Rooster", chinese_name: "ιΈ‘", earthly_branch: "ι…‰", element: "Metal", trine: 2, yin: true ),
new( icon: "πŸ•", name: "Dog", chinese_name: "η‹—", earthly_branch: "戌", element: "Earth", trine: 3, yin: false),
new( icon: "πŸ–", name: "Pig", chinese_name: "ηŒͺ", earthly_branch: "δΊ₯", element: "Water", trine: 4, yin: true ),
]
end
def self.for_year(year)
all[(year - 4) % 12] # 4 is the base year (Rat starts in 4 AD)
end
def yin? = yin
def yang? = !yin
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment