7 kyu
Chinese Zodiac
646 of 2,216AcesOfGlory
Loading description...
Fundamentals
Arrays
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I knew I was an ox, but I didn't know I was earth ox lmao
This was fun! Wood Tiger
Haskell translation
approved
metal monkey :D
I think we should add the years before 1924 to the tests.
Water Rat (me, nice...) solved this thing in the year of the Wood Dragon.
Water Dog!
This comment has been hidden.
python new test framework is required. updated in this fork
Approved
The 2 issue during testing Case,which result does match with Chinese saying:
year = 1965 output should be Fire Snake instead of wood Snake 'Fire Snake' should equal 'Wood Snake'
year = 1924 output should be Metal Rat instead of Wooden Rat 'Metal Rat' should equal 'Wood Rat'
so that testing Case result is not suit to Chinese saying
Earth Dragon :D
Description says "animals is a preloaded array containing the animals in order", "elements is a preloaded array containing the elements in order" but it's actually $animals and $elements. I think you should mention this explicitly.
All global variables in Ruby need $ at the beginning, therefore it should be obvious that you need to make it global since the arrays are not in the main clause of the user's code. However, I've added it in. Cheers.
Wood Snake
////==8>~
This comment has been hidden.
Metal Goat, this one was fun!
This comment has been hidden.
Your code is slightly wrong, since if you output the result of your it will give a different result to the expected output. My tests are right because they're the same from previous languages, so the answer is constant. For example, I tested your code and 1965 should be "Wood Snake" but you returned "Wood Dog". I added a expected output message because the current error message you experienced for the example test cases were blank. Btw use ``` at the beginning and end of code in a comment, it gives
This comment has been hidden.
Thanks, and no problem. Also description states
There are 12 animals and 5 elements, the animals change each year, and the elements every other year
why isn't that clear?C#-Translation kumited by an "Earth Goat".
https://www.codewars.com/kumite/57a9de23cf1fa5563a000081
Please check and approve!
(And I approved the kata. :-))
Double thanks dude! :)
First: Your random testcase failed at year=1972 , your expect value is wrong
Second(only a suggestion): Your order/logic of
elements
is invalid,there is an order of 60 years(each two years):Fixed - goddamn I hate .slice, it pisses me off every time. Also the elements array has each element once so that you're meant to extended it with the animals, and I stated in description it changes every other year (every 2 years) [If that's what you mean?].
To correct the first issue is enough, please forget about second suggestions ;-)
我从来没有听说过年份按照金木水火土排列的,只知道十天干(甲 乙 丙 丁 戊 己 庚 辛 壬 癸)和十二地支(子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥)的半排列是一个周期(一甲子60年),比如“庚子年”,今年是“丙申年”,具体到今天是“丙申年丙申月壬戌日”
I am curious about where the author comes from. :)
I am curious too...
Oh I'm just from boring England, but I remember doing something like this at school 2 years ago so I thought why not. I actually thought that you'd pop up on here and talk about it :P
"Metal rat" here :) Thanks for the fun kata!
Thanks dude ;)
Ditto from another Metal Rat. :-)
How can
1900
expect aMetal
animal (instead ofWood
) ifelements
are['Wood', 'Fire', 'Earth', 'Metal', 'Water']
?Because techinally 1900 isn't the start of the cycle of the zodiac (it was just my epoch because I hate calendar changes), but I'll change it to 1924. I did state that 1984 was the start of the current cycle, so you could have worked it from there.
This comment has been hidden.
Where you from?
This comment has been hidden.
Oh nice, just wondering ;)
fun coding challenge thanks! I'm a fire tiger 火老虎 by the way.