Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Why instantiate a new marine in the ctors?
Honestly the 0x20 is me just being terse. When this is compiled to IL code it converts the hex to an integer (32). So all we're really doing here is screening the characters that we know fall into the proper ascii range, and then bitwise and/or the character to switch the case (basically adding or removing 32, which is the distance between upper and lowercase chars).
This is faster than the built-in methods on Char, but this code also doesn't take culture into account, so it's probbaly not a totally fair comparison.
The C# version is spectacularly broken at the moment. The Preloaded class doesn't appear to have any of the methods required, even Reflection on this class comes up with zero methods.
This comment is hidden because it contains spoiler information about the solution
Another great Kata, nice work.
Cool, didn't see the spoiler option, corrected.
Also note that the benefit of this type of approach is keeping the API as functionalal and DRY as possible from the start. If we wanted to create a reaper for example, it would be simple:
I agree with creating IUnit here. No need to repeat the same code for all derived unit types.
This misses the concept of the visitor pattern. The idea here was to have another class shoulder the responsibility of damage taken depending on the type of unit.
String constructor might win out here versus string.Join if you want to squeeze out more performance. I love this type of challenge for micro-optimizations.
char has .ToUpperInvariant() and .ToLowerInvariant() which are better optimized in cases like this. Worth taking a look at if you're interested.
This was a clever approach regardless. Unfortunately the casts here are pretty expensive, so it loses out to the built-in methods on char. On large strings though I've seen custom code have 20% improvement against the methods on char.
A lot of unnecessary information for the coder on this one, not to mention completely misleading information regarding casting to object in C#. This is a good concept that just needs to be revisited.
This comment is hidden because it contains spoiler information about the solution
Loading more items...