7 kyu

Simple Fun #193: Moment Of Time In Space

391 of 940myjinxin2015
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • katerikarin Avatar

    pretty fun problem!

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • ejini战神 Avatar

    C# generate warning -> tests/Fixture.cs(136,15): warning CS0219: The variable 'passed' is assigned but its value is never used

  • brennacodes Avatar

    I feel like the instructions could be cleaned up a bit without losing the overall sentiment. I made some suggestions below, also available at the gist here..

    Task

    You are given a moment. You must decode the time and space of each moment to determine if it is in the past, present, or future.

    Moments are given as a string of 8 characters (e.g. "11:01 pm").

    Time is the sum of characters that increase time (i.e. numbers in range ['1'..'9']).

    Space in the number of characters which do not increase time (i.e. all characters excluding those that increase time).

    Your method should return an array of three elements representing [past, present, and future]. Two elements will be false, and one will be true. The true value should be at whichever index corresponds to the proper moment in time.

    Past, present, or future is determined as follows:

    • If time is greater than space, then the moment is from the future.
    • If time is less than space, then the moment is from the past.
    • Otherwise, it is the present moment.

    Example

    moment = "01:00 pm"

    Time equals 1

    0 1 : 0 0 p m
    +

    Space equals 7

    0 1 : 0 0 p m
    + + + + + + +

    Time < Space, so the moment is from the past.

    The output should be [true, false, false].

    • nicopcat Avatar

      Geez.. Finally figure out what this taka wants me to do with the [Space] thing. Space should be the non-number and no-zero character in this given string like you listing there.

      Thanks for explanations.

    • brennacodes Avatar

      Sure thing! Glad you found it helpful! The instructions for this kata were making my head spin (and not in a good way), so I figured other people might be feeling the same.

  • kAPCHA Avatar

    can someone help me with one question. For moment = "01:00 pm", the output should be [true, false, false].

    time equals 1, and space equals 7, so the moment is from the past. how we know that space equal 7?

  • rowcased Avatar

    C Translation kumited, (myjinxin inactive) ;)

  • A_Vaclav Avatar

    Guys! It's good that you made the puzzle. But not all participants have English as their first language. They can't play on words ... Add the phrase to the end of the Kata Description: "And remember, time does not stand still." To understand "increase - do not increase".

    • JohanWiltink Avatar
      1. Yes, kata can play on words. Where does it say they can't?
      2. This kata's author was Chinese. Broaden your mind.

      If you feel you need to suggest updates to the description, by all means, do so. But please don't make it sound like you want all descriptions dumbed down to flavourless beginner's English because some people might not be able to understand every nuance.

      Issue marked resolved by JohanWiltink 3 years ago
  • user9644768 Avatar

    Ruby translation should be updated 3.0, see relevent information here: https://github.com/codewars/content-issues/wiki/List-of-Ruby-Kata-to-Update

  • pre Avatar

    Fun kata, thanks!

    Note, typo in the description:

    "Otherwise, it is the preset moment." -- should be "present" :)