• 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
willbraun Avatar
Name:Will Braun
Clan:Carolina Code School
Member Since:May 2022
Last Seen:Sep 2024
Profiles:
Following:38
Followers:38
Allies:38
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (16)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • willbraun
    • resolved a suggestion on "Calculate Serve Point Win Percentage in Tennis" kata
    • 3 years ago

    Added, thanks!

  • Custom User Avatar
    • MelonFruit
    • created a suggestion for "Calculate Serve Point Win Percentage in Tennis" kata
    • 3 years ago

    Maybe add more tags like statistics and probability

  • Custom User Avatar
    • JohanWiltink
    • commented on "Calculate Serving Point Win Percentage in Tennis" kata
    • 3 years ago

    Yep, that should work. :]

  • Custom User Avatar
    • willbraun
    • commented on "Calculate Serving Point Win Percentage in Tennis" kata
    • 3 years ago

    Gotcha, I changed it to assert.closeTo with a delta of 0.01 (1 percentage point), I would think that would be large enough to capture other correct calculation orders.

  • Custom User Avatar
    • JohanWiltink
    • commented on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    Now the issue is that people that do calculations in a different order than the reference solution may fail tests when they shouldn't ( even fixed tests might be affected ). Testing should be done with assert.approximately instead of assert.equal ( or, in both cases, an equivalent ).

    This is documented, but the whole subject is a wasps' nest.

  • Custom User Avatar
    • willbraun
    • resolved an issue on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    Changed from strings to floating point.

  • Custom User Avatar
    • willbraun
    • resolved an issue on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    Fixed, thank you for catching that!

  • Custom User Avatar
    • thespiderlady
    • created an issue for "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • willbraun
    • commented on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    Thanks for the tip! I added a loop for random tests.

  • Custom User Avatar
    • willbraun
    • commented on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    I knew calculations with floating point numbers aren't always precise so I figured rounding and converting to a string may avoid that. Another thought I had would be to have the input expect 0-100 as a "percentage" and output a float from 0-100. Do you think that would help?

  • Custom User Avatar
    • JohanWiltink
    • commented on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    I see no specification of order of operations, so the kata is dealing with inexact values regardless. It's also theoretically possible to extract the floating point values from the output string and compare these with the required margin for error to the expected value.

    Author should have just picked a task limited to integers for his first kata. This is going to be a nightmare any which way. It should probably be fixed by an experienced author.

  • Custom User Avatar
    • hobovsky
    • commented on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    Note that percentages encoded as strings would be ok(ish), if calculations would be kept in a precise domain. If inputs were precise decimal values (potentially encoded as strings), or precise fractions, or anything like this, then string encoded decimals could be acceptable in some languages. But in this kata, inputs are (despite of what the description claims) not decimal values, but they are binary floating point values, what can cause problems if the final result is expected to be precise.

  • Custom User Avatar
    • JohanWiltink
    • created an issue for "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    Do not encode percentages as strings. Encode them as floating point values, with all difficulty that entails.

  • Custom User Avatar
    • Fbasham
    • commented on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    Ideally you should have around 100-200 random tests. You can create a loop to generate and run the tests. See this guide for more information: https://docs.codewars.com/languages/javascript/authoring/

  • Custom User Avatar
    • willbraun
    • resolved an issue on "Calculate Serve Points Won in Tennis" kata
    • 3 years ago

    Ok I updated it, let me know if that works.

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

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...