Ad
  • Default User Avatar

    Like this one! Performant & readable. I didn't realize there's such relation between the leg length and the direction :)

  • Custom User Avatar

    Yeah, superb that someone made a benchmark on this :) I would say that the results confirm the idea that just simply filling in the 1-s "in a spiral" should be faster than doing some more complex operations with lists etc. (as can be seen in some other solutions). Moreover, for me, this solution is maybe the most readable / comprehensible... :)

  • Default User Avatar

    I did some benchmarking using node for ~10 of the higher rated solutions on this problem currently, this one and the one by SupraDeus would seem to run by far the fastest of those I checked (this one is seemingly a bit faster for smaller spirals, and a bit slower on larger ones compared to SupraDeus's based on my limited tests).

    Anyways, food for thought.

  • Default User Avatar
  • Default User Avatar

    I keep getting one single error in final tests when comparing Ace of Hearts and 10 of Hearts. I've tried making my own tests with same cards and they pass as they should:
    Test.expect(new Card(Card.HEARTS, 1) > new Card(Card.HEARTS, 10)); => Test Passed;
    Test.expect(new Card(Card.HEARTS, 1) < new Card(Card.HEARTS, 10)); => Value is not what was expected;
    Test.expect(new Card(Card.HEARTS, 1) == new Card(Card.HEARTS, 10)); => Value is not what was expected;
    All the other comparisons in final test pass as well. Is there something wrong with final tests?

  • Default User Avatar
  • Default User Avatar

    Was struggling to see the pattern but failed. Yet it was so simple and so beautiful.