1. 3
  1.  

  2. 2

    I was never taught this FizzBuzz game in school. Is it common? I think I’ve seen more references to it as a programming interview question than as a game.

    1. 2

      I’m confused, did anyone call it a game? But FWIW, in my home country, we do have something similar that’s played as a drinking game.

      1. 2

        Not in this article, no. But I’ve heard FizzBuzz described as a game before. The first time I ever heard of it was in some beginners programming tutorial, years back, and it said something to the effect of “Let’s teach the computer to play the children’s game FizzBuzz”, and I had never heard of it.

        A drinking game, huh? Interesting

        1. 0

          A drinking game, huh? Interesting

          Basically you have substitution rules like multiple of 3 == Fizz, multiple of 5 == Buzz. Then each person says a number, going in a circle clockwise. If you mess up and don’t appropriately say Fizz or Buzz, you have to take a shot.

    2. 0

      Okay I kinda love this. I wonder if POSIX make would be possible … it’d be much more complicated..

      1. 2

        posix sh does have arithmetic expansion so probably?

        1. 0

          Wait it does? I couldn’t find it in the manpage.

        2. 2

          Okay I kinda love this.

          The expected answer was “Thanks, I hate this”, but I’ll take it. ;-)

          Re POSIX make: the arithmetic part is part of POSIX, but seq is not. That said I tried this Makefile on macOS, NixOS, Arch Linux, and OpenBSD and all of their bin/sh implementations had seq. I’m not sure about the differences between GNU and POSIX make, but it did not work out of the box with OpenBSD’s make but I was too lazy to look into why.

          1. 0

            I love doing things that aren’t supposed to be done with software :)

            I think the define syntax is a GNU extension.

            1. 2

              I love doing things that aren’t supposed to be done with software :)

              Me too :-) That’s why I’m always surprised when a post like this gets serious comments like “seq is a non-portable shell builtin” (not here, on another site). I mean, yeah, that’s true, but maybe portability wasn’t my main concern for a throwaway hack…

              1. 0

                Hahah, fair enough :) The tricky thing, especially about make, is that it’s so tied to shell it’s also hard to know how much shell is too much.