Beta
Advanced cow farm
Loading description...
Graphics
Algorithms
Design Patterns
Fundamentals
Lists
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.
Great kata! The only minor issue I encountered was mis-casing of
dateOfbirth
property (proper camelCase would bedateOfBirth
).thank you! fixed
Here's a random date generator I made so you can use an actual Date of Birth for the random tests. I made the year from 2000-2022, cow's have a life exepectancy of about 20 years.
Can't you just do
Date(year:2000).add(days: random(20*365)).format('yyyy-MM-dd')
in Javascript?Handling calendars maually is asking for trouble.
let date = new Date(2000, 0, Math.random() * 20 * 365 + 1 | 0).toISOString().slice(0, 10);
I kinda accounted for that. But yeah, calenders are dumb.
But if paxompaxom wanted to, he could do that and then use a random time generator.
Is there a chance that Feb 29th occurs in
let date = new Date(2000, 0, Math.random() * 20 * 365 + 1 | 0).toISOString().slice(0, 10);
?There is, but small. But in your 'manual' implementation it's just the same. If author wants to target specifically leap years with random tests, they need to tune the generator to ensure generation of such dates:
or something, depending on what exactly is needed.
In general, the Date Of Birth field does not have to be in date format, the only condition is that it is a string equal to 16 characters! But thanks for the improvements you suggested! I applied random date generation which you and mamamia5x suggested
I like the idea. I think it will be a good idea to have an image of a generated code, but have grid lines in it. It would make it easier for me to see what each grid represents, rather than having just telling me what each is.
Good idea, thanks! In addition to the current description, I will add an image with a grid showing how the information will be displayed in the result
Thanks! This will make it way easier for people to decode the image and know what they'll have to print.
Also, this part kidna confuses me.
Is this just one string composed of all 3 forms combined (with name being a string with a length of 10)? Or is it 3 seperate strings?
Edit, I think I figured this part out. It's <[id]><[name]><[dateOfBirth]>. I recommend putting an example like <0123456789><wisper cow><2019-06-11 00:00>
done
Wow! That image helps out a lot!
What's generated isn't a QR code at all, so it shouldn't even be called as such.
There is already a kata on generating QR code (and one on QR code message encoding) which are both much, much more difficult than what is required by this kata.
And if we aren't generating a QR code, there isn't much reason to turn it into a canvas and comparing the image content by certain base64 expressions, since there can be a million things that can cause the result to be different (format? PNG compression? Resolution? Pixel aliasing/alignment?). A 2D array is already sufficient.
Yes you are right it is not a QR code. Therefore, I will remove any mention of QR code from the description. But I want to leave the string in base64 as the return value as it is, since this is a rather unusual resulting value for tasks on codewars and more visual
done
This comment has been hidden.
added