
What's New - September 2003
September
28, 2003: Building on last week's threads test, I
completed and posted Elevator
Simulator 1 today. The "elevators" from last
week's program now have internal destination buttons that you can
access by clicking on an elevator. There are also up/down
call buttons on each floor and a simple scheduler to dispatch an
elevator in response to call button clicks. We're up
to about 1000 lines of code so far and are perhaps half
done. Version 2 to follow will allow user
control of scheduling strategies, add automated passenger scripts
and performance reporting, but probably not next week.
I need a break to pay play with my new
log splitter!
September 21, 2003: Today's program
over in the Delphi Techniques section explores threaded
processing. Threads are separate processes that run
independently within a single program's space. I have
been working for several days on an Elevator Simulation
program. Controlling these things is a tougher problem than
appears at first glance, partially because the order of handling
requests depends on the state of the system as well as the order
received. To make a long story short, after several false
starts, I decided to define the elevators as thread objects where
they can operate independently. Threads
test 1 - Elevators looks like a promising start. And I
learned enough about threads coding in the process to make a
separate posting seem worthwhile.
September 19, 2003: Virus
alert. I received five copies today of a purported
Microsoft security update that actually contains the "Worm
Automat AHB" virus. Just a reminder: Microsoft
will never send updates via email! Delete any such
emails immediately, and keep your anti-virus program updated. Someone is trying hard to do some
mischief. Of course, just the fact that five "security
update" emails were received in one day might be a tip-off
that the things are not as they seem.
September
14, 2003: Don Rowlett reported a minor problem with a Graph
Traverse program posted some time ago. The program is
mainly a demonstration of of depth first search techniques
as it checks all paths through a grid of numbers looking for the
path with largest and smallest sums. The grids are
randomly generated and the display for the largest size had
been truncated. Fixed today.
Also posted today one more attempt at improving
the piece moving method in Tangram2.
Max Burgos found another bug allowing pieces to be dropped on top
of other pieces under some conditions. I
replaced the PointInPoly procedure with one that works only
for convex polygons (polygons without indentations).
If we move around such a polygon (i.e. tangram piece) and check
each side against a point being tested, any interior point will
always be on the same side of each edge. Any exterior
point will always fall on both sides of the lines through
the edges.
September
8, 2003: Dürer's
Magic Square appeared in an engraving by Albrecht Dürer
in 1514. This program, posted some time ago,
challenges the viewer to see how many of the 86 number
combinations adding to the square's magic number they can
find. Viewer Don Rowland recently noticed a
minor problem while finding solutions - the program allowed
selecting the same number more than once! Together we
came with the fix posted today.
September 5, 2003: Thanks to
sharp-eyed (and sharp) viewers, this seems to be
program fix-up month. To go along with the theme I posted a
new version of FileFixup
today; The original program corrected a particular
problem I had with a malformed file that included an extra
carriage return at the end of each line. Steve Moller from the land
down-under recently made a worthwhile addition to the program by incorporating Delphi's AdjustLineBreaks
function. This function corrects other common line
break errors by inserting missing Cr or Lf characters to make
valid line endings. It also reverses Lf-Cr sequences to
Cr-Lf. While at it, I added a display form to show hexadecimal
and character views of the input and output files. Just for
testing I've added file PasDoc2.txt with missing carriage returns
in the downloads.
September
4, 2003: Max Burgos has been converting my Tangram
2 program to Visual Basic. He pointed out
two errors in the Delphi version, one of which is now
fixed. In the diagram at left, the first figure
in the "Easy" figure set, the large red
triangle could have been rotated and dropped over the small green
triangle without the overlap being detected. There were
all sorts of tests for shared borders and intersecting sides but
the "completely enclosed" case slipped
through. If you
want to gain an appreciation for the human visual system, study the
algorithms to determine whether polygons touch or
overlap.
The second error is not so easily
fixed. The fourth figure in the "Veryhard"
figure set can be incorrectly solved leaving a empty space
(Place the parallelogram across the "arrow
shaft" - it should not fit, but it does). The problem is that figures get
distorted as they are rotated because the coordinates used to
define pieces and figures are not accurate enough. No luck so far in making the
definitions more accurate and still keeping existing figure
definitions usable.
September 3, 2003: Viewer Mark wrote
today about a problem with another old math demo program, Circle
From 3 Points. He was confused because because the Y
coordinate increased toward the bottom of the
screen. So normal for us programmers that I forgot
that it was not so for everyone else. I fixed it
today.
September 2, 2003: Two years ago I
published Shared
Birthdays in the Math Topics section of DFF. It
discusses the probability that N randomly selected people will
share a common birthday. Like nearly all of the discussions
of this problem, it ignores the existence of Feb 29
birthdays during a leap year. Someone pointed out some code
a few months ago that addresses the leap year issue.
The statistics change very little but the difficulty of
understanding the methodology increases a bunch when leap
years are introduced. I finally spent a day working through
the algorithm and posted my description and revised program in a
separate Shared
Birthdays Leap Year page.
|