TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ROBERT FORTUNE
from: DAVID WILLIAMS
date: 1997-09-14 10:57:00
subject: Scramble

-> Here we have potentially useless code if and when the random number
-> generated is the same as the variable X% in which case the letter is
-> being swapped with itself which makes no logical sense at all. If
-> you're swapping a letter with itself, why bother using a swap routine
-> at all?
This is true, but not very interesting. Yes, an IF could be used to
check that the two characters are different before they are swapped.
However, no harm is done by swapping them anyway. In fact, omitting the
IF may make the code run faster, depending on such things as the length
of the string. Evaluating an IF takes time, comparable to that taken by
executing a swap.
-> There isn't a single comment in your code to explain what your code
-> is
-> supposed to be doing. Programs or code with no comments is worthless.
True. But surely any programmer could figure out such simple code
without having to have his hand held.
The code *works*, which makes it far from "worthless".
-> Your code is no better than mine or the other person's who also
-> posted a prompt reply (your reply is more than a month later and
-> isn't
-> any better).
->   You may shuffle cards like that in your mind, but it is physically
-> impossible to shuffle a card with itself when shuffling a deck of
-> cards. That might even be illegal in a real-world video card game
-> where real money is at stake.
I don't follow this conference much. I'm beginning to realize why...
My code *is* better, because it does the randomization properly. The
other routines don't. If you don't believe me, try it and see, with a
routine such as I just suggested in a previous message.
                                dow
--- PCBoard (R) v15.3 (OS/2) 5
---------------
* Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.