Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #38716

Re: Allowed moves database chessboard, knight to many entries....

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Allowed moves database chessboard, knight to many entries....
Date Wed, 12 Aug 2020 12:12:34 +0100
Organization A noiseless patient Spider
Lines 44
Message-ID <87h7t886e5.fsf@bsb.me.uk> (permalink)
References <73e9271a-a86d-4eb6-9927-9c84d60c9cc6o@googlegroups.com> <XnsAC0995916183eejj99@194.109.6.166> <19bd3446-2d76-4e6d-a131-ee4a9834c331o@googlegroups.com> <XnsAC11C18F2E942eejj99@194.109.6.166> <0965b2e8-47ec-42b7-a294-a874d5f176abo@googlegroups.com> <42350bec-28d0-4b85-89db-1aed763e1026o@googlegroups.com> <XnsAC1396146B2C1eejj99@194.109.6.166> <b5f52c14-ed6e-4b0a-852d-dca3393d5889o@googlegroups.com> <XnsAC1582524E3CAeejj99@194.109.6.166> <39f38e8f-f303-4f76-9034-dc51bf49f7d6o@googlegroups.com> <XnsAC16EFA465EBFeejj99@194.109.6.166> <c097e9ab-72d6-4cc2-9198-722d4635c449o@googlegroups.com> <c24429d5-85ff-434c-aa10-728dea2d6283o@googlegroups.com> <5eec68a9-bbe9-48d9-895c-91cc335b9439o@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding 8bit
Injection-Info reader02.eternal-september.org; posting-host="83ec15541f21d3ee705dc86ab8efc171"; logging-data="14773"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mHbU3XT3PUUaR5Qo+DJhjRcKmdFhHGZ4="
Cancel-Lock sha1:+NCgcZQLY/sy2yfrjToywjuUEb4= sha1:wOj2F7QZ+8ECsmM0qcRtXFn45Lo=
X-BSB-Auth 1.9b839c507b4c08d140cf.20200812121234BST.87h7t886e5.fsf@bsb.me.uk
Xref csiph.com comp.lang.javascript:38716

Show key headers only | View raw


Jonas Thörnvall <jonas.thornvall@gmail.com> writes:

> Den onsdag 12 augusti 2020 kl. 09:40:48 UTC+2 skrev Jonas Thörnvall:
>> Den onsdag 12 augusti 2020 kl. 00:57:32 UTC+2 skrev luserdroog:
>> > On Tuesday, August 11, 2020 at 4:33:36 PM UTC-5, Evertjan. wrote:
>> > > <jonas.thornvall@gmail.com> wrote on 11 Aug 2020 in comp.lang.javascript:
>> > > 
>> > > > Honestly Evertjan i find 
>> > > > Math.random() < 0.5
>> > > > giving a boolean weird enough
>> > > 
>> > > The result of any comparison must be a boolean.
>> > > 
>> > > Programming needs some honest brain exercise.
>> > > 
>> > 
>> > Without going too far out on a limb, I support the use of relational
>> > operators to produce boolean values. (I also like implicit conversion
>> > from 0 and 1.)
>> 
>> if (Math.random<0.5) {holder=false;}

(you meant to call the function: if (Math.random()<0.5) {holder=false;}

> Not holder=Math.random<0.5 
> It is both syntactical and semantical gibberish

Your code is not equivalent to assignment you dislike.  You'd need
something like

 if (Math.random()<0.5) holder=false; else holder=true;

But what do you think the "Math.random() < 0.5" in the "if" is if not an
expression yielding a true/false result?  And if that is what it is, why
not allow the result to be assigned just like the result of any pther
expression?

Many decades ago, before we knew how to do this stuff, there were
programming languages that only allowed relations and comparisons in
certain positions (the test of an "if" or a "while" etc.) but thankfully
those days are long gone.

-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-28 14:31 -0700
  Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-28 14:53 -0700
  Re: Allowed moves database chessboard, knight to many entries.... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-07-29 00:55 +0200
    Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-06 09:31 -0700
      Re: Allowed moves database chessboard, knight to many entries.... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-06 19:01 +0200
        Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-08 04:43 -0700
          Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-08 04:53 -0700
            Re: Allowed moves database chessboard, knight to many entries.... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-08 14:45 +0200
              Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-10 02:11 -0700
                Re: Allowed moves database chessboard, knight to many entries.... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-10 12:48 +0200
                Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-11 11:24 -0700
                Re: Allowed moves database chessboard, knight to many entries.... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-11 23:33 +0200
                Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-11 14:40 -0700
                Re: Allowed moves database chessboard, knight to many entries.... luserdroog <luser.droog@gmail.com> - 2020-08-11 15:57 -0700
                Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-12 00:40 -0700
                Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-12 00:42 -0700
                Re: Allowed moves database chessboard, knight to many entries.... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-08-12 12:12 +0100
                Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-12 05:13 -0700
                Re: Allowed moves database chessboard, knight to many entries.... luserdroog <luser.droog@gmail.com> - 2020-08-12 10:23 -0700
                Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-12 00:50 -0700
                Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-12 01:00 -0700
                Re: Allowed moves database chessboard, knight to many entries.... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-12 11:58 +0200
                Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-12 05:14 -0700
          Re: Allowed moves database chessboard, knight to many entries.... "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-08 14:44 +0200
          Re: Allowed moves database chessboard, knight to many entries.... Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-08-22 08:10 -0700
          Re: Allowed moves database chessboard, knight to many entries.... Scott Sauyet <scott@sauyet.com> - 2020-08-25 16:03 -0700
  Re: Allowed moves database chessboard, knight to many entries.... Scott Sauyet <scott@sauyet.com> - 2020-08-25 15:06 -0700

csiph-web