• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
flibustier Avatar
Name:John
Clan:Semi-croustillants
Member Since:Dec 2017
Last Seen:Sep 2023
Profiles:
Following:5
Followers:7
Allies:5
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (19)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • Voile
    • created an issue for "Compress an array of numbers into an efficient Base 64 " kata
    • 2 years ago

    Random tests never generate a situation where incorrect ambiguous ending would result in failed tests.

  • Custom User Avatar
    • JohanWiltink
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    "ChwLA=" can also be umambiguously encoded as "ChwL", and "DC=" as "DC".

    Now do you believe it is possible to encode the same array in multiple ways, by abusing the ambiguous ending?

    Note that I could also have given you "ChwLAA=", or "DC_=".

  • Custom User Avatar
    • flibustier
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    DC= means D => 4 bits encoding so there is no confusion possible as we have 6 bits of length, C means 00 00 11, result is [0] (the = could be safely ignored)
    ChwLA= => 3 bits
    hwLA => 100 001 110 000 001 011 000 000
    => could be [4, 1, 6, 0, 1, 3, 0, 0] but as we have the = flag,
    we know we could remove the trailling zeros so the real result is [4, 1, 6, 0, 1, 3]
    So the = as a real meaning in this case here to differenciate [4, 1, 6, 0, 1, 3] from [4, 1, 6, 0, 1, 3, 0] or from [4, 1, 6, 0, 1, 3, 0, 0]

  • Custom User Avatar
    • JohanWiltink
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    How would you decode "ChwLA=" ? Or "DC=" ?

  • Custom User Avatar
    • flibustier
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    Yes exactly, that’s why when you said "wouldn't it just be fun if non-ambiguous endings could be encoded the same way ambiguous endings have to be?" it doesn’t seem to be possible !

  • Custom User Avatar
    • JohanWiltink
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    Isn't there a '=' at the end if there are bits to be taken off?

  • Custom User Avatar
    • flibustier
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    Hello @Johan Wiltink

    Indeed, I could remove the requirement of empty string when we have an empty array in the encoder !

    We could encode non-ambiguous endings the same way as ambiguous when the last chunk is not exactly 6 bits, but when it does, we need a flag (or a way) to determine if we have to remove last bits or not at decoding time, how else would you do it ?

  • Custom User Avatar
    • JohanWiltink
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    Your decoder accepts single character inputs and correctly decodes them to empty lists. But you still require [] to be encoded to "" explicitly.

    You're still missing a great opportunity to allow for different valid encodings of the same input here.

    I still haven't checked, but wouldn't it just be fun if non-ambiguous endings could be encoded the same way ambiguous endings have to be?

  • Custom User Avatar
    • flibustier
    • resolved an issue on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    I added random testing, thank you for pointing this out !

  • Custom User Avatar
    • flibustier
    • resolved a suggestion on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    Thank you for your reply @Johan Wiltink !

    I’ve updated the kata according that, now random tests are using the decoder to check for idempotent and it’s working fine :)

    Thank you for this suggestion !

  • Custom User Avatar
    • JohanWiltink
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    talking about the validation tests, where I should write tests which use the decoder to validate the idempotence of the solution ?

    Exactly that. I meant you should write a decoder, not solver.

    It would of course be possible to have solver write a decoder as well. The beauty of having solver write an encoder and a decoder is that you only need either a reference encoder or a reference decoder to test both. :]

  • Custom User Avatar
    • flibustier
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    Hello @JohanWiltink and thank you for all your great feedback!

    I’m not sure to understand perfectly your comment about decoder, do you mean the kata should be focus on decoding instead of encode, or should it be on decoding and encoding, or you’re talking about the validation tests, where I should write tests which use the decoder to validate the idempotence of the solution ?

  • Custom User Avatar
    • JohanWiltink
    • commented on "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    I would actually suggest to write a decoder and test by generating inputs, let solver encode them, decode the result, and compare the final result to the original input.

    I haven't figured out if disambiguating the trailing part can always be done by one method or the other, but I wouldn't discount the possibility that that could work. If so, it should be allowed, and it would add one more possibility for multiple different correct answers.

    All of that can be handled by decoding encoded values.

  • Custom User Avatar
    • JohanWiltink
    • created a suggestion for "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    You’re goal is to write the encode function.

    * Your

  • Custom User Avatar
    • JohanWiltink
    • created a suggestion for "Compress an array of numbers into an efficient Base 64 " kata
    • 4 years ago

    The base64 link in the description is wrong.

  • Loading more items...
  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...