Ad
  • Custom User Avatar

    Pretty nice kata to figure out.

  • Custom User Avatar

    If this is the improved description, I can only imagine how horrible the original description must have been.

  • Custom User Avatar

    Haskell translation

    A language-specific snippet was added to the end of description.

  • Custom User Avatar

    so my indexing doesnt want to work, it says it is incorrect cous it is touple format and i do it as following: pairs[0,0] and it gives me an erroer. any solutions?

  • Custom User Avatar

    I am morally opposed to bare its, fight me :p

    I'll take your word for it that it's all possible situations.

  • Custom User Avatar

    Forget, passed after rereading
    Sorry

  • Custom User Avatar

    what about now?

  • Custom User Avatar

    you're absolutely right, please change that to use sample, there should be no duplicate choices, and then please self-approve that if there's nothing else that's jumping out at you.
    I'm slightly mad about that you wrapped it up in a describe but that's okay.
    the rationale with it is that those are all possible situations, any other combination/permutation one can come up with will be identical but with renamed symbols

  • Custom User Avatar

    This should do what you want in a more concise fashion. I'm not entirely sure what it is you want this for because we're super sleep deprived but the two are equivalent.

  • Custom User Avatar

    I'm pretty sure I can make the permutation generator you wrote nicer as well if you give me a second.

  • Custom User Avatar

    Approved it, but are you sure you wanted to do random.choices(fruit_names, k=7) rather than random.sample(fruit_names, k=7)?

  • Custom User Avatar

    I don't hate the task itself though. Mind pressing green button on my fork? Swapped out description, changed to tuples for pairs, fully rewrote tests. Borderline too many random tests but I think I covered all unique cases so I like it that way. I addressed all of points 1 through 5. (stole+edited your solution as reference.. I suppose it's identical to mine. that was the process though xD) Maybe not even a terrible kata after this?

  • Custom User Avatar

    The mismatch is in that the author claims we should test for your point 2, but their own refsol does not test for it and instead considers any set of three completable trades to be valid - ie according the refsol ab,bc,cd is a valid input. They claimed in the discourse that this explicitly was not valid.

    Honestly we should just get this crap retired, it isn't even a good task.

  • Custom User Avatar

    Hi

    sorry, but unable tu understand the results of the task "buy" even with the tries of explanation below :

    when you begin with harvested apple and buy orange , have you only orange at this moment or apple+orange in your stock ?

  • Custom User Avatar

    For some reason I took a stab at writing a description, it's probably terrible:

    You've harvested a fruit.

    But the Internal Raisin Service (IRS) doesn't allow you to eat your own produce, you have to launder it on the market first.

    When you visit the market, you are given three conversion offers, and for each conversion offer you must decide which direction to trade.

    A conversion offer is a pair of fruits, and to buy the second fruit for the first fruit, the action is "buy"

    The opposite direction is "sell".

    ["apple", "orange"]

    If you have an apple, then you may buy an orange, or, if you have an orange, you may sell it for the apple.

    currently holding: apple
    ["apple", "orange"]
    buy
    currently holding: orange
    ["orange", "pear"]
    buy
    currently holding: pear
    ["apple", "pear"]
    sell
    currently holding: apple (successfully ended up with the same fruit again)
    

    As input you receive three conversion offers and your harvested fruit, and your output is a list of three actions of buy/sell, for the above example the output is: ["buy", "buy", "sell"].

    If it is not possible to end up with the original kind of fruit again after the three conversions, return "ERROR" instead of the list of actions.

  • Loading more items...