Ad
  • Custom User Avatar

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

  • Default User Avatar

    Though I agree that the description could be improved, it is not asking you to write code for the player behavior, just the dealer. In this scenario, the players have already drawn all of their cards, and you simply have to write code for a function that draws cards for the dealer until their total score is 17 or higher, and then returns a list of which players won according to the rules given.

  • Custom User Avatar

    Awesome Thank you! I wasn't sure if the interpreter needed to fail on its own or if I could throw my own exception but throwing my own exception worked! Thanks Benjaminz!

  • Default User Avatar

    Hey @KiplandDynamite - basically the kata has some input validation tests; at the bottom of the description it's saying "It should throw errors for empty strings or strings which don't represent a decimal number.".

    So it's actually up to you and your code to raise a Python error when the input is "invalid" i.e. when the input string is empty, or does not represent a decimal number (which is the case here).

    If you are new to Python, or haven't encountered this yet in any case, the way this is done is with the raise keyword - you can Google something like "raise exception Python" if you want more details and some examples but basically the syntax is: if (bad condition is True): raise

    The Python official docs aren't super helpful with examples, but this site is quite nice https://realpython.com/python-exceptions/ - disclaimer: I'm not paid by/ or endorsing them ;)

  • Custom User Avatar

    Having a little trouble with a particular test case. Test case "124X212", In this test case the middle character is not apart of the arithmetic required to return if the lucky string is true or false, and therefore does not throw a python error. Does anyone know how I should handle a case like this?

    Thanks

  • Custom User Avatar

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

  • Custom User Avatar

    While I enjoy the idea of this Kata the instructions are extremely unclear. There is a lot of considerations that need to be made to determine if a player should hit or not. This Kata does not help us outline the considerations that tell the players to hit or not to hit. Unless they are always supposed to hit until they achieve 21 but that seems kinda silly. The win conditions are also not outlined well and that causes a lot of confusion.

    In its current state I would avoid this kata which is a shame cause it does seem like it could be a fun one :/ please update this!

  • Custom User Avatar

    Sorry, language is python

  • Custom User Avatar

    What language?

  • Custom User Avatar

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

  • Custom User Avatar

    In case anyone was interested my problem was something really simple :/ when I copy pasted the rankCalc function from the increaseLevel function i forgot to switch the variable being setted to find enemy rank from enemy level. Therefore "You've been defeated" would never occur since self.rank was always equal to self.calcRank(enemy).

    Little tip for debugging. Scroll all the way down and use the tests at the bottom. The ones at the top while funny, will not provide you with insight necessary to debug.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Loading more items...