Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.physics > #644461
| Path | csiph.com!xmission!news.alt.net!not-for-mail |
|---|---|
| From | owl <owl@rooftop.invalid> |
| 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 | <szbagi03.ab@rooftop.invalid> (permalink) |
| References | <D5AA0F44.AEB1A%usenet@gallopinginsanity.com> <Jeff-Relf.Me@Aug.4--0.31pm.Seattle.2017> <feae2868-c0a7-4ff5-ae71-0ad427d8028f@googlegroups.com> <om2jt7$ogs$1@news.albasani.net> <Jeff-Relf.Me@Aug.4--1.48pm.Seattle.2017> <om2v602ceo@news4.newsguy.com> <Jeff-Relf.Me@Aug.4--6.20pm.Seattle.2017> |
| NNTP-Posting-Host | boom.rooftop.invalid |
| X-Face | $BHf)vM$6p_?9L`jmOQ54JeNyL+%MZGGRfH8&grb[Y%-jU`MCPAQN=/SVDa{<KrBxl"%XcV >(/67bP(YB}rjV^h><g$kPGE_caHX,aa}4A1~sto7YJo#ob/SgNiMsoaMMXiOX9%DjyJM_-=$`F5b' JM,?/R/;V1RI%|eClL6ymI}LbZERB=q+"pJ)uI{ngj1DRF1;E5[r$f[4mgt9=7Pw@vl8@I%eYs6KWJ e%LU3#U@M[X^YBp2VY]-'1*reGDbk%#n1ve'*RffQ3j,(TCYivjb*M`qmuC5rHgbN)nSsx)697q/vt //''?=gM'C.salgG^f)>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 |
Cross-posted to 2 groups.
Show key headers only | View raw
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.
Back to sci.physics | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: 4 lines, 4 states. Snit <usenet@gallopinginsanity.com> - 2017-08-03 22:11 -0700
Re: 4 lines, 4 states. Snit <usenet@gallopinginsanity.com> - 2017-08-03 22:47 -0700
Re: 4 lines, 4 states. Snit <usenet@gallopinginsanity.com> - 2017-08-03 22:52 -0700
Re: Mozilla ThunderBird. Snit <usenet@gallopinginsanity.com> - 2017-08-04 10:43 -0700
Re: FizzBuzz is a trick question. Snit <usenet@gallopinginsanity.com> - 2017-08-04 11:47 -0700
Re: Michael Glasser, Steve Carroll, Marek Novotny, Branimir Maksimovic, etc. Snit <usenet@gallopinginsanity.com> - 2017-08-04 12:51 -0700
Re: I'm the best c coder here. Snit <usenet@gallopinginsanity.com> - 2017-08-04 14:03 -0700
Re: I'm the best c coder here. "F. Russell" <fr@random.info> - 2017-08-04 23:15 +0000
Re: I'm the best c coder here. benj <benj@nobody.net> - 2017-08-04 19:35 -0400
Re: I'm the best c coder here. "F. Russell" <fr@random.info> - 2017-08-05 16:08 +0000
Re: Fabian seldom writes code, much less test it. owl <owl@rooftop.invalid> - 2017-08-05 03:09 +0000
Re: 2 lines, 2^2 states, easily modified to 3^2 states. owl <owl@rooftop.invalid> - 2017-08-05 05:42 +0000
Re: Fabian seldom writes code, much less test it. "F. Russell" <fr@random.info> - 2017-08-05 13:37 +0000
Re: Fabian seldom writes code, much less test it. "F. Russell" <fr@random.info> - 2017-08-05 14:25 +0000
Re: I'm the best c coder here. owl <owl@rooftop.invalid> - 2017-08-05 03:22 +0000
Re: I'm _still_ the best c coder here. owl <owl@rooftop.invalid> - 2017-08-05 06:12 +0000
Re: Owl's FizBuzGozKaz branches 5 times more often. owl <owl@rooftop.invalid> - 2017-08-05 15:40 +0000
Re: I'm _still_ the best c coder here. moroney@world.std.spaamtrap.com (Michael Moroney) - 2017-08-05 22:16 +0000
Re: I increment things at the _start_ of a loop. moroney@world.std.spaamtrap.com (Michael Moroney) - 2017-08-07 03:24 +0000
Re: I increment things at the _start_ of a loop. Snit <usenet@gallopinginsanity.com> - 2017-08-06 20:35 -0700
Re: "while ( x++ < 100 )" isn't "obscure". moroney@world.std.spaamtrap.com (Michael Moroney) - 2017-08-07 04:59 +0000
Re: I'm the best c coder here. chrisv <chrisv@nospam.invalid> - 2017-08-07 06:59 -0500
Re: Michael Glasser, Steve Carroll, Marek Novotny, Branimir Maksimovic, etc. Doomsdrzej <.m@nsn.s> - 2017-08-05 11:52 -0400
Re: Michael Glasser, Steve Carroll, Marek Novotny, Branimir Maksimovic, etc. Snit <usenet@gallopinginsanity.com> - 2017-08-05 09:55 -0700
csiph-web