• obosob@feddit.uk
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      1 year ago

      Yeah, just use a char for card and test

      if(card < '7') count++;
      else count--;
      

      Or something, don’t mix types.

        • obosob@feddit.uk
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          Chars are just numbers, but yeah, an enum would work fine too, sure. The only advantage with using a char for it is that there’s no conversion needed for outputting them into strings so it’s a little easier. Less code, very readable, etc. Though yeah, thinking about it JQKA wouldn’t be numerically in the right order which could cause issues if the program did more than just implement HiLo

    • rho_@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      Half of it. This gives you the running count. You need to also keep track of “number of decks in shoe” -“number of cards dealt since last shuffle”/52 to tell you how many decks are left in the shoe, then divide the running count by the number of decks left to give you a true count.

      True count higher than 1? Start increasing your bet accordingly.