Path: csiph.com!xmission!news.alt.net!not-for-mail From: owl Newsgroups: comp.os.linux.advocacy,sci.physics Subject: Re: Fabian seldom writes code, much less test it. Date: Sat, 5 Aug 2017 03:09:31 +0000 (UTC) Organization: O.W.L. Lines: 24 Message-ID: References: NNTP-Posting-Host: boom.rooftop.invalid X-Face: $BHf)vM$6p_?9L`jmOQ54JeNyL+%MZGGRfH8&grb[Y%-jU`MCPAQN=/SVDa{(/67bP(YB}rjV^h>cUh User-Agent: tin/2.2.1-20140504 ("Tober an Righ") (UNIX) (Linux/3.16.0-4-amd64 (x86_64)) Xref: csiph.com comp.os.linux.advocacy:425845 sci.physics:644461 In comp.os.linux.advocacy Jeff-Relf.Me wrote: > You ( Fabian ) replied ( to me ): > > > [ FizBuz's ] I/O is thee only limiting factor, not "x%3". > > > > The I/O can easily be separated from the decision process > > by using some sort of index (either an array or bit fields). > > Then, _my_ DIVISION-LESS algorithm will surpass all others. > > But the problem is exceedingly trivial. > > It is a sign of stupidity to dwell on it. > > Forget this "DIVISION-LESS algorithm" bullshit, the answer is just: > > int x = 0, F, B ; > while ( x++ < 100 ) printf("\n"), F = !(x%3), B = !(x%5), printf( > F && B ? "FizBuz" : F ? "Fiz" : B ? "Buz" : "%d", x ); > > 3 lines, 4 states, done. > Because nothing says "readable" and "maintainable" like a bunch of nested ternary operations.... Try it with four values, where your state count goes to 16. See how "readable" that is with your approach.