Skip to content

Instantly share code, notes, and snippets.

@RhinoLu
Created August 24, 2012 05:03
Show Gist options
  • Save RhinoLu/3445597 to your computer and use it in GitHub Desktop.
Save RhinoLu/3445597 to your computer and use it in GitHub Desktop.
生肖與星座
/**
* 參考 http://little-bill.iteye.com/blog/724570
**/
private function getAstro(ld_month:uint, ld_day:uint):String
{
var s:String = "魔羯水瓶双鱼牧羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯";
var arr:Array = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22];
return s.substr(ld_month * 2 - (ld_day < arr[ld_month - 1] ? 2 : 0), 2);
}
private function getAnimal(_year:uint):String
{
var animals = new Array("鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪");
return animals[(_year - 4) % 12];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment